mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rbd: add unset volume/snapshot metadata utility functions
Added GetVolumeMetadataKeys() GetSnaoshotMetadataKeys() unsetVolumeMetadata() and unsetSnapshotMetadata() functions. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
1fd5277b3c
commit
bac33262ae
@ -1923,3 +1923,16 @@ func (rv *rbdVolume) setAllMetadata(parameters map[string]string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// unsetAllMetadata unset all the metadata from arg keys on RBD image.
|
||||
func (rv *rbdVolume) unsetAllMetadata(keys []string) error {
|
||||
for _, key := range keys {
|
||||
err := rv.RemoveMetadata(key)
|
||||
// TODO: replace string comparison with errno.
|
||||
if err != nil && !strings.Contains(err.Error(), "No such file or directory") {
|
||||
return fmt.Errorf("failed to unset metadata key %q on %q: %w", key, rv, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user