master - man: teaking output format
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b7ae57c6a6fd69...
Commit: b7ae57c6a6fd69d23cc8c180920ddca372914419
Parent: 21fc35dd1bcd068ad4453e5c18b2d754bdcb12b0
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 21 12:05:36 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Feb 21 12:27:51 2017 -0600
man: teaking output format
---
tools/command.c | 34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/tools/command.c b/tools/command.c
index c425fd1..e7596df 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -1798,6 +1798,38 @@ static void print_val_man(const char *str)
return;
}
+ /*
+ * The suffix [k|unit] is just printed in plain text.
+ * Doing bold k and underlined unit creates a lot of
+ * visual "noise" that is choppy and hard to read.
+ * The extra markup in this case doesn't add anything
+ * that isn't already obvious.
+ */
+
+ if (!strcmp(str, "Number[k|unit]")) {
+ printf("\\fINumber\\fP[k|unit]");
+ return;
+ }
+
+ if (!strcmp(str, "Number[m|unit]")) {
+ printf("\\fINumber\\fP[m|unit]");
+ return;
+ }
+
+ if (!strcmp(str, "[+|-]Number")) {
+ printf("[\\fB+\\fP|\\fB-\\fP]\\fINumber\\fP");
+ return;
+ }
+
+ if (!strcmp(str, "[+|-]Number[%VG|%PVS|%FREE]")) {
+ printf("[\\fB+\\fP|\\fB-\\fP]\\fINumber\\fP[\\fB%%VG\\fP|\\fB%%PVS\\fP|\\fB%%FREE\\fP]");
+ return;
+ }
+
+ /*
+ * I think this bit is almost unnecessary with the specific
+ * ones checked above.
+ */
if (strstr(str, "Number[") || strstr(str, "]Number")) {
for (i = 0; i < strlen(str); i++) {
if (str[i] == 'N')
@@ -2666,7 +2698,7 @@ void print_man_all_positions_desc(struct command_name *cname)
/* Nearly every command uses a number arg somewhere. */
printf("\n.HP\n");
- printf("\\fINumber\\fP, \\fISize\\fP");
+ printf("\\fINumber\\fP");
printf("\n");
printf(".br\n");
printf("Input units are always treated as base two values, regardless of unit\n"
7 years, 2 months
master - commands: adjust default help output
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=21fc35dd1bcd06...
Commit: 21fc35dd1bcd068ad4453e5c18b2d754bdcb12b0
Parent: 7e411b111f4d87a1f342a016299fe90c2d64ec2d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 21 11:40:51 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Feb 21 12:27:51 2017 -0600
commands: adjust default help output
Remove the "usage notes" which should just
live in the man pages.
When there are 3 or more variants of a command,
print all the options produces a lot of output,
so require --longhelp to print all the options
in these cases.
---
tools/command.c | 7 ++++-
tools/command.h | 3 +-
tools/lvmcmdline.c | 54 +++++++++++++++------------------------------------
3 files changed, 23 insertions(+), 41 deletions(-)
diff --git a/tools/command.c b/tools/command.c
index fe8c1f6..c425fd1 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -1229,7 +1229,7 @@ static int is_lvm_all_opt(int opt)
/* Find common options for all variants of each command name. */
-static void factor_common_options(void)
+void factor_common_options(void)
{
int cn, opt_enum, ci, oo, ro, found;
struct command *cmd;
@@ -1602,7 +1602,7 @@ static void print_usage_def(struct arg_def *def)
printf(" ...");
}
-void print_usage(struct command *cmd)
+void print_usage(struct command *cmd, int longhelp)
{
struct command_name *cname = find_command_name(cmd->name);
int onereq = (cmd->cmd_flags & CMD_FLAG_ONE_REQUIRED_OPT) ? 1 : 0;
@@ -1652,6 +1652,9 @@ void print_usage(struct command *cmd)
}
}
+ if (!longhelp)
+ goto done;
+
if (!cmd->oo_count)
goto op_count;
diff --git a/tools/command.h b/tools/command.h
index 2d8f628..51c4551 100644
--- a/tools/command.h
+++ b/tools/command.h
@@ -213,7 +213,8 @@ struct command {
int define_commands(char *run_name);
int command_id_to_enum(const char *str);
-void print_usage(struct command *cmd);
+void print_usage(struct command *cmd, int longhelp);
void print_usage_common(struct command_name *cname, struct command *cmd);
+void factor_common_options(void);
#endif
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 9fa8d94..ecb5802 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1564,7 +1564,7 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
log_error("Run '%s --help' for more information.", name);
if (close_ro) {
log_warn("Closest command usage is:");
- print_usage(&_cmdline.commands[close_i]);
+ print_usage(&_cmdline.commands[close_i], 0);
}
return NULL;
}
@@ -1677,39 +1677,6 @@ static void _short_usage(const char *name)
log_error("Run `%s --help' for more information.", name);
}
-static void _usage_notes(void)
-{
- /*
- * Excluding commonly understood syntax style like the meanings of:
- * [ ] for optional, ... for repeatable, | for one of the following,
- * -- for an option name, lower case strings and digits for literals.
- */
- log_print("Usage notes:\n"
- ". Variable parameters are: Number, String, PV, VG, LV, Tag.\n"
- ". Select indicates that a required positional parameter can\n"
- " be omitted if the --select option is used.\n"
- ". --size Number can be replaced with --extents NumberExtents.\n"
- ". When --name is omitted from lvcreate, a new LV name is\n"
- " generated with the \"lvol\" prefix and a unique numeric suffix.\n"
- ". The required VG parameter in lvcreate may be omitted when\n"
- " the VG name is included in another option, e.g. --name VG/LV.\n"
- ". For required options listed in parentheses, e.g. (--A, --B),\n"
- " any one is required, after which the others are optional.\n"
- ". The _new suffix indicates the VG or LV must not yet exist.\n"
- ". LV followed by _<type> indicates that an LV of the given type\n"
- " is required. (raid represents any raid<N> type.)\n"
- ". Input units are always treated as base two values, regardless of\n"
- " unit capitalization, e.g. 'k' and 'K' both refer to 1024.\n"
- ". The default input unit is specified by letter, followed by |unit\n"
- " which represents other possible input units: bBsSkKmMgGtTpPeE.\n"
- ". Output units can be specified with the --units option, for which\n"
- " lower/upper case letters refer to base 2/10 values.\n"
- " formats that are recognized, e.g. for compatibility.\n"
- ". See man pages for short option equivalents of long option names,\n"
- " and for more detailed descriptions of variable parameters.\n"
- " \n");
-}
-
static int _usage(const char *name, int longhelp)
{
struct command_name *cname = find_command_name(name);
@@ -1721,8 +1688,19 @@ static int _usage(const char *name, int longhelp)
return 0;
}
+ /*
+ * Looks at all variants of each command name and figures out
+ * which options are common to all variants (for compact output)
+ */
+ factor_common_options();
+
log_print("%s - %s\n", name, cname->desc);
+ /* Reduce the default output when there are several variants. */
+
+ if (cname->variants < 3)
+ longhelp = 1;
+
for (i = 0; i < COMMAND_COUNT; i++) {
if (strcmp(_cmdline.commands[i].name, name))
continue;
@@ -1733,15 +1711,15 @@ static int _usage(const char *name, int longhelp)
if ((_cmdline.commands[i].cmd_flags & CMD_FLAG_SECONDARY_SYNTAX) && !longhelp)
continue;
- print_usage(&_cmdline.commands[i]);
+ print_usage(&_cmdline.commands[i], longhelp);
cmd = &_cmdline.commands[i];
}
/* Common options are printed once for all variants of a command name. */
- print_usage_common(cname, cmd);
-
if (longhelp)
- _usage_notes();
+ print_usage_common(cname, cmd);
+ else
+ log_print("Use --longhelp to show all options.");
return 1;
}
7 years, 2 months
master - man lvm: update see also list
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7e411b111f4d87...
Commit: 7e411b111f4d87a1f342a016299fe90c2d64ec2d
Parent: f80d37375354b9b9cab5326d9d03e036012a824e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 21 11:13:23 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Feb 21 12:27:51 2017 -0600
man lvm: update see also list
add several missing references
remove references to lvmdiskscan lvmchange
---
man/lvm.8.in | 108 +++++++++++++++++++++++++++++++++++-----------------------
1 files changed, 65 insertions(+), 43 deletions(-)
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 0a64e4f..1f3247a 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -484,48 +484,70 @@ directly.
.SH SEE ALSO
.
.nh
-.BR lvm.conf (5),
-.BR lvmcache (7),
-.BR lvmreport(7),
-.BR lvmthin (7),
-.BR clvmd (8),
+.BR lvm (8)
+.BR lvm.conf (5)
+.BR lvmconfig (8)
+
+.BR pvchange (8)
+.BR pvck (8)
+.BR pvcreate (8)
+.BR pvdisplay (8)
+.BR pvmove (8)
+.BR pvremove (8)
+.BR pvresize (8)
+.BR pvs (8)
+.BR pvscan (8)
+
+.BR vgcfgbackup (8)
+.BR vgcfgrestore (8)
+.BR vgchange (8)
+.BR vgck (8)
+.BR vgcreate (8)
+.BR vgconvert (8)
+.BR vgdisplay (8)
+.BR vgexport (8)
+.BR vgextend (8)
+.BR vgimport (8)
+.BR vgimportclone (8)
+.BR vgmerge (8)
+.BR vgmknodes (8)
+.BR vgreduce (8)
+.BR vgremove (8)
+.BR vgrename (8)
+.BR vgs (8)
+.BR vgscan (8)
+.BR vgsplit (8)
+
+.BR lvcreate (8)
+.BR lvchange (8)
+.BR lvconvert (8)
+.BR lvdisplay (8)
+.BR lvextend (8)
+.BR lvreduce (8)
+.BR lvremove (8)
+.BR lvrename (8)
+.BR lvresize (8)
+.BR lvs (8)
+.BR lvscan (8)
+
+.BR lvm2-activation-generator (8)
+.BR blkdeactivate (8)
+.BR lvmdump (8)
+
+.BR dmeventd (8)
+.BR lvmetad (8)
+.BR lvmpolld (8)
+.BR lvmlockd (8)
+.BR lvmlockctl (8)
+.BR clvmd (8)
+.BR cmirrord (8)
+.BR lvmdbusd (8)
+
+.BR lvmsystemid (7)
+.BR lvmreport (7)
+.BR lvmraid (7)
+.BR lvmthin (7)
+.BR lvmcache (7)
+
.BR dmsetup (8),
-.BR lvchange (8),
-.BR lvcreate (8),
-.BR lvdisplay (8),
-.BR lvextend (8),
-.BR lvmchange (8),
-.BR lvmconfig (8),
-.BR lvmdiskscan (8),
-.BR lvreduce (8),
-.BR lvremove (8),
-.BR lvrename (8),
-.BR lvresize (8),
-.BR lvs (8),
-.BR lvscan (8),
-.BR pvchange (8),
-.BR pvck (8),
-.BR pvcreate (8),
-.BR pvdisplay (8),
-.BR pvmove (8),
-.BR pvremove (8),
-.BR pvs (8),
-.BR pvscan (8),
-.BR vgcfgbackup (8),
-.BR vgchange (8),
-.BR vgck (8),
-.BR vgconvert (8),
-.BR vgcreate (8),
-.BR vgdisplay (8),
-.BR vgextend (8),
-.BR vgimport (8),
-.BR vgimportclone (8),
-.BR vgmerge (8),
-.BR vgmknodes (8),
-.BR vgreduce (8),
-.BR vgremove (8),
-.BR vgrename (8),
-.BR vgs (8),
-.BR vgscan (8),
-.BR vgsplit (8),
.BR readline (3)
7 years, 2 months
master - man: expand type option description
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f80d37375354b9...
Commit: f80d37375354b9b9cab5326d9d03e036012a824e
Parent: d2dbe71fb3e6210b252db94ec214cee6df2ddb4f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 21 11:09:01 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Feb 21 12:27:51 2017 -0600
man: expand type option description
---
tools/args.h | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/tools/args.h b/tools/args.h
index e7a1ab2..036aa87 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -646,7 +646,16 @@ arg(trustcache_ARG, '\0', "trustcache", 0, 0, 0,
"Avoids certain device scanning during command processing. Do not use.\n")
arg(type_ARG, '\0', "type", segtype_VAL, 0, 0,
- "Specifies an LV type, or \"segment type\".\n")
+ "Specifies an LV type, or \"segment type\".\n"
+ "See usage definitions for specific ways to use these types.\n"
+ "For more information about redundancy and performance (\\fBraid\\fP<N>, \\fBmirror\\fP, \\fBstriped\\fP, \\fBlinear\\fP) see \\fBlvmraid\\fP(7).\n"
+ "For thin provisioning (\\fBthin\\fP, \\fBthin-pool\\fP) see \\fBlvmthin\\fP(7).\n"
+ "For performance caching (\\fBcache\\fP, \\fBcache-pool\\fP) see \\fBlvmcache\\fP(7).\n"
+ "For copy-on-write snapshots (\\fBsnapshot\\fP) see usage definitions.\n"
+ "Several commands omit an explicit type option because the type\n"
+ "is inferred from other options or shortcuts\n"
+ "(e.g. --stripes, --mirrors, --snapshot, --virtualsize, --thin, --cache).\n"
+ "Use inferred types with care because it can lead to unexpected results.\n")
arg(unbuffered_ARG, '\0', "unbuffered", 0, 0, 0,
"Produce output immediately without sorting or aligning the columns properly.\n")
7 years, 2 months
master - dmsetup: Indicate device repetition in usage summaries.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d2dbe71fb3e621...
Commit: d2dbe71fb3e6210b252db94ec214cee6df2ddb4f
Parent: 1c1ce2739ed40d02ae2d41cb9e9de54d0948967c
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Feb 21 11:25:18 2017 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Feb 21 11:25:18 2017 +0000
dmsetup: Indicate device repetition in usage summaries.
---
man/dmsetup.8.in | 20 ++++++++++----------
tools/dmsetup.c | 45 ++++++++++++++++++++++-----------------------
2 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/man/dmsetup.8.in b/man/dmsetup.8.in
index bd26efa..4261fc4 100644
--- a/man/dmsetup.8.in
+++ b/man/dmsetup.8.in
@@ -41,7 +41,7 @@ dmsetup \(em low level logical volume management
. BR deps
. RB [ \-o
. IR options ]
-. RI [ device_name ]
+. RI [ device_name ...]
. ad b
..
.CMD_DEPS
@@ -58,7 +58,7 @@ dmsetup \(em low level logical volume management
.B dmsetup
.de CMD_INFO
. BR info
-. RI [ device_name ]
+. RI [ device_name ...]
..
.CMD_INFO
.
@@ -117,7 +117,7 @@ dmsetup \(em low level logical volume management
.B dmsetup
.de CMD_MANGLE
. BR mangle
-. RI [ device_name ]
+. RI [ device_name ...]
..
.CMD_MANGLE
.
@@ -135,7 +135,7 @@ dmsetup \(em low level logical volume management
.B dmsetup
.de CMD_MKNODES
. BR mknodes
-. RI [ device_name ]
+. RI [ device_name ...]
..
.CMD_MKNODES
.
@@ -159,7 +159,7 @@ dmsetup \(em low level logical volume management
. RB [ \-f | \-\-force ]
. RB [ \-\-retry ]
. RB [ \-\-deferred ]
-. IR device_name
+. IR device_name ...
. ad b
..
.CMD_REMOVE
@@ -197,7 +197,7 @@ dmsetup \(em low level logical volume management
.de CMD_RESUME
. ad l
. BR resume
-. IR device_name
+. IR device_name ...
. RB [ \-\-addnodeoncreate | \-\-addnodeonresume ]
. RB [ \-\-noflush ]
. RB [ \-\-nolockfs ]
@@ -247,7 +247,7 @@ dmsetup \(em low level logical volume management
. RB [ \-\-target
. IR target_type ]
. RB [ \-\-noflush ]
-. RI [ device_name ]
+. RI [ device_name ...]
. ad b
..
.CMD_STATUS
@@ -259,7 +259,7 @@ dmsetup \(em low level logical volume management
. BR suspend
. RB [ \-\-nolockfs ]
. RB [ \-\-noflush ]
-. IR device_name
+. IR device_name ...
. ad b
..
.CMD_SUSPEND
@@ -272,7 +272,7 @@ dmsetup \(em low level logical volume management
. RB [ \-\-target
. IR target_type ]
. RB [ \-\-showkeys ]
-. RI [ device_name ]
+. RI [ device_name ...]
. ad b
..
.CMD_TABLE
@@ -354,7 +354,7 @@ dmsetup \(em low level logical volume management
.de CMD_WIPE_TABLE
. ad l
. BR wipe_table
-. IR device_name
+. IR device_name ...
. RB [ \-f | \-\-force ]
. RB [ \-\-noflush ]
. RB [ \-\-nolockfs ]
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 6464069..549a8c5 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -5726,32 +5726,32 @@ static int _stats_help(CMD_ARGS);
* dmsetup stats <cmd> [options] [device_name]
* dmstats <cmd> [options] [device_name]
*
- * clear [--allregions|--regionid id] [--alldevices|<device...>]
+ * clear [--allregions|--regionid id] [--alldevices|<device>...]
* create [--start <start> [--length <len>]
* [--areas <nr_areas>] [--areasize <size>]
* [--programid <id>] [--userdata <data> ]
* [--bounds histogram_boundaries] [--precise]
- * [--alldevices|<device...>]
+ * [--alldevices|<device>...]
* create --filemap [--nogroup]
* [--programid <id>] [--userdata <data> ]
* [--bounds histogram_boundaries] [--precise] [<file_path>]
* delete [--allprograms|--programid id]
* [--allregions|--regionid id]
- * [--alldevices|<device...>]
+ * [--alldevices|<device>...]
* group [--alias NAME] --regions <regions>
- * [--allprograms|--programid id] [--alldevices|<device...>]
+ * [--allprograms|--programid id] [--alldevices|<device>...]
* list [--allprograms|--programid id] [--allregions|--regionid id]
* print [--clear] [--allprograms|--programid id]
* [--allregions|--regionid id]
- * [--alldevices|<device...>]
+ * [--alldevices|<device>...]
* report [--interval <seconds>] [--count <cnt>]
* [--units <u>] [--programid <id>] [--regionid <id>]
* [-o <fields>] [-O|--sort <sort_fields>]
* [-S|--select <selection>] [--nameprefixes]
* [--noheadings] [--separator <separator>]
- * [--allprograms|--programid id] [<device...>]
+ * [--allprograms|--programid id] [<device>...]
* ungroup --groupid <id> [--allprograms|--programid id]
- * [--alldevices|<device...>]
+ * [--alldevices|<device>...]
*/
#define INDENT "\n\t "
@@ -5766,7 +5766,7 @@ static int _stats_help(CMD_ARGS);
#define EXTRA_OPTS HIST_OPTS PRECISE_OPTS
#define ALL_PROGS_OPT "[--allprograms|--programid id] "
#define ALL_REGIONS_OPT "[--allregions|--regionid id] "
-#define ALL_DEVICES_OPT "[--alldevices|<device...>] "
+#define ALL_DEVICES_OPT "[--alldevices|<device>...] "
#define ALL_PROGS_REGIONS_DEVICES ALL_PROGS_OPT INDENT ALL_REGIONS_OPT INDENT ALL_DEVICES_OPT
#define FIELD_OPTS "[-o <fields>] [-O|--sort <sort_fields>]"
#define DM_REPORT_OPTS FIELD_OPTS INDENT "[-S|--select <selection>] [--nameprefixes]" INDENT \
@@ -5795,7 +5795,7 @@ static struct command _stats_subcommands[] = {
{"group", GROUP_OPTS, 1, -1, 1, 0, _stats_group},
{"list", ALL_PROGS_OPT ALL_REGIONS_OPT, 0, -1, 1, 0, _stats_report},
{"print", PRINT_OPTS, 0, -1, 1, 0, _stats_print},
- {"report", REPORT_OPTS "[<device...>]", 0, -1, 1, 0, _stats_report},
+ {"report", REPORT_OPTS "[<device>...]", 0, -1, 1, 0, _stats_report},
{"ungroup", "--groupid <id> " UNGROUP_OPTS, 1, -1, 1, 0, _stats_ungroup},
{"update_filemap", "--groupid <id> <file_path>", 1, 1, 0, 0, _stats_update_file},
{"version", "", 0, -1, 1, 0, _version},
@@ -5832,27 +5832,27 @@ static struct command _dmsetup_commands[] = {
"\t [-u|uuid <uuid>] [--addnodeonresume|--addnodeoncreate]\n"
"\t [--readahead {[+]<sectors>|auto|none}]\n"
"\t [-n|--notable|--table {<table>|<table_file>}]", 1, 2, 0, 0, _create},
- {"remove", "[--deferred] [-f|--force] [--retry] <device>", 0, -1, 1, 0, _remove},
+ {"remove", "[--deferred] [-f|--force] [--retry] <device>...", 0, -1, 1, 0, _remove},
{"remove_all", "[-f|--force]", 0, 0, 0, 0, _remove_all},
- {"suspend", "[--noflush] [--nolockfs] <device>", 0, -1, 1, 0, _suspend},
- {"resume", "[--noflush] [--nolockfs] <device>\n"
+ {"suspend", "[--noflush] [--nolockfs] <device>...", 0, -1, 1, 0, _suspend},
+ {"resume", "[--noflush] [--nolockfs] <device>...\n"
"\t [--addnodeonresume|--addnodeoncreate]\n"
"\t [--readahead {[+]<sectors>|auto|none}]", 0, -1, 1, 0, _resume},
{"load", "<device> [<table>|<table_file>]", 0, 2, 0, 0, _load},
{"clear", "<device>", 0, -1, 1, 0, _clear},
{"reload", "<device> [<table>|<table_file>]", 0, 2, 0, 0, _load},
- {"wipe_table", "[-f|--force] [--noflush] [--nolockfs] <device>", 1, -1, 1, 0, _error_device},
+ {"wipe_table", "[-f|--force] [--noflush] [--nolockfs] <device>...", 1, -1, 1, 0, _error_device},
{"rename", "<device> [--setuuid] <new_name_or_uuid>", 1, 2, 0, 0, _rename},
{"message", "<device> <sector> <message>", 2, -1, 0, 0, _message},
{"ls", "[--target <target_type>] [--exec <command>] [-o <options>] [--tree]", 0, 0, 0, 0, _ls},
- {"info", "[<device>]", 0, -1, 1, 0, _info},
- {"deps", "[-o <options>] [<device>]", 0, -1, 1, 0, _deps},
- {"stats", "<command> [<options>] [<devices>]", 1, -1, 1, 1, _stats},
- {"status", "[<device>] [--noflush] [--target <target_type>]", 0, -1, 1, 0, _status},
- {"table", "[<device>] [--target <target_type>] [--showkeys]", 0, -1, 1, 0, _status},
+ {"info", "[<device>...]", 0, -1, 1, 0, _info},
+ {"deps", "[-o <options>] [<device>...]", 0, -1, 1, 0, _deps},
+ {"stats", "<command> [<options>] [<device>...]", 1, -1, 1, 1, _stats},
+ {"status", "[<device>...] [--noflush] [--target <target_type>]", 0, -1, 1, 0, _status},
+ {"table", "[<device>...] [--target <target_type>] [--showkeys]", 0, -1, 1, 0, _status},
{"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, 0, _wait},
- {"mknodes", "[<device>]", 0, -1, 1, 0, _mknodes},
- {"mangle", "[<device>]", 0, -1, 1, 0, _mangle},
+ {"mknodes", "[<device>...]", 0, -1, 1, 0, _mknodes},
+ {"mangle", "[<device>...]", 0, -1, 1, 0, _mangle},
{"udevcreatecookie", "", 0, 0, 0, 0, _udevcreatecookie},
{"udevreleasecookie", "[<cookie>]", 0, 1, 0, 0, _udevreleasecookie},
{"udevflags", "<cookie>", 1, 1, 0, 0, _udevflags},
@@ -5894,8 +5894,7 @@ static void _stats_usage(FILE *out)
for (i = 0; _stats_subcommands[i].name; i++)
fprintf(out, "\t%s %s\n", _stats_subcommands[i].name, _stats_subcommands[i].help);
- fprintf(out, "\n<device> may be device name or -u <uuid> or "
- "-j <major> -m <minor>\n");
+ fprintf(out, "\n<device> may be device name or (if only one) -u <uuid> or -j <major> -m <minor>\n");
fprintf(out, "<fields> are comma-separated. Use 'help -c' for list.\n");
fprintf(out, "\n");
}
@@ -5920,7 +5919,7 @@ static void _dmsetup_usage(FILE *out)
for (i = 0; _dmsetup_commands[i].name; i++)
fprintf(out, "\t%s %s\n", _dmsetup_commands[i].name, _dmsetup_commands[i].help);
- fprintf(out, "\n<device> may be device name or -u <uuid> or "
+ fprintf(out, "\n<device> may be device name or (if only one) -u <uuid> or "
"-j <major> -m <minor>\n");
fprintf(out, "<mangling_mode> is one of 'none', 'auto' and 'hex'.\n");
fprintf(out, "<fields> are comma-separated. Use 'help -c' for list.\n");
7 years, 2 months
master - tests: some debug code
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1c1ce2739ed40d...
Commit: 1c1ce2739ed40d02ae2d41cb9e9de54d0948967c
Parent: 2a65e2d49e9056bfe291f291c70f1ba9ec72e2e7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 21 09:40:21 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 21 09:40:21 2017 +0100
tests: some debug code
Checking if --deferred would make it any faster - but it's as slow
as without this new optional flag anyway (4.10).
---
test/lib/aux.sh | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 10f6f92..5108a52 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -406,8 +406,11 @@ teardown_devs_prefixed() {
# Remove devices, start with closed (sorted by open count)
# Run 'dmsetup remove' in parallel
- rm -f REMOVE_FAILED
local need_udev_wait=0
+ rm -f REMOVE_FAILED
+ #local listdevs=( $(dm_info name,open --sort open,name | grep "$prefix.*:0") )
+ #dmsetup remove --deferred ${listdevs[@]%%:0} || touch REMOVE_FAILED
+
init_udev_transaction
for dm in $(dm_info name --sort open,name | grep "$prefix"); do
dmsetup remove "$dm" &>/dev/null || touch REMOVE_FAILED &
7 years, 2 months
master - tests: ensure first call is version test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2a65e2d49e9056...
Commit: 2a65e2d49e9056bfe291f291c70f1ba9ec72e2e7
Parent: 7c14004f69f18aeb6fbb022f0ef81f109177022c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 21 09:38:49 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 21 09:38:49 2017 +0100
tests: ensure first call is version test
Check 'dmsetup version' is called before starting any more
advanced logic in $DM_DEV_DIR.
Call also replaces mkdir as it creates needed path with control node.
---
test/lib/inittest.sh | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/test/lib/inittest.sh b/test/lib/inittest.sh
index dcc1304..b75eddc 100644
--- a/test/lib/inittest.sh
+++ b/test/lib/inittest.sh
@@ -77,6 +77,11 @@ find "$TESTOLDPWD/lib" ! \( -name '*.sh' -o -name '*.[cdo]' \
DM_DEFAULT_NAME_MANGLING_MODE=none
DM_DEV_DIR="$TESTDIR/dev"
LVM_SYSTEM_DIR="$TESTDIR/etc"
+# abort on the internal dm errors in the tests (allowing test user override)
+DM_ABORT_ON_INTERNAL_ERRORS=${DM_ABORT_ON_INTERNAL_ERRORS:-1}
+
+export DM_DEFAULT_NAME_MANGLING_MODE DM_DEV_DIR LVM_SYSTEM_DIR DM_ABORT_ON_INTERNAL_ERRORS
+
mkdir "$LVM_SYSTEM_DIR" "$DM_DEV_DIR"
if test -n "$LVM_TEST_DEVDIR" ; then
test -d "$LVM_TEST_DEVDIR" || die "Test device directory LVM_TEST_DEVDIR=\"$LVM_TEST_DEVDIR\" is not valid."
@@ -85,14 +90,11 @@ else
mknod "$DM_DEV_DIR/testnull" c 1 3 || die "mknod failed"
echo >"$DM_DEV_DIR/testnull" || \
die "Filesystem does support devices in $DM_DEV_DIR (mounted with nodev?)"
- mkdir "$DM_DEV_DIR/mapper"
+ # dmsetup makes here needed control entry if still missing
+ dmsetup version || \
+ die "Dmsetup in $DM_DEV_DIR can't report version?"
fi
-# abort on the internal dm errors in the tests (allowing test user override)
-DM_ABORT_ON_INTERNAL_ERRORS=${DM_ABORT_ON_INTERNAL_ERRORS:-1}
-
-export DM_DEFAULT_NAME_MANGLING_MODE DM_DEV_DIR LVM_SYSTEM_DIR DM_ABORT_ON_INTERNAL_ERRORS
-
echo "$TESTNAME" >TESTNAME
echo "Kernel is $(uname -a)"
7 years, 2 months
master - tests: make sure which PV is used for allocation
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7c14004f69f18a...
Commit: 7c14004f69f18aeb6fbb022f0ef81f109177022c
Parent: d409fec079d27c349b4e570a619bd860ce4fde7e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 21 09:38:04 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 21 09:38:04 2017 +0100
tests: make sure which PV is used for allocation
---
test/shell/lvm1-basic.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvm1-basic.sh b/test/shell/lvm1-basic.sh
index 8884bc1..166d5bf 100644
--- a/test/shell/lvm1-basic.sh
+++ b/test/shell/lvm1-basic.sh
@@ -28,7 +28,7 @@ grep "$dev1" out
# check for RHBZ 1080189 -- SEGV in lvremove/vgremove
pvcreate -ff -y --metadatatype 1 "$dev1" "$dev2"
vgcreate --metadatatype 1 $vg1 "$dev1" "$dev2"
-lvcreate -l1 $vg1
+lvcreate -l1 $vg1 "$dev1"
pvremove -ff -y "$dev2"
vgchange -an $vg1
not lvremove $vg1
7 years, 2 months
master - tests: paralelize creation and teardown
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d409fec079d27c...
Commit: d409fec079d27c349b4e570a619bd860ce4fde7e
Parent: 921d5972e8bfa778f7389c4abdaa8691ce432c70
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Feb 21 00:49:49 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 21 00:52:05 2017 +0100
tests: paralelize creation and teardown
To speedup initial construction and destruction of test devices
(mainly in case more then 1 is needed) call dmsetup
in parallel.
---
test/lib/aux.sh | 39 +++++++++++++++++++++++----------------
1 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 7c3daa5..10f6f92 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -405,23 +405,25 @@ teardown_devs_prefixed() {
fi
# Remove devices, start with closed (sorted by open count)
- local remfail=no
+ # Run 'dmsetup remove' in parallel
+ rm -f REMOVE_FAILED
local need_udev_wait=0
init_udev_transaction
- for dm in $(dm_info name --sort open | grep "$prefix"); do
- dmsetup remove "$dm" &>/dev/null || remfail=yes
+ for dm in $(dm_info name --sort open,name | grep "$prefix"); do
+ dmsetup remove "$dm" &>/dev/null || touch REMOVE_FAILED &
need_udev_wait=1
done
+ wait
finish_udev_transaction
test $need_udev_wait -eq 0 || udev_wait
- if test $remfail = yes; then
+ if test -f REMOVE_FAILED; then
local num_devs
local num_remaining_devs=999
while num_devs=$(dm_table | grep "$prefix" | wc -l) && \
test $num_devs -lt $num_remaining_devs -a $num_devs -ne 0; do
test "$stray" -eq 0 || echo "Removing $num_devs stray mapped devices with names beginning with $prefix: "
- # HACK: sort also by minors - so we try to close 'possibly later' created device first
+ # HACK: sort also by minors - so we try to close 'possibly later' created device first
for dm in $(dm_info name --sort open,-minor | grep "$prefix") ; do
dmsetup remove -f "$dm" || true
done
@@ -794,6 +796,7 @@ prepare_devs() {
local size=$(($devsize*2048)) # sectors
local count=0
+ rm -f CREATE_FAILED
init_udev_transaction
for i in $(seq 1 $n); do
local name="${PREFIX}$pvname$i"
@@ -801,17 +804,19 @@ prepare_devs() {
DEVICES[$count]=$dev
count=$(( $count + 1 ))
echo 0 $size linear "$BACKING_DEV" $((($i-1)*$size + $shift)) > "$name.table"
- if not dmsetup create -u "TEST-$name" "$name" "$name.table" &&
- test -n "$LVM_TEST_BACKING_DEVICE";
- then # maybe the backing device is too small for this test
- LVM_TEST_BACKING_DEVICE=
- rm -f BACKING_DEV
- prepare_devs "$@"
- return $?
- fi
+ dmsetup create -u "TEST-$name" "$name" "$name.table" || touch CREATE_FAILED &
+ test -f CREATE_FAILED && break;
done
+ wait
finish_udev_transaction
+ if test -f CREATE_FAILED -a -n "$LVM_TEST_BACKING_DEVICE"; then
+ LVM_TEST_BACKING_DEVICE=
+ rm -f BACKING_DEV CREATE_FAILED
+ prepare_devs "$@"
+ return $?
+ fi
+
# non-ephemeral devices need to be cleared between tests
test -f LOOP || for d in ${DEVICES[@]}; do
blkdiscard "$d" 2>/dev/null || true
@@ -833,9 +838,11 @@ prepare_devs() {
# ( IFS=$'\n'; echo "${DEVICES[*]}" ) >DEVICES
echo "ok"
- for dev in "${DEVICES[@]}"; do
- notify_lvmetad "$dev"
- done
+ if test -e LOCAL_LVMETAD; then
+ for dev in "${DEVICES[@]}"; do
+ notify_lvmetad "$dev"
+ done
+ fi
}
7 years, 2 months
master - tests: use exclusive activation for mirror
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=921d5972e8bfa7...
Commit: 921d5972e8bfa778f7389c4abdaa8691ce432c70
Parent: 86a660be7b31809500488792a93670a703e12a27
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Feb 20 23:50:27 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Feb 21 00:52:05 2017 +0100
tests: use exclusive activation for mirror
Test suite does not support clustered mirroring.
---
test/shell/lvresize-usage.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvresize-usage.sh b/test/shell/lvresize-usage.sh
index 35f6e57..30cb8d5 100644
--- a/test/shell/lvresize-usage.sh
+++ b/test/shell/lvresize-usage.sh
@@ -42,7 +42,7 @@ not lvreduce -L 32M $vg/lv
lvremove -ff $vg
-lvcreate --type mirror -L 4 -n $lv1 $vg
+lvcreate --type mirror -aey -L 4 -n $lv1 $vg
# Incorrent name for resized LV
not lvextend --type mirror -L 10 -n $lv1 $vg
# Same size
7 years, 2 months