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

lvconvert: disallow usage of origin for snapshot

Usage of origin as a snapshot 'COW' volume is unsupported.

Without this test lvm2 is able to generate this ugly internal error message.

To test this:

lvcreate -L1 -n lv1 vg
lvcreate -L1 -n lv2 -s vg/lv1
lvcreate -L1 -n lv3 vg
lvconvert -s vg/lv3 vg/lv1

Internal error: LVs (5) != visible LVs (1) + snapshots (1) + internal LVs (0) in VG vg
This commit is contained in:
Zdenek Kabelac 2014-03-17 09:41:36 +01:00
parent 455f23586f
commit f3b9ee37e9
2 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
Disallow lvconvert of origin to snapshot COW volume.
Make report settings profilable.
Add existing report settings to lvm.conf.
Use VG read lock during 'pvscan --cache -aay' autoactivation.

View File

@ -2038,6 +2038,12 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
{
struct logical_volume *org;
if (lv_is_origin(lv)) {
/* Unsupported stack */
log_error("Unable to convert origin \"%s\" into a snapshot.", lv->name);
return 0;
}
if (!(org = find_lv(lv->vg, lp->origin))) {
log_error("Couldn't find origin volume '%s'.", lp->origin);
return 0;