mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
toollib: only interpret vgname arg as uuid for vgrename
In general, --select should be used to specify a VG by UUID, but vgrename already allows a uuid to be substituted for the name, so continue to allow it in that case.
This commit is contained in:
parent
166adf0e1f
commit
61573bd197
@ -1323,7 +1323,7 @@ xx(vgremove,
|
||||
|
||||
xx(vgrename,
|
||||
"Rename a volume group",
|
||||
0,
|
||||
ALLOW_UUID_AS_NAME,
|
||||
"vgrename\n"
|
||||
"\t[-A|--autobackup y|n]\n"
|
||||
"\t[--commandprofile ProfileName]\n"
|
||||
|
@ -2081,7 +2081,7 @@ static void _choose_vgs_to_process(struct cmd_context *cmd,
|
||||
struct dm_str_list *sl, *sl2;
|
||||
struct vgnameid_list *vgnl, *vgnl2;
|
||||
struct id id;
|
||||
int arg_is_uuid;
|
||||
int arg_is_uuid = 0;
|
||||
int found;
|
||||
|
||||
dm_list_iterate_items_safe(sl, sl2, arg_vgnames) {
|
||||
@ -2098,13 +2098,10 @@ static void _choose_vgs_to_process(struct cmd_context *cmd,
|
||||
|
||||
/*
|
||||
* If the VG name arg looks like a UUID, then check if it
|
||||
* matches the UUID of a VG.
|
||||
*
|
||||
* FIXME: Do we want to allow vgname args to be interpretted
|
||||
* as uuids for all commands or only some (e.g. vgrename)?
|
||||
* If only some, then use a cmd flag to enable this.
|
||||
* matches the UUID of a VG. (--select should generally
|
||||
* be used to select a VG by uuid instead.)
|
||||
*/
|
||||
if (!found) {
|
||||
if (!found && (cmd->command->flags & ALLOW_UUID_AS_NAME)) {
|
||||
log_suppress(2);
|
||||
arg_is_uuid = id_read_format(&id, sl->str);
|
||||
log_suppress(0);
|
||||
|
@ -99,6 +99,8 @@ struct arg_value_group_list {
|
||||
#define ALL_VGS_IS_DEFAULT 0x00000004
|
||||
/* Process all devices with --all if none are specified on the command line. */
|
||||
#define ENABLE_ALL_DEVS 0x00000008
|
||||
/* Command may try to interpret a vgname arg as a uuid. */
|
||||
#define ALLOW_UUID_AS_NAME 0x00000010
|
||||
/* Command needs a shared lock on a VG; it only reads the VG. */
|
||||
#define LOCKD_VG_SH 0x00000020
|
||||
/* Command does not process any metadata. */
|
||||
|
Loading…
Reference in New Issue
Block a user