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

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
This commit is contained in:
Peter Rajnoha 2014-04-04 13:29:39 +02:00
parent 4d0c3ed0f8
commit a7c930b18d
2 changed files with 13 additions and 4 deletions

View File

@ -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.

View File

@ -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;