mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
dmstats: replace --force with new stats-specific --alldevices
The '--force' switch is only used by dmstats to allow either creation or deletion of one or more regions on all devices. These operations do not carry any risk: just a possible mess of region IDs to be cleaned up. Remove the use of '--force' for stats commands and change current uses to a new '--alldevices' switch.
This commit is contained in:
parent
988ca74351
commit
6b81ac5807
@ -1,6 +1,7 @@
|
|||||||
Version 1.02.105 -
|
Version 1.02.105 -
|
||||||
===================================
|
===================================
|
||||||
Add more arg validation for dm_tree_node_add_cache_target().
|
Add more arg validation for dm_tree_node_add_cache_target().
|
||||||
|
Add --alldevices switch to replace use of --force for stats create / delete.
|
||||||
|
|
||||||
Version 1.02.104 - 10th August 2015
|
Version 1.02.104 - 10th August 2015
|
||||||
===================================
|
===================================
|
||||||
|
@ -27,6 +27,7 @@ dmstats \(em device-mapper statistics management
|
|||||||
.br
|
.br
|
||||||
.B dmstats create
|
.B dmstats create
|
||||||
.I device_name
|
.I device_name
|
||||||
|
.RB [ \-\-alldevices ]
|
||||||
.RB [[ \-\-areas
|
.RB [[ \-\-areas
|
||||||
.IR nr_areas ]
|
.IR nr_areas ]
|
||||||
.RB |[ \-\-areasize
|
.RB |[ \-\-areasize
|
||||||
@ -43,7 +44,7 @@ dmstats \(em device-mapper statistics management
|
|||||||
.br
|
.br
|
||||||
.B dmstats delete
|
.B dmstats delete
|
||||||
.I device_name
|
.I device_name
|
||||||
.RB [ \-\-force ]
|
.RB [ \-\-alldevices ]
|
||||||
.RB [ \-\-allregions
|
.RB [ \-\-allregions
|
||||||
.RB | \-\-regionid
|
.RB | \-\-regionid
|
||||||
.IR id ]
|
.IR id ]
|
||||||
@ -115,10 +116,14 @@ when run as 'dmsetup stats'.
|
|||||||
|
|
||||||
When no device argument is given dmstats will by default operate on all
|
When no device argument is given dmstats will by default operate on all
|
||||||
device-mapper devices present. The \fBcreate\fP and \fBdelete\fP
|
device-mapper devices present. The \fBcreate\fP and \fBdelete\fP
|
||||||
commands require the use of \fB--force\fP when used in this way.
|
commands require the use of \fB--alldevices\fP when used in this way.
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
|
.B \-\-alldevices
|
||||||
|
If no device arguments are given allow operation on all devices when
|
||||||
|
creating or deleting regions.
|
||||||
|
.TP
|
||||||
.B \-\-allprograms
|
.B \-\-allprograms
|
||||||
Include regions from all program IDs for list and report operations.
|
Include regions from all program IDs for list and report operations.
|
||||||
.TP
|
.TP
|
||||||
@ -267,7 +272,7 @@ stdout.
|
|||||||
.TP
|
.TP
|
||||||
.B delete
|
.B delete
|
||||||
.I [ device_name ]
|
.I [ device_name ]
|
||||||
.RB [ \-\-force ]
|
.RB [ \-\-alldevices ]
|
||||||
.RB [ \-\-allregions
|
.RB [ \-\-allregions
|
||||||
.RB | \-\-regionid
|
.RB | \-\-regionid
|
||||||
.IR id ]
|
.IR id ]
|
||||||
@ -282,7 +287,8 @@ of subsequent list, print, or report operations.
|
|||||||
All regions registered on a device may be removed using
|
All regions registered on a device may be removed using
|
||||||
\fB\-\-allregions\fP.
|
\fB\-\-allregions\fP.
|
||||||
|
|
||||||
To remove all regions on all devices \fB\-\-force\fP must be used.
|
To remove all regions on all devices both \fB--allregions\fP and
|
||||||
|
\fB\-\-alldevices\fP must be used.
|
||||||
.br
|
.br
|
||||||
.TP
|
.TP
|
||||||
.B help
|
.B help
|
||||||
@ -601,7 +607,7 @@ Created region: 0
|
|||||||
Delete all regions on all devices
|
Delete all regions on all devices
|
||||||
.br
|
.br
|
||||||
.br
|
.br
|
||||||
# dmstats delete --allregions --force
|
# dmstats delete --alldevices --allregions
|
||||||
.br
|
.br
|
||||||
.br
|
.br
|
||||||
|
|
||||||
|
@ -120,6 +120,7 @@ enum {
|
|||||||
READ_ONLY = 0,
|
READ_ONLY = 0,
|
||||||
ADD_NODE_ON_CREATE_ARG,
|
ADD_NODE_ON_CREATE_ARG,
|
||||||
ADD_NODE_ON_RESUME_ARG,
|
ADD_NODE_ON_RESUME_ARG,
|
||||||
|
ALL_DEVICES_ARG,
|
||||||
ALL_PROGRAMS_ARG,
|
ALL_PROGRAMS_ARG,
|
||||||
ALL_REGIONS_ARG,
|
ALL_REGIONS_ARG,
|
||||||
AREAS_ARG,
|
AREAS_ARG,
|
||||||
@ -4418,9 +4419,9 @@ static int _stats_create(CMD_ARGS)
|
|||||||
name = names->name;
|
name = names->name;
|
||||||
else {
|
else {
|
||||||
if (argc == 1 && !_switches[UUID_ARG] && !_switches[MAJOR_ARG]) {
|
if (argc == 1 && !_switches[UUID_ARG] && !_switches[MAJOR_ARG]) {
|
||||||
if (!_switches[FORCE_ARG]) {
|
if (!_switches[ALL_DEVICES_ARG]) {
|
||||||
log_error("Creating regions on all devices "
|
log_error("Please specify device(s) or use "
|
||||||
"requires --force.");
|
"--alldevices.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return _process_all(cmd, subcommand, argc, argv, 0, _stats_create);
|
return _process_all(cmd, subcommand, argc, argv, 0, _stats_create);
|
||||||
@ -4506,9 +4507,9 @@ static int _stats_delete(CMD_ARGS)
|
|||||||
name = names->name;
|
name = names->name;
|
||||||
else {
|
else {
|
||||||
if (argc == 1 && !_switches[UUID_ARG] && !_switches[MAJOR_ARG]) {
|
if (argc == 1 && !_switches[UUID_ARG] && !_switches[MAJOR_ARG]) {
|
||||||
if (!_switches[FORCE_ARG]) {
|
if (!_switches[ALL_DEVICES_ARG]) {
|
||||||
log_error("Deleting regions from all devices "
|
log_error("Please specify device(s) or use "
|
||||||
"requires --force.");
|
"--alldevices.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return _process_all(cmd, subcommand, argc, argv, 0, _stats_delete);
|
return _process_all(cmd, subcommand, argc, argv, 0, _stats_delete);
|
||||||
@ -5355,6 +5356,7 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
|
|||||||
#ifdef HAVE_GETOPTLONG
|
#ifdef HAVE_GETOPTLONG
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{"readonly", 0, &ind, READ_ONLY},
|
{"readonly", 0, &ind, READ_ONLY},
|
||||||
|
{"alldevices", 0, &ind, ALL_DEVICES_ARG},
|
||||||
{"allprograms", 0, &ind, ALL_PROGRAMS_ARG},
|
{"allprograms", 0, &ind, ALL_PROGRAMS_ARG},
|
||||||
{"allregions", 0, &ind, ALL_REGIONS_ARG},
|
{"allregions", 0, &ind, ALL_REGIONS_ARG},
|
||||||
{"areas", 1, &ind, AREAS_ARG},
|
{"areas", 1, &ind, AREAS_ARG},
|
||||||
@ -5479,6 +5481,8 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
|
|||||||
optind = OPTIND_INIT;
|
optind = OPTIND_INIT;
|
||||||
while ((ind = -1, c = GETOPTLONG_FN(*argcp, *argvp, "cCfG:hj:m:M:no:O:rS:u:U:vy",
|
while ((ind = -1, c = GETOPTLONG_FN(*argcp, *argvp, "cCfG:hj:m:M:no:O:rS:u:U:vy",
|
||||||
long_options, NULL)) != -1) {
|
long_options, NULL)) != -1) {
|
||||||
|
if (ind == ALL_DEVICES_ARG)
|
||||||
|
_switches[ALL_DEVICES_ARG]++;
|
||||||
if (ind == ALL_PROGRAMS_ARG)
|
if (ind == ALL_PROGRAMS_ARG)
|
||||||
_switches[ALL_PROGRAMS_ARG]++;
|
_switches[ALL_PROGRAMS_ARG]++;
|
||||||
if (ind == ALL_REGIONS_ARG)
|
if (ind == ALL_REGIONS_ARG)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user