mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
lvcreate: recognize --wipesignatures arg
Recognize the new --wipesignatures arg in lvcreate that is supposed to wipe known signatures if found on newly created LV.
This commit is contained in:
parent
5b7e543cae
commit
169b4c1586
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.105 -
|
Version 2.02.105 -
|
||||||
=====================================
|
=====================================
|
||||||
|
Add -W/--wipesignatures lvcreate option to support wiping on new LVs.
|
||||||
Add allocation/wipe_signatures_on_new_logical_volumes_when_zeroing to lvm.conf.
|
Add allocation/wipe_signatures_on_new_logical_volumes_when_zeroing to lvm.conf.
|
||||||
Do not fail the whole autoactivation if the VG refresh done before fails.
|
Do not fail the whole autoactivation if the VG refresh done before fails.
|
||||||
Do not connect to lvmetad on vg/lvchange --sysinit -aay and socket absent.
|
Do not connect to lvmetad on vg/lvchange --sysinit -aay and socket absent.
|
||||||
|
@ -723,6 +723,7 @@ struct lvcreate_params {
|
|||||||
int thin; /* thin */
|
int thin; /* thin */
|
||||||
int create_thin_pool; /* thin */
|
int create_thin_pool; /* thin */
|
||||||
int zero; /* all */
|
int zero; /* all */
|
||||||
|
int wipe_signatures; /* all */
|
||||||
int major; /* all */
|
int major; /* all */
|
||||||
int minor; /* all */
|
int minor; /* all */
|
||||||
int log_count; /* mirror */
|
int log_count; /* mirror */
|
||||||
|
@ -129,6 +129,7 @@ static void _lv_set_default_params(struct lvcreate_params *lp,
|
|||||||
uint64_t extents)
|
uint64_t extents)
|
||||||
{
|
{
|
||||||
lp->zero = 1;
|
lp->zero = 1;
|
||||||
|
lp->wipe_signatures = 0;
|
||||||
lp->major = -1;
|
lp->major = -1;
|
||||||
lp->minor = -1;
|
lp->minor = -1;
|
||||||
lp->activate = CHANGE_AY;
|
lp->activate = CHANGE_AY;
|
||||||
|
@ -176,6 +176,7 @@ arg(uuidlist_ARG, 'U', "uuidlist", NULL, 0)
|
|||||||
arg(verbose_ARG, 'v', "verbose", NULL, ARG_COUNTABLE)
|
arg(verbose_ARG, 'v', "verbose", NULL, ARG_COUNTABLE)
|
||||||
arg(volumegroup_ARG, 'V', "volumegroup", NULL, 0)
|
arg(volumegroup_ARG, 'V', "volumegroup", NULL, 0)
|
||||||
arg(virtualsize_ARG, 'V', "virtualsize", size_mb_arg, 0)
|
arg(virtualsize_ARG, 'V', "virtualsize", size_mb_arg, 0)
|
||||||
|
arg(wipesignatures_ARG, 'W', "wipesignatures", yes_no_arg, 0)
|
||||||
arg(allocatable_ARG, 'x', "allocatable", yes_no_arg, 0)
|
arg(allocatable_ARG, 'x', "allocatable", yes_no_arg, 0)
|
||||||
arg(resizeable_ARG, 'x', "resizeable", yes_no_arg, 0)
|
arg(resizeable_ARG, 'x', "resizeable", yes_no_arg, 0)
|
||||||
arg(yes_ARG, 'y', "yes", NULL, 0)
|
arg(yes_ARG, 'y', "yes", NULL, 0)
|
||||||
|
@ -248,6 +248,7 @@ xx(lvcreate,
|
|||||||
"\t[-t|--test]\n"
|
"\t[-t|--test]\n"
|
||||||
"\t[--type VolumeType]\n"
|
"\t[--type VolumeType]\n"
|
||||||
"\t[-v|--verbose]\n"
|
"\t[-v|--verbose]\n"
|
||||||
|
"\t[-W|--wipesignatures {y|n}]\n"
|
||||||
"\t[-Z|--zero {y|n}]\n"
|
"\t[-Z|--zero {y|n}]\n"
|
||||||
"\t[--version]\n"
|
"\t[--version]\n"
|
||||||
"\tVolumeGroupName [PhysicalVolumePath...]\n\n"
|
"\tVolumeGroupName [PhysicalVolumePath...]\n\n"
|
||||||
@ -294,7 +295,8 @@ xx(lvcreate,
|
|||||||
raidminrecoveryrate_ARG, raidmaxrecoveryrate_ARG, readahead_ARG,
|
raidminrecoveryrate_ARG, raidmaxrecoveryrate_ARG, readahead_ARG,
|
||||||
regionsize_ARG, setactivationskip_ARG, size_ARG, snapshot_ARG, stripes_ARG,
|
regionsize_ARG, setactivationskip_ARG, size_ARG, snapshot_ARG, stripes_ARG,
|
||||||
stripesize_ARG, test_ARG, thin_ARG, thinpool_ARG,
|
stripesize_ARG, test_ARG, thin_ARG, thinpool_ARG,
|
||||||
type_ARG, virtualoriginsize_ARG, virtualsize_ARG, zero_ARG)
|
type_ARG, virtualoriginsize_ARG, virtualsize_ARG,
|
||||||
|
wipesignatures_ARG, zero_ARG)
|
||||||
|
|
||||||
xx(lvdisplay,
|
xx(lvdisplay,
|
||||||
"Display information about a logical volume",
|
"Display information about a logical volume",
|
||||||
|
@ -614,8 +614,8 @@ static int _read_activation_params(struct lvcreate_params *lp, struct cmd_contex
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else if (lp->activate == CHANGE_AAY) {
|
} else if (lp->activate == CHANGE_AAY) {
|
||||||
if (arg_count(cmd, zero_ARG)) {
|
if (arg_count(cmd, zero_ARG) || arg_count(cmd, wipesignatures_ARG)) {
|
||||||
log_error("-Z is incompatible with --activate a");
|
log_error("-Z and -W is incompatible with --activate a");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
lp->zero = 0;
|
lp->zero = 0;
|
||||||
@ -644,9 +644,11 @@ static int _read_activation_params(struct lvcreate_params *lp, struct cmd_contex
|
|||||||
lp->permission = arg_uint_value(cmd, permission_ARG,
|
lp->permission = arg_uint_value(cmd, permission_ARG,
|
||||||
LVM_READ | LVM_WRITE);
|
LVM_READ | LVM_WRITE);
|
||||||
|
|
||||||
/* Must not zero read only volume */
|
/* Must not zero/wipe read only volume */
|
||||||
if (!(lp->permission & LVM_WRITE))
|
if (!(lp->permission & LVM_WRITE)) {
|
||||||
lp->zero = 0;
|
lp->zero = 0;
|
||||||
|
lp->wipe_signatures = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (arg_count(cmd, major_ARG) > 1) {
|
if (arg_count(cmd, major_ARG) > 1) {
|
||||||
log_error("Option -j/--major may not be repeated.");
|
log_error("Option -j/--major may not be repeated.");
|
||||||
@ -867,11 +869,27 @@ static int _lvcreate_params(struct lvcreate_params *lp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Should we zero the lv.
|
* Should we zero/wipe signatures on the lv.
|
||||||
*/
|
*/
|
||||||
lp->zero = strcmp(arg_str_value(cmd, zero_ARG,
|
lp->zero = strcmp(arg_str_value(cmd, zero_ARG,
|
||||||
(lp->segtype->flags & SEG_CANNOT_BE_ZEROED) ? "n" : "y"), "n");
|
(lp->segtype->flags & SEG_CANNOT_BE_ZEROED) ? "n" : "y"), "n");
|
||||||
|
|
||||||
|
if (arg_count(cmd, wipesignatures_ARG)) {
|
||||||
|
/* If -W/--wipesignatures is given on command line directly, respect it. */
|
||||||
|
lp->wipe_signatures = strcmp(arg_str_value(cmd, wipesignatures_ARG,
|
||||||
|
(lp->segtype->flags & SEG_CANNOT_BE_ZEROED) ? "n" : "y"), "n");
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* If -W/--wipesignatures is not given on command line,
|
||||||
|
* look at the allocation/wipe_signatures_on_new_logical_volumes_when_zeroing
|
||||||
|
* to decide what should be done exactly.
|
||||||
|
*/
|
||||||
|
if (find_config_tree_bool(cmd, allocation_wipe_signatures_on_new_logical_volumes_when_zeroing_CFG, NULL))
|
||||||
|
lp->wipe_signatures = lp->zero;
|
||||||
|
else
|
||||||
|
lp->wipe_signatures = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_lvcreate_name_params(lp, cmd, &argc, &argv) ||
|
if (!_lvcreate_name_params(lp, cmd, &argc, &argv) ||
|
||||||
!_read_size_params(lp, lcp, cmd) ||
|
!_read_size_params(lp, lcp, cmd) ||
|
||||||
!get_stripe_params(cmd, &lp->stripes, &lp->stripe_size) ||
|
!get_stripe_params(cmd, &lp->stripes, &lp->stripe_size) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user