]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd: disable mirroring when removing namespace
authorMykola Golub <mgolub@suse.com>
Tue, 13 Aug 2019 06:50:19 +0000 (07:50 +0100)
committerMykola Golub <mgolub@suse.com>
Thu, 5 Sep 2019 12:57:47 +0000 (13:57 +0100)
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/librbd/api/Namespace.cc

index 282744e5b9e317330bfcc98a1bf2b4b7c111a663..16dd4b81b4d206b30f7e682311e785958d2053ba 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "common/errno.h"
 #include "cls/rbd/cls_rbd_client.h"
+#include "librbd/api/Mirror.h"
 #include "librbd/api/Namespace.h"
 #include "librbd/ImageCtx.h"
 
@@ -117,6 +118,13 @@ int Namespace<I>::remove(librados::IoCtx& io_ctx, const std::string& name)
     goto rollback;
   }
 
+  r = Mirror<I>::mode_set(ns_ctx, RBD_MIRROR_MODE_DISABLED);
+  if (r < 0) {
+    lderr(cct) << "failed to disable mirroring: " << cpp_strerror(r)
+               << dendl;
+    return r;
+  }
+
   r = cls_client::namespace_remove(&default_ns_ctx, name);
   if (r < 0) {
     lderr(cct) << "failed to remove namespace: " << cpp_strerror(r) << dendl;