Skip to contentSkip to conversation

master - lvchange: disable persistent minors for pools

PATCH Zdenek Kabelac 1 participant 1 message Mar 18, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a10a11bd54d9f33842eee8c168dc3c47aebec05b
Commit:        a10a11bd54d9f33842eee8c168dc3c47aebec05b
Parent:        95fbbf4f40e8d0e9d9565f5a25f66a8127986822
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Mar 17 09:44:26 2015 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Mar 18 13:42:13 2015 +0100

lvchange: disable persistent minors for pools

There is no reason to support persistent major/minor numbers for pool volumes - it's only meant to be supported for filesystems (since i.e. nfs may need to keep volume on a persistent device node.)

Support for pools is now explicitely disabled and documented.

---
 WHATS_NEW                    |    1 +
 man/lvchange.8.in            |    1 +
 test/shell/lvchange-cache.sh |    4 ++++
 test/shell/lvchange-thin.sh  |    5 +++--
 tools/lvchange.c             |    5 +++++
 5 files changed, 14 insertions(+), 2 deletions(-)
WHATS_NEW +1 -0
index d0a0c2d..0ce81fb 100644
@@ -1,5 +1,6 @@
 Version 2.02.118 - 
 =================================
+  Disable lvchange of major and minor of pool LVs.
   Fix pvscan --cache to not scan and read ignored metadata areas on PVs.
   Add After=iscsi-shutdown.service to blk-availability.service systemd unit.
   Disallow vgconvert from changing metadata format when lvmetad is used.
man/lvchange.8.in +1 -0
index fbae953..6b41c81 100644
@@ -279,6 +279,7 @@ Do not use this if dmeventd is already monitoring a device.
 .TP
 .BR \-M ", " \-\-persistent " {" \fIy | \fIn }
 Set to y to make the minor number specified persistent.
+Change of persistent numbers is not supported for pool volumes.
 .TP
 .BR \-p ", " \-\-permission " {" \fIr | \fIrw }
 Change access permission to read-only or read/write.
test/shell/lvchange-cache.sh +4 -0
index 9959f93..20826fb 100644
@@ -18,6 +18,10 @@ lvcreate --type cache-pool -an -v -L 2 -n cpool $vg
 lvcreate -H -L 4 -n corigin --cachepool $vg/cpool
 lvcreate -n noncache -l 1 $vg
 
+# cannot change major minor for pools
+not lvchange --yes -M y --minor 235 --major 253 $vg/cpool
+not lvchange -M n $vg/cpool
+
 not lvchange --cachepolicy mq $vg/noncache
 not lvchange --cachesettings foo=bar $vg/noncache
 
test/shell/lvchange-thin.sh +3 -2
index 4d33563..87919bc 100644
@@ -54,8 +54,9 @@ lvchange -r auto $vg/$lv1
 lvchange --yes -M y --minor 234 --major 253 $vg/$lv1
 lvchange -M n $vg/$lv1
 
-lvchange --yes -M y --minor 235 --major 253 $vg/pool
-lvchange -M n $vg/pool
+# cannot change major minor for pools
+not lvchange --yes -M y --minor 235 --major 253 $vg/pool
+not lvchange -M n $vg/pool
 
 # addtag_ARG
 lvchange --addtag foo $vg/$lv1
tools/lvchange.c +5 -0
index 5e90adc..096aae4 100644
@@ -966,6 +966,11 @@ static int _lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
 		return ECMD_FAILED;
 	}
 
+	if (arg_count(cmd, persistent_ARG) && lv_is_pool(lv)) {
+		log_error("Persistent major and minor numbers are not supported with pools.");
+		return ECMD_FAILED;
+	}
+
 	/*
 	 * FIXME: DEFAULT_BACKGROUND_POLLING should be "unspecified".
 	 * If --poll is explicitly provided use it; otherwise polling