rbd: disable FeatureDeepFlatten when doing DeepCopy()

Not all Linux kernels support the deep-flatten feature. Disabling the
feature makes it possible to map RBD images on older kernels (like what
minikube uses).

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2021-06-16 17:19:55 +02:00 committed by mergify[bot]
parent 4908ff8743
commit b1045364d9

View File

@ -1531,7 +1531,24 @@ func (rv *rbdVolume) DeepCopy(dest *rbdVolume) error {
} }
defer image.Close() defer image.Close()
return image.DeepCopy(dest.ioctx, dest.RbdImageName, opts) err = image.DeepCopy(dest.ioctx, dest.RbdImageName, opts)
if err != nil {
return err
}
// deep-flatten is not supported by all clients, so disable it
return dest.DisableDeepFlatten()
}
// DisableDeepFlatten removed the deep-flatten feature from the image.
func (rv *rbdVolume) DisableDeepFlatten() error {
image, err := rv.open()
if err != nil {
return err
}
defer image.Close()
return image.UpdateFeatures(librbd.FeatureDeepFlatten, false)
} }
func (rv *rbdVolume) listSnapshots() ([]librbd.SnapInfo, error) { func (rv *rbdVolume) listSnapshots() ([]librbd.SnapInfo, error) {