rbd: unset metadata if setmetadata is false

We need to unset the metadata on the clone
and restore PVC if the parent PVC was created
when setmetadata was set to true and it was
set to false when restore and clone pvc was
created.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit d12400aa9c)
This commit is contained in:
Madhu Rajanna
2022-11-11 12:45:46 +01:00
committed by mergify[bot]
parent 72e67d7da5
commit 90d76e9c8a
2 changed files with 196 additions and 4 deletions

View File

@ -2091,10 +2091,6 @@ func (rv *rbdVolume) setAllMetadata(parameters map[string]string) error {
// unsetAllMetadata unset all the metadata from arg keys on RBD image.
func (rv *rbdVolume) unsetAllMetadata(keys []string) error {
if !rv.EnableMetadata {
return nil
}
for _, key := range keys {
err := rv.RemoveMetadata(key)
// TODO: replace string comparison with errno.