1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Fix lvconvert to disallow snapshot and mirror combinations. (mpatocka)

This commit is contained in:
Alasdair Kergon 2008-06-26 21:38:58 +00:00
parent a8c5758222
commit 0383c4e1d8
2 changed files with 14 additions and 7 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.39 - Version 2.02.39 -
================================ ================================
Fix lvconvert to disallow snapshot and mirror combinations.
Fix reporting of LV fields alongside unallocated PV segments. Fix reporting of LV fields alongside unallocated PV segments.
Add --unquoted and --rows to reporting tools. Add --unquoted and --rows to reporting tools.
Add and use uninitialized_var() macro to suppress invalid compiler warnings. Add and use uninitialized_var() macro to suppress invalid compiler warnings.

View File

@ -629,10 +629,12 @@ static int lvconvert_snapshot(struct cmd_context *cmd,
return 0; 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.", log_error("Unable to create a snapshot of a %s LV.",
org->status & LOCKED ? "locked" : org->status & LOCKED ? "locked" :
org->status & PVMOVE ? "pvmove" : "snapshot"); org->status & PVMOVE ? "pvmove" :
org->status & MIRRORED ? "mirrored" :
"snapshot");
return 0; return 0;
} }
@ -707,16 +709,20 @@ static int lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
return ECMD_FAILED; return ECMD_FAILED;
} }
if (arg_count(cmd, mirrors_ARG) || (lv->status & MIRRORED)) { if (lp->snapshot) {
if (!archive(lv->vg)) if (lv->status & MIRRORED) {
log_error("Unable to convert mirrored LV \"%s\" into a snapshot.", lv->name);
return ECMD_FAILED; return ECMD_FAILED;
if (!lvconvert_mirrors(cmd, lv, lp)) }
return ECMD_FAILED;
} else if (lp->snapshot) {
if (!archive(lv->vg)) if (!archive(lv->vg))
return ECMD_FAILED; return ECMD_FAILED;
if (!lvconvert_snapshot(cmd, lv, lp)) if (!lvconvert_snapshot(cmd, lv, lp))
return ECMD_FAILED; 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; return ECMD_PROCESSED;