Skip to content

Commit

Permalink
rbd: enabling/disabling rbd feature should report missing dependency
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gaurav36 committed Dec 1, 2016
1 parent fbb0987 commit 61d0790
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/librbd/operation/DisableFeaturesRequest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ Context *DisableFeaturesRequest<I>::handle_acquire_exclusive_lock(int *result) {
if ((m_features & RBD_FEATURE_EXCLUSIVE_LOCK) != 0) {
if ((m_new_features & RBD_FEATURE_OBJECT_MAP) != 0 ||
(m_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;
*result = -EINVAL;
break;
}
Expand All @@ -190,7 +192,8 @@ Context *DisableFeaturesRequest<I>::handle_acquire_exclusive_lock(int *result) {
}
if ((m_features & RBD_FEATURE_OBJECT_MAP) != 0) {
if ((m_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;
*result = -EINVAL;
break;
}
Expand Down
9 changes: 6 additions & 3 deletions src/librbd/operation/EnableFeaturesRequest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ Context *EnableFeaturesRequest<I>::handle_get_mirror_mode(int *result) {

if ((m_features & RBD_FEATURE_OBJECT_MAP) != 0) {
if ((m_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;
*result = -EINVAL;
break;
}
Expand All @@ -189,7 +190,8 @@ Context *EnableFeaturesRequest<I>::handle_get_mirror_mode(int *result) {
}
if ((m_features & RBD_FEATURE_FAST_DIFF) != 0) {
if ((m_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;
*result = -EINVAL;
break;
}
Expand All @@ -198,7 +200,8 @@ Context *EnableFeaturesRequest<I>::handle_get_mirror_mode(int *result) {
}
if ((m_features & RBD_FEATURE_JOURNALING) != 0) {
if ((m_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;
*result = -EINVAL;
break;
}
Expand Down

0 comments on commit 61d0790

Please sign in to comment.