]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: enabling/disabling rbd feature should report missing dependency 13157/head
authorNathan Cutler <ncutler@suse.com>
Fri, 27 Jan 2017 17:41:25 +0000 (18:41 +0100)
committerNathan Cutler <ncutler@suse.com>
Fri, 27 Jan 2017 17:41:25 +0000 (18:41 +0100)
Currently while enabling or disabling rbd feature command does not
give missing dependency for eg: attempting to enable the journaling
feature on an image that doesn't have the exclusive-lock feature
enabled should give missing dependency error message.

Fixes: http://tracker.ceph.com/issues/16985
Reported-by: Jason Dillaman <dillaman@redhat.com>
Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
(manual cherry pick of bd023cfec8e9aaa8fb0095a8d9534c21b3209020)

src/librbd/internal.cc

index 68d195be5e2f7f539b3c9616bd9c18fcad5138b2..0a4989a317c059c32f9c5404493aeeeb6d749a04 100644 (file)
@@ -1814,7 +1814,8 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
 
         if ((features & RBD_FEATURE_OBJECT_MAP) != 0) {
           if ((new_features & RBD_FEATURE_EXCLUSIVE_LOCK) == 0) {
-            lderr(cct) << "cannot enable object map" << dendl;
+            lderr(cct) << "cannot enable object-map. exclusive-lock must be "
+                           "enabled before enabling object-map." << dendl;
             return -EINVAL;
           }
           enable_flags |= RBD_FLAG_OBJECT_MAP_INVALID;
@@ -1822,7 +1823,8 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
         }
         if ((features & RBD_FEATURE_FAST_DIFF) != 0) {
           if ((new_features & RBD_FEATURE_OBJECT_MAP) == 0) {
-            lderr(cct) << "cannot enable fast diff" << dendl;
+            lderr(cct) << "cannot enable fast-diff. object-map must be "
+                           "enabled before enabling fast-diff." << dendl;
             return -EINVAL;
           }
           enable_flags |= RBD_FLAG_FAST_DIFF_INVALID;
@@ -1830,7 +1832,8 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
         }
         if ((features & RBD_FEATURE_JOURNALING) != 0) {
           if ((new_features & RBD_FEATURE_EXCLUSIVE_LOCK) == 0) {
-            lderr(cct) << "cannot enable journaling" << dendl;
+            lderr(cct) << "cannot enable journaling. exclusive-lock must be "
+                           "enabled before enabling journaling." << dendl;
             return -EINVAL;
           }
           features_mask |= RBD_FEATURE_EXCLUSIVE_LOCK;
@@ -1857,7 +1860,9 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
         if ((features & RBD_FEATURE_EXCLUSIVE_LOCK) != 0) {
           if ((new_features & RBD_FEATURE_OBJECT_MAP) != 0 ||
               (new_features & RBD_FEATURE_JOURNALING) != 0) {
-            lderr(cct) << "cannot disable exclusive lock" << dendl;
+            lderr(cct) << "cannot disable exclusive-lock. object-map "
+                          "or journaling must be disabled before "
+                          "disabling exclusive-lock." << dendl;
             return -EINVAL;
           }
           features_mask |= (RBD_FEATURE_OBJECT_MAP |
@@ -1865,7 +1870,8 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
         }
         if ((features & RBD_FEATURE_OBJECT_MAP) != 0) {
           if ((new_features & RBD_FEATURE_FAST_DIFF) != 0) {
-            lderr(cct) << "cannot disable object map" << dendl;
+            lderr(cct) << "cannot disable object-map. fast-diff must be "
+                          "disabled before disabling object-map." << dendl;
             return -EINVAL;
           }