From 8668a9e81c5bde921c9c8e6ba1162c5d4f7ffbe5 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Wed, 25 Feb 2015 10:44:42 -0600 Subject: systemid: silently ignore foreign vgs unless named A foreign VG should be silently ignored by a reporting/display command like 'vgs'. If the reporting/display command specifies a foreign VG by name on the command line, it should produce an error message. Scanning commands pvscan/vgscan/lvscan are always allowed to read and update caches from all PVs, including those that belong to foreign VGs. Other non-report/display/scan commands always ignore a foreign VG, or report an error if they attempt to use a foreign VG. vgimport should always invalidate the lvmetad cache because lvmetad likely holds a pre-vgexported copy of the VG. (This is unrelated to using foreign VGs; the pre-vgexported VG may have had no system_id at all.) --- tools/lvmcmdline.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools/lvmcmdline.c') diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index b38039bae..7a1118376 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -1075,9 +1075,9 @@ static int _get_settings(struct cmd_context *cmd) init_ignorelockingfailure(0); cmd->ignore_clustered_vgs = arg_is_set(cmd, ignoreskippedcluster_ARG); - cmd->include_foreign_vgs = - ((cmd->command->flags & NEEDS_FOREIGN_VGS) || arg_is_set(cmd, foreign_ARG)) ? 1 : 0; - + cmd->error_foreign_vgs = cmd->command->flags & ENABLE_FOREIGN_VGS ? 0 : 1; + cmd->include_foreign_vgs = arg_is_set(cmd, foreign_ARG) ? 1 : 0; + if (!arg_count(cmd, sysinit_ARG)) lvmetad_connect_or_warn(); -- cgit v1.2.1