summaryrefslogtreecommitdiffstats
path: root/tools/lvchange.c
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2010-05-06 11:15:55 +0000
committerPeter Rajnoha <prajnoha@redhat.com>2010-05-06 11:15:55 +0000
commitd50c6d4bf5d15cbd17ef38f883cd82899c589cba (patch)
tree89e8e210592711c447eafc5307061eee87892d50 /tools/lvchange.c
parent3283f817eb205b7a014bb171785b6ccde04d33bc (diff)
downloadlvm2-d50c6d4bf5d15cbd17ef38f883cd82899c589cba.tar.gz
lvm2-d50c6d4bf5d15cbd17ef38f883cd82899c589cba.tar.xz
lvm2-d50c6d4bf5d15cbd17ef38f883cd82899c589cba.zip
Add new --sysinit option for vgchange and lvchange.
A shortcut for --ignorelockingfailure, --ignoremonitoring, --poll n options and LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES environment variable used all at once in initialisation scripts (e.g. rc.sysinit or initrd).
Diffstat (limited to 'tools/lvchange.c')
-rw-r--r--tools/lvchange.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 99297406..1376bf4c 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -586,9 +586,12 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
* should only be started if the LV is not already active. So:
* 1) change the activation code to say if the LV was actually activated
* 2) make polling of an LV tightly coupled with LV activation
+ *
+ * Do not initiate any polling if --sysinit option is used.
*/
- init_background_polling(arg_int_value(cmd, poll_ARG,
- DEFAULT_BACKGROUND_POLLING));
+ init_background_polling(arg_count(cmd, sysinit_ARG) ? 0 :
+ arg_int_value(cmd, poll_ARG,
+ DEFAULT_BACKGROUND_POLLING));
/* access permission change */
if (arg_count(cmd, permission_ARG)) {
@@ -730,8 +733,9 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
arg_count(cmd, addtag_ARG) || arg_count(cmd, deltag_ARG) ||
arg_count(cmd, resync_ARG) || arg_count(cmd, alloc_ARG));
- if (arg_count(cmd, ignorelockingfailure_ARG) && !avail_only) {
- log_error("Only -a permitted with --ignorelockingfailure");
+ if ((arg_count(cmd, ignorelockingfailure_ARG) ||
+ arg_count(cmd, sysinit_ARG)) && !avail_only) {
+ log_error("Only -a permitted with --ignorelockingfailure and --sysinit");
return EINVALID_CMD_LINE;
}
@@ -759,6 +763,11 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
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;
+ }
+
return process_each_lv(cmd, argc, argv,
avail_only ? 0 : READ_FOR_UPDATE, NULL,
&lvchange_single);