From 09a8e5e9e699e990db378894a5d9e4765866ffb1 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Mon, 16 May 2022 12:45:02 +0530 Subject: [PATCH] rbd: unset cluster Name metadata unsets the cluster name metadata key and value on the RBD image Signed-off-by: Prasanna Kumar Kalever --- internal/rbd/rbd_util.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index db9749eed..ed48bc43a 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -2028,5 +2028,11 @@ func (rv *rbdVolume) unsetAllMetadata(keys []string) error { } } + err := rv.RemoveMetadata(clusterNameKey) + // 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", clusterNameKey, rv, err) + } + return nil }