]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rados: provide user with more meaningful error message 26275/head
authorMykola Golub <mgolub@suse.com>
Tue, 5 Feb 2019 10:39:53 +0000 (10:39 +0000)
committerMykola Golub <mgolub@suse.com>
Tue, 5 Feb 2019 10:39:53 +0000 (10:39 +0000)
when trying to mksnap on a pool in the selfmanaged snaps mode.

Previously the error message in this case was:

  error creating pool XYZ snapshot ABC: (22) Invalid argument

which was highly uninformative.

Signed-off-by: Mykola Golub <mgolub@suse.com>
src/tools/rados/rados.cc

index 9774dfdede6cb4f6f6463092ca3515d9c456b6bf..37c6d3352e0d69446630261942bb46d7b598fda0 100644 (file)
@@ -3090,6 +3090,12 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
       return 1;
     }
 
+    if (rados.get_pool_is_selfmanaged_snaps_mode(pool_name)) {
+      cerr << "can't create snapshot: pool " << pool_name
+           << " is in selfmanaged snaps mode" << std::endl;
+      return 1;
+    }
+
     ret = io_ctx.snap_create(nargs[1]);
     if (ret < 0) {
       cerr << "error creating pool " << pool_name << " snapshot " << nargs[1]