1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix vgchange to process -a, --refresh, --monitor and --poll like lvchange.

Simultaneous -a and --refresh is not valid.
poll+monitor are valid together with or without -ay* (but not with -an*)

No longer print polling results summary if no LVs in the VG were polled.
This commit is contained in:
Mike Snitzer 2010-10-26 01:37:59 +00:00
parent 8328e5f094
commit 178ff2becc
3 changed files with 44 additions and 10 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.76
===================================
Fix vgchange to process -a, --refresh, --monitor and --poll like lvchange.
Add lvm2app functions to query any pv, vg, or lv property / report field.
Version 2.02.75 - 25th October 2010

View File

@ -715,7 +715,7 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
int lvchange(struct cmd_context *cmd, int argc, char **argv)
{
int update = /* options other than -a, --refresh or --monitor */
int update = /* options other than -a, --refresh, --monitor or --poll */
arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) ||
arg_count(cmd, readahead_ARG) || arg_count(cmd, persistent_ARG) ||
arg_count(cmd, addtag_ARG) || arg_count(cmd, deltag_ARG) ||
@ -732,6 +732,10 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
if (arg_count(cmd, available_ARG) && arg_count(cmd, refresh_ARG)) {
log_error("Only one of -a and --refresh permitted.");
return EINVALID_CMD_LINE;
}
if ((arg_count(cmd, ignorelockingfailure_ARG) ||
arg_count(cmd, sysinit_ARG)) && update) {

View File

@ -180,9 +180,10 @@ static int _vgchange_background_polling(struct cmd_context *cmd, struct volume_g
if (lvs_in_vg_activated(vg) && background_polling()) {
polled = _poll_lvs_in_vg(cmd, vg);
log_print("Background polling started for %d logical volume(s) "
"in volume group \"%s\"",
polled, vg->name);
if (polled)
log_print("Background polling started for %d logical volume(s) "
"in volume group \"%s\"",
polled, vg->name);
}
return ECMD_PROCESSED;
@ -592,13 +593,30 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
arg_int_value(cmd, poll_ARG,
DEFAULT_BACKGROUND_POLLING));
if (arg_count(cmd, available_ARG))
if (arg_count(cmd, available_ARG)) {
r = _vgchange_available(cmd, vg);
if (r != ECMD_PROCESSED)
return r;
}
else if (arg_count(cmd, monitor_ARG))
if (arg_count(cmd, refresh_ARG)) {
/* refreshes the visible LVs (which starts polling) */
r = _vgchange_refresh(cmd, vg);
if (r != ECMD_PROCESSED)
return r;
}
if (!arg_count(cmd, available_ARG) &&
!arg_count(cmd, refresh_ARG) &&
arg_count(cmd, monitor_ARG)) {
/* -ay* will have already done monitoring changes */
r = _vgchange_monitoring(cmd, vg);
if (r != ECMD_PROCESSED)
return r;
}
else if (arg_count(cmd, poll_ARG))
if (!arg_count(cmd, refresh_ARG) &&
arg_count(cmd, poll_ARG))
r = _vgchange_background_polling(cmd, vg);
else if (arg_count(cmd, resizeable_ARG))
@ -628,9 +646,6 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
else if (arg_count(cmd, clustered_ARG))
r = _vgchange_clustered(cmd, vg);
else if (arg_count(cmd, refresh_ARG))
r = _vgchange_refresh(cmd, vg);
else if (arg_count(cmd, vgmetadatacopies_ARG) ||
arg_count(cmd, metadatacopies_ARG))
r = _vgchange_metadata_copies(cmd, vg);
@ -669,12 +684,26 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
if (arg_count(cmd, available_ARG) && arg_count(cmd, refresh_ARG)) {
log_error("Only one of -a and --refresh permitted.");
return EINVALID_CMD_LINE;
}
if ((arg_count(cmd, ignorelockingfailure_ARG) ||
arg_count(cmd, sysinit_ARG)) && !arg_count(cmd, available_ARG)) {
log_error("Only -a permitted with --ignorelockingfailure and --sysinit");
return EINVALID_CMD_LINE;
}
if (arg_count(cmd, available_ARG) &&
(arg_count(cmd, monitor_ARG) || arg_count(cmd, poll_ARG))) {
int activate = arg_uint_value(cmd, available_ARG, 0);
if (activate == CHANGE_AN || activate == CHANGE_ALN) {
log_error("Only -ay* allowed with --monitor or --poll.");
return EINVALID_CMD_LINE;
}
}
if (arg_count(cmd, poll_ARG) && arg_count(cmd, sysinit_ARG)) {
log_error("Only one of --poll and --sysinit permitted.");
return EINVALID_CMD_LINE;