mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-10 00:10:20 +00:00
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 <madhupr007@gmail.com>
This commit is contained in:
parent
0837c05be0
commit
332a47a100
@ -58,8 +58,12 @@ const (
|
|||||||
rbdTaskRemoveCmdInvalidString2 = "Error EINVAL: invalid command"
|
rbdTaskRemoveCmdInvalidString2 = "Error EINVAL: invalid command"
|
||||||
rbdTaskRemoveCmdAccessDeniedMessage = "Error EACCES:"
|
rbdTaskRemoveCmdAccessDeniedMessage = "Error EACCES:"
|
||||||
|
|
||||||
// image metadata key for thick-provisioning
|
// image metadata key for thick-provisioning.
|
||||||
thickProvisionMetaKey = ".rbd.csi.ceph.com/thick-provisioned"
|
// 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
|
// 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.
|
// the expansion can be allocated too.
|
||||||
func (ri *rbdImage) isThickProvisioned() (bool, error) {
|
func (ri *rbdImage) isThickProvisioned() (bool, error) {
|
||||||
value, err := ri.GetMetadata(thickProvisionMetaKey)
|
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 {
|
if err == librbd.ErrNotFound {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
return false, fmt.Errorf("failed to get metadata %q for %q: %w", thickProvisionMetaKey, ri, err)
|
return false, fmt.Errorf("failed to get metadata %q for %q: %w", thickProvisionMetaKey, ri, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user