]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: better error when unprotect fails on unprotected snap 1027/head
authorJosh Durgin <josh.durgin@inktank.com>
Wed, 1 Jan 2014 00:26:04 +0000 (16:26 -0800)
committerJosh Durgin <josh.durgin@inktank.com>
Wed, 1 Jan 2014 00:26:07 +0000 (16:26 -0800)
This will show up on the command line and logs, making it more
clear than EINVAL.

Fixes #6851 and #4045
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
qa/qa_scripts/RbdLib.pm
src/librbd/internal.cc

index f203b8ac0841915dc56f8e1f7f94e694b5d68a26..83a506e96c381ba67d6a67036b5c61514b686e3e 100755 (executable)
@@ -81,8 +81,7 @@ our $SNAP_PROTECT_ERR = "Device or resource busy";
 our $SNAP_PROTECT_RM_ERR = "protected from removal";
 our $SNAP_PROTECT_ERR1 = "No such file or directory";
 our $SNAP_UNPROT_ERR   = "snap_unprotect: image must support layering";
-our $SNAP_UNPROT_ERR1   = "snap_unprotect: can't unprotect";
-#our $SNAP_UNPROTECT_ERR - bug # 4045  
+our $SNAP_UNPROT_ERR1   = "snap_unprotect: snapshot is already unprotected";
 our $SNAP_PROT_ERR     = "snap_protect: image must support layering";
 our $CLONE_UNPROTECT_ERR = "parent snapshot must be protected";
 our $CLONE_ARG_ERR     = "destination image name was not specified";
index 81b70dd310c34ee7b6a8e836e0a4c3c1cec292af..3d73bd0251b73c21ac6d2018bd56789b3e324a16 100644 (file)
@@ -616,8 +616,11 @@ namespace librbd {
     if (r < 0)
       return r;
 
-    if (is_unprotected)
+    if (is_unprotected) {
+      lderr(ictx->cct) << "snap_unprotect: snapshot is already unprotected"
+                      << dendl;
       return -EINVAL;
+    }
 
     r = cls_client::set_protection_status(&ictx->md_ctx,
                                          ictx->header_oid,