summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2014-04-04 11:29:39 (GMT)
committerPeter Rajnoha <prajnoha@redhat.com>2014-04-04 11:29:39 (GMT)
commita7c930b18da8f8179312e395c49f72080edd687e (patch)
tree4485be60c579601c9ba525d39a7e497916098a31
parent4d0c3ed0f89ed25707c0a16049dfb9da647ed842 (diff)
downloadlvm2-a7c930b18da8f8179312e395c49f72080edd687e.zip
lvm2-a7c930b18da8f8179312e395c49f72080edd687e.tar.gz
lvm2-a7c930b18da8f8179312e395c49f72080edd687e.tar.xz
tools: don't require --major to be specified when using -My option on kernels > 2.4
Since kernel > 2.4 have dynamically assigned major numbers. [0] raw/~ $ lvcreate -l1 -My --minor 10 vg Logical volume "lvol0" created [0] raw/~ $ lvcreate -l1 -My --major 254 --minor 11 vg Ignoring supplied major number - kernel assigns major numbers dynamically. Using major number 253 instead. Logical volume "lvol1" created [0] raw/~ $ lvs --profile out -o+major,minor lvol0 vg -wima----- 4.00 253 10 lvol1 vg -wima----- 4.00 253 11
-rw-r--r--WHATS_NEW1
-rw-r--r--tools/lvcreate.c16
2 files changed, 13 insertions, 4 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index dd3b42f..1888cfd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Don't require --major to be specified when using -My option on kernels > 2.4.
Add configure --disable-thin_check_needs_check to support old thin_check.
Use thin_check --clear-needs-check-flag by default.
Export lvm_even_rand() for controlled provision of random numbers.
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index ad00327..c612465 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -804,10 +804,18 @@ static int _read_activation_params(struct lvcreate_params *lp,
"--minor when using -My");
return 0;
}
- if (lp->major == -1) {
- log_error("Please specify major number with "
- "--major when using -My");
- return 0;
+ if (!strncmp(cmd->kernel_vsn, "2.4.", 4)) {
+ if (lp->major == -1) {
+ log_error("Please specify major number with "
+ "--major when using -My");
+ return 0;
+ }
+ } else {
+ if (lp->major >= 0)
+ log_warn("Ignoring supplied major number - kernel assigns "
+ "major numbers dynamically. Using major number %d instead.",
+ cmd->dev_types->device_mapper_major);
+ lp->major = cmd->dev_types->device_mapper_major;
}
if (!major_minor_valid(cmd, vg->fid->fmt, lp->major, lp->minor))
return 0;