Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vgreduce: enable --select option with --removemissing #160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tools/command-lines.in
Original file line number Diff line number Diff line change
Expand Up @@ -1943,8 +1943,8 @@ OO: OO_VGREDUCE
ID: vgreduce_all
DESC: Remove all unused PVs from a VG.

vgreduce --removemissing VG
OO: --mirrorsonly, OO_VGREDUCE
vgreduce --removemissing VG|Select
OO: --mirrorsonly, OO_VGREDUCE, --select String
ID: vgreduce_missing
DESC: Remove all missing PVs from a VG.

Expand Down
2 changes: 1 addition & 1 deletion tools/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ xx(vgmknodes,

xx(vgreduce,
"Remove physical volume(s) from a volume group",
0)
ALL_VGS_IS_DEFAULT)

xx(vgremove,
"Remove volume group(s)",
Expand Down
13 changes: 8 additions & 5 deletions tools/vgreduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
{
struct processing_handle *handle;
struct vgreduce_params vp = { 0 };
const char *vg_name;
const char *vg_name = NULL;
int repairing = arg_is_set(cmd, removemissing_ARG);
int saved_ignore_suspended_devices = ignore_suspended_devices();
int ret;
Expand All @@ -187,7 +187,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}

if (!argc) { /* repairing */
if (!argc && !arg_is_set(cmd, select_ARG)) { /* repairing */
log_error("Please give volume group name.");
return EINVALID_CMD_LINE;
}
Expand All @@ -213,9 +213,12 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}

vg_name = skip_dev_dir(cmd, argv[0], NULL);
argv++;
argc--;
if (argc)
{
vg_name = skip_dev_dir(cmd, argv[0], NULL);
argv++;
argc--;
}

if (!lock_global(cmd, "ex"))
return_ECMD_FAILED;
Expand Down