1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-20 18:09:23 +03:00

pvmove: disallow tag args

pvmove began processing tags unintentionally from commit,
6d7dc87cb pvmove: use toollib

pvmove works on a single PV, but tags can match multiple PVs.
If we allowed tags, but processed only the first matching PV,
then the resulting PV would be unpredictable.

Also, the current processing code does not allow us to simply
report an error and do nothing if more than one PV matches the tag,
because the command starts processing PVs as they are found,
so it's too late to do nothing if a second PV matches.
This commit is contained in:
David Teigland 2016-06-03 09:56:48 -05:00
parent 68e0979724
commit b321d2b1b9
3 changed files with 10 additions and 1 deletions

View File

@ -874,9 +874,11 @@ xx(pvdisplay,
select_ARG, separator_ARG, shared_ARG, short_ARG, sort_ARG, unbuffered_ARG,
units_ARG)
/* ALL_VGS_IS_DEFAULT is for polldaemon to find pvmoves in-progress using process_each_vg. */
xx(pvmove,
"Move extents from one physical volume to another",
ALL_VGS_IS_DEFAULT, /* For polldaemon to find pvmoves in-progress using process_each_vg. */
ALL_VGS_IS_DEFAULT | DISALLOW_TAG_ARGS,
"pvmove\n"
"\t[--abort]\n"
"\t[--alloc AllocationPolicy]\n"

View File

@ -3375,6 +3375,11 @@ int process_each_pv(struct cmd_context *cmd,
return ret;
}
if ((cmd->command->flags & DISALLOW_TAG_ARGS) && !dm_list_empty(&arg_tags)) {
log_error("Tags cannot be used with this command.");
return ECMD_FAILED;
}
orphans_locked = lvmcache_vgname_is_locked(VG_ORPHANS);
process_all_pvs = dm_list_empty(&arg_pvnames) && dm_list_empty(&arg_tags);

View File

@ -114,6 +114,8 @@ struct arg_value_group_list {
#define NO_LVMETAD_AUTOSCAN 0x00000200
/* Command should process unused duplicate devices. */
#define ENABLE_DUPLICATE_DEVS 0x00000400
/* Command does not accept tags as args. */
#define DISALLOW_TAG_ARGS 0x00000800
/* a register of the lvm commands */
struct command {