summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2014-12-12 09:34:50 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2015-02-10 16:08:42 +0100
commit00744b053f395be79ab1cb80fdf7342548aa79e2 (patch)
tree25003ceaeea38b2d3717ba1134425752ceb018f8
parentf784c60cd65d14d107e957338af041c3a507ef8d (diff)
downloadlvm2-00744b053f395be79ab1cb80fdf7342548aa79e2.tar.gz
tools: allow -S|--select for vgremove and lvremove
-rw-r--r--WHATS_NEW1
-rw-r--r--tools/commands.h10
-rw-r--r--tools/lvremove.c5
-rw-r--r--tools/reporter.c2
-rw-r--r--tools/vgremove.c5
5 files changed, 14 insertions, 9 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index f02ac8b88..7fa7d3c5e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.117 -
====================================
+ Add support for -S/--select to vgremove and lvremove.
Add support for -S/--select to vgchange,lvchange and pvchange.
Add infrastructure to support selection for non-reporting tools.
Add LVM_COMMAND_PROFILE env var to set default command profile name to use.
diff --git a/tools/commands.h b/tools/commands.h
index 6df7f7df5..63dbb2a11 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -512,7 +512,7 @@ xx(lvreduce,
xx(lvremove,
"Remove logical volume(s) from the system",
- 0,
+ ALL_VGS_IS_DEFAULT, /* all VGs only with --select */
"lvremove\n"
"\t[-A|--autobackup y|n]\n"
"\t[--commandprofile ProfileName]\n"
@@ -520,12 +520,13 @@ xx(lvremove,
"\t[-f|--force]\n"
"\t[-h|--help]\n"
"\t[--noudevsync]\n"
+ "\t[-S|--select Selection]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\tLogicalVolume[Path] [LogicalVolume[Path]...]\n",
- autobackup_ARG, force_ARG, noudevsync_ARG, test_ARG)
+ autobackup_ARG, force_ARG, noudevsync_ARG, select_ARG, test_ARG)
xx(lvrename,
"Rename a logical volume",
@@ -1186,19 +1187,20 @@ xx(vgreduce,
xx(vgremove,
"Remove volume group(s)",
- 0,
+ ALL_VGS_IS_DEFAULT, /* all VGs only with select */
"vgremove\n"
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug]\n"
"\t[-f|--force]\n"
"\t[-h|--help]\n"
"\t[--noudevsync]\n"
+ "\t[-S|--select Selection]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
"\tVolumeGroupName [VolumeGroupName...]\n",
- force_ARG, noudevsync_ARG, test_ARG)
+ force_ARG, noudevsync_ARG, select_ARG, test_ARG)
xx(vgrename,
"Rename a volume group",
diff --git a/tools/lvremove.c b/tools/lvremove.c
index 1005218c0..df920fbb4 100644
--- a/tools/lvremove.c
+++ b/tools/lvremove.c
@@ -17,8 +17,9 @@
int lvremove(struct cmd_context *cmd, int argc, char **argv)
{
- if (!argc) {
- log_error("Please enter one or more logical volume paths");
+ if (!argc && !arg_is_set(cmd, select_ARG)) {
+ log_error("Please enter one or more logical volume paths "
+ "or use -S for selection.");
return EINVALID_CMD_LINE;
}
diff --git a/tools/reporter.c b/tools/reporter.c
index dba97bedf..0bfed51b0 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -455,7 +455,7 @@ int report_for_selection(struct selection_handle *sh,
static const char *incorrect_report_type_msg = "report_for_selection: incorrect report type";
int args_are_pvs = sh->orig_report_type == PVS;
int do_lv_info, do_lv_seg_status;
- struct processing_handle handle = { .internal_report = 0,
+ struct processing_handle handle = { .internal_report_for_select = 0,
.selection_handle = sh,
.custom_handle = NULL };
int r = 0;
diff --git a/tools/vgremove.c b/tools/vgremove.c
index 315e1dcfb..3ce0763af 100644
--- a/tools/vgremove.c
+++ b/tools/vgremove.c
@@ -69,8 +69,9 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv)
{
int ret;
- if (!argc) {
- log_error("Please enter one or more volume group paths");
+ if (!argc && !arg_is_set(cmd, select_ARG)) {
+ log_error("Please enter one or more volume group paths "
+ "or use -S for selection.");
return EINVALID_CMD_LINE;
}