Skip to content

Commit

Permalink
Merge pull request #12238 from gaurav36/bug-rbd-feature-enable-error
Browse files Browse the repository at this point in the history
librbd: enabling/disabling rbd feature should report missing dependency

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
Jason Dillaman committed Dec 2, 2016
2 parents fbccd1e + bd023cf commit 350a660
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 350a660

Please sign in to comment.