]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: set SNAP_DIR on listsnaps command
authorDavid Zafman <david.zafman@inktank.com>
Wed, 3 Apr 2013 03:59:17 +0000 (20:59 -0700)
committerSage Weil <sage@inktank.com>
Wed, 3 Apr 2013 03:59:17 +0000 (20:59 -0700)
Signed-off-by: David Zafman <david.zafman@inktank.com>
src/librados/librados.cc
src/rados.cc

index be98341ef362ecacd564104625894c48510b31ac..c8a25a76a7e7a85903581c79b6225b11da865c73 100644 (file)
@@ -1092,6 +1092,8 @@ int librados::IoCtx::list_snaps(const std::string& oid,
 {
   ObjectReadOperation op;
   int r;
+  if (io_ctx_impl->snap_seq != CEPH_SNAPDIR)
+    return -EINVAL;
   op.list_snaps(out_snaps, &r);
   bufferlist bl;
   int ret = operate(oid, &op, &bl);
index 4f02563ae1048f41490a1a0bd6d8d18280a4d23d..9af6a2c823afc05c505a4f1b0051f56351738913 100644 (file)
@@ -2026,6 +2026,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
     string oid(nargs[1]);
     snap_set_t ls;
 
+    io_ctx.snap_set_read(LIBRADOS_SNAP_DIR);
     ret = io_ctx.list_snaps(oid, &ls);
     if (ret < 0) {
       cerr << "error listing snap shots " << pool_name << "/" << oid << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;