]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: allow to remove snapshots of an image when Ceph cluster becomes full. 12627/head
authorPan Liu <pan.liu@istuary.com>
Sun, 26 Feb 2017 00:23:55 +0000 (08:23 +0800)
committerPan Liu <pan.liu@istuary.com>
Sun, 26 Feb 2017 00:23:55 +0000 (08:23 +0800)
Signed-off-by: Pan Liu <liupan1111@gmail.com>
src/tools/rbd/action/Snap.cc

index 15b975aabf4763c04315ee4b04672ba7261b46e9..9d6d45f64c998f62ac4194d2fc6c52d91f01cc8c 100644 (file)
@@ -279,8 +279,13 @@ int execute_remove(const po::variables_map &vm) {
   librados::Rados rados;
   librados::IoCtx io_ctx;
   librbd::Image image;
-  r = utils::init_and_open_image(pool_name, image_name, "", false, &rados,
-                                 &io_ctx, &image);
+  r = utils::init(pool_name, &rados, &io_ctx);
+  if (r < 0) {
+    return r;
+  }
+
+  io_ctx.set_osdmap_full_try();
+  r = utils::open_image(io_ctx, image_name, false, &image);
   if (r < 0) {
     return r;
   }
@@ -320,8 +325,13 @@ int execute_purge(const po::variables_map &vm) {
   librados::Rados rados;
   librados::IoCtx io_ctx;
   librbd::Image image;
-  r = utils::init_and_open_image(pool_name, image_name, "", false, &rados,
-                                 &io_ctx, &image);
+  r = utils::init(pool_name, &rados, &io_ctx);
+  if (r < 0) {
+    return r;
+  }
+
+  io_ctx.set_osdmap_full_try();
+  r = utils::open_image(io_ctx, image_name, false, &image);
   if (r < 0) {
     return r;
   }
@@ -439,8 +449,13 @@ int execute_unprotect(const po::variables_map &vm) {
   librados::Rados rados;
   librados::IoCtx io_ctx;
   librbd::Image image;
-  r = utils::init_and_open_image(pool_name, image_name, "", false, &rados,
-                                 &io_ctx, &image);
+  r = utils::init(pool_name, &rados, &io_ctx);
+  if (r < 0) {
+    return r;
+  }
+
+  io_ctx.set_osdmap_full_try();
+  r = utils::open_image(io_ctx, image_name, false, &image);
   if (r < 0) {
     return r;
   }