diff --git a/WHATS_NEW b/WHATS_NEW index 4c243bb72..291c64295 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.39 - ================================ + Fix lvconvert to disallow snapshot and mirror combinations. Fix reporting of LV fields alongside unallocated PV segments. Add --unquoted and --rows to reporting tools. Add and use uninitialized_var() macro to suppress invalid compiler warnings. diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 0b8f0b3bd..21724de15 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -629,10 +629,12 @@ static int lvconvert_snapshot(struct cmd_context *cmd, return 0; } - if (org->status & (LOCKED|PVMOVE) || lv_is_cow(org)) { + if (org->status & (LOCKED|PVMOVE|MIRRORED) || lv_is_cow(org)) { log_error("Unable to create a snapshot of a %s LV.", org->status & LOCKED ? "locked" : - org->status & PVMOVE ? "pvmove" : "snapshot"); + org->status & PVMOVE ? "pvmove" : + org->status & MIRRORED ? "mirrored" : + "snapshot"); return 0; } @@ -707,16 +709,20 @@ static int lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv, return ECMD_FAILED; } - if (arg_count(cmd, mirrors_ARG) || (lv->status & MIRRORED)) { - if (!archive(lv->vg)) + 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_mirrors(cmd, lv, lp)) - return ECMD_FAILED; - } else if (lp->snapshot) { + } if (!archive(lv->vg)) return ECMD_FAILED; if (!lvconvert_snapshot(cmd, lv, lp)) return ECMD_FAILED; + } else if (arg_count(cmd, mirrors_ARG) || (lv->status & MIRRORED)) { + if (!archive(lv->vg)) + return ECMD_FAILED; + if (!lvconvert_mirrors(cmd, lv, lp)) + return ECMD_FAILED; } return ECMD_PROCESSED;