1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cleanup: relocate check for mirror

Move testing code into _lvconvert_snapshot function.
This commit is contained in:
Zdenek Kabelac 2014-03-17 14:05:17 +01:00
parent b738260c7c
commit d686f3856a

View File

@ -2038,6 +2038,11 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
{ {
struct logical_volume *org; struct logical_volume *org;
if (lv->status & MIRRORED) {
log_error("Unable to convert mirrored LV \"%s\" into a snapshot.", lv->name);
return 0;
}
if (lv_is_origin(lv)) { if (lv_is_origin(lv)) {
/* Unsupported stack */ /* Unsupported stack */
log_error("Unable to convert origin \"%s\" into a snapshot.", lv->name); log_error("Unable to convert origin \"%s\" into a snapshot.", lv->name);
@ -3039,10 +3044,6 @@ static int _lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_FAILED; return ECMD_FAILED;
} }
} else if (lp->snapshot) { } else if (lp->snapshot) {
if (lv->status & MIRRORED) {
log_error("Unable to convert mirrored LV \"%s\" into a snapshot.", lv->name);
return ECMD_FAILED;
}
if (!_lvconvert_snapshot(cmd, lv, lp)) if (!_lvconvert_snapshot(cmd, lv, lp))
return_ECMD_FAILED; return_ECMD_FAILED;