From: Pan Liu Date: Sun, 26 Feb 2017 00:23:55 +0000 (+0800) Subject: rbd: allow to remove snapshots of an image when Ceph cluster becomes full. X-Git-Tag: v12.0.1~191^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0daaa3c63b0c908e24dd12ea644e47811c08279c;p=ceph.git rbd: allow to remove snapshots of an image when Ceph cluster becomes full. Signed-off-by: Pan Liu --- diff --git a/src/tools/rbd/action/Snap.cc b/src/tools/rbd/action/Snap.cc index 15b975aabf47..9d6d45f64c99 100644 --- a/src/tools/rbd/action/Snap.cc +++ b/src/tools/rbd/action/Snap.cc @@ -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; }