From 332a47a100ef87f9852d75178da1c11f633e053c Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 30 Jun 2021 10:41:49 +0530 Subject: [PATCH] rbd: deprecate .rbd.csi.ceph.com/thick-provisioned metadata key As image metadata key starting with '.rbd' will not be copied when we do clone or mirroring, deprecating the old key for the same reason use 'csi.ceph.com/thick-provisioned' to set image metadata. Signed-off-by: Madhu Rajanna --- internal/rbd/rbd_util.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index 987191a94..1361d2cb8 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -58,8 +58,12 @@ const ( rbdTaskRemoveCmdInvalidString2 = "Error EINVAL: invalid command" rbdTaskRemoveCmdAccessDeniedMessage = "Error EACCES:" - // image metadata key for thick-provisioning - thickProvisionMetaKey = ".rbd.csi.ceph.com/thick-provisioned" + // image metadata key for thick-provisioning. + // As image metadata key starting with '.rbd' will not be copied when we do + // clone or mirroring, deprecating the old key for the same reason use + // 'thickProvisionMetaKey' to set image metadata. + deprecatedthickProvisionMetaKey = ".rbd.csi.ceph.com/thick-provisioned" + thickProvisionMetaKey = "rbd.csi.ceph.com/thick-provisioned" ) // rbdImage contains common attributes and methods for the rbdVolume and @@ -1534,10 +1538,14 @@ func (rv *rbdVolume) setThickProvisioned() error { // the expansion can be allocated too. func (ri *rbdImage) isThickProvisioned() (bool, error) { value, err := ri.GetMetadata(thickProvisionMetaKey) - if err != nil { + if err == librbd.ErrNotFound { + // check if the image is having deprecated metadata key. + value, err = ri.GetMetadata(deprecatedthickProvisionMetaKey) if err == librbd.ErrNotFound { return false, nil } + } + if err != nil { return false, fmt.Errorf("failed to get metadata %q for %q: %w", thickProvisionMetaKey, ri, err) }