From e6e3d414f439927491ae315b9b14ed09101702a6 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Tue, 13 Aug 2019 07:50:19 +0100 Subject: [PATCH] librbd: disable mirroring when removing namespace Signed-off-by: Mykola Golub --- src/librbd/api/Namespace.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/librbd/api/Namespace.cc b/src/librbd/api/Namespace.cc index 282744e5b9e..16dd4b81b4d 100644 --- a/src/librbd/api/Namespace.cc +++ b/src/librbd/api/Namespace.cc @@ -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::remove(librados::IoCtx& io_ctx, const std::string& name) goto rollback; } + r = Mirror::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; -- 2.39.5