Skip to content

Commit

Permalink
Merge pull request #13157 from smithfarm/wip-18434-jewel
Browse files Browse the repository at this point in the history
jewel: rbd: Improve error reporting from rbd feature enable/disable

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
smithfarm committed Jan 31, 2017
2 parents dff349c + 99bafc1 commit 26798a1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/librbd/internal.cc
Expand Up @@ -1814,23 +1814,26 @@ 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;
features_mask |= RBD_FEATURE_EXCLUSIVE_LOCK;
}
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;
features_mask |= (RBD_FEATURE_OBJECT_MAP | RBD_FEATURE_EXCLUSIVE_LOCK);
}
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;
Expand All @@ -1857,15 +1860,18 @@ 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 |
RBD_FEATURE_JOURNALING);
}
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;
}

Expand Down

0 comments on commit 26798a1

Please sign in to comment.