Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b18feb98e50093d6…
Commit: b18feb98e50093d66f03ff63120b6a0f14d7fddd
Parent: df227be37cb113a1093b2ed092af582c5a900315
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Feb 23 23:19:36 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Feb 23 23:19:36 2015 +0000
systemid: Fix access restrictions.
When checking whether the system ID permits access to a VG, check for
each permitted situation first, and only then issue the appropriate
error message. Always issue a message for now. (We'll try to
suppress some of those later when the VG concerned wasn't explicitly
requested.)
Add more messages to try to ensure every return code is checked and
every error path (and only an error path) contains a log_error().
Add self-correction to vgchange -c to deal with situations where
the cluster state and system ID state are out-of-sync (e.g. if
old tools were used).
---
lib/format_text/import_vsn1.c | 9 ++--
lib/metadata/metadata.c | 46 ++++++++++------------
tools/toollib.c | 49 +++++++++++------------
tools/vgchange.c | 85 +++++++++++++++++++++++++++--------------
4 files changed, 106 insertions(+), 83 deletions(-)
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index c6a0cf9..42ff451 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -737,6 +737,7 @@ static struct volume_group *_read_vg(struct format_instance *fid,
struct volume_group *vg;
struct dm_hash_table *pv_hash = NULL, *lv_hash = NULL;
unsigned scan_done_once = use_cached_pvs;
+ char *system_id;
/* skip any top-level values */
for (vgn = cft->root; (vgn && vgn->v); vgn = vgn->sib)
@@ -750,8 +751,9 @@ static struct volume_group *_read_vg(struct format_instance *fid,
if (!(vg = alloc_vg("read_vg", fid->fmt->cmd, vgn->key)))
return_NULL;
- if (!(vg->system_id = dm_pool_zalloc(vg->vgmem, NAME_LEN + 1)))
+ if (!(system_id = dm_pool_zalloc(vg->vgmem, NAME_LEN + 1)))
goto_bad;
+ vg->system_id = system_id;
/*
* The pv hash memorises the pv section names -> pv
@@ -773,9 +775,8 @@ static struct volume_group *_read_vg(struct format_instance *fid,
vgn = vgn->child;
- if (dm_config_get_str(vgn, "system_id", &str)) {
- strncpy(vg->system_id, str, NAME_LEN);
- }
+ if (dm_config_get_str(vgn, "system_id", &str))
+ strncpy(system_id, str, NAME_LEN);
if (!_read_id(&vg->id, vgn, "id")) {
log_error("Couldn't read uuid for volume group %s.", vg->name);
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 9fb289d..71197ba 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4338,7 +4338,7 @@ static struct volume_group *_recover_vg(struct cmd_context *cmd,
return (struct volume_group *)vg;
}
-static int allow_system_id(struct cmd_context *cmd, const char *system_id)
+static int _allow_system_id(struct cmd_context *cmd, const char *system_id)
{
const struct dm_config_node *cn;
const struct dm_config_value *cv;
@@ -4395,16 +4395,28 @@ static int _access_vg_systemid(struct cmd_context *cmd, struct volume_group *vg)
return 1;
/*
- * We sometimes want to report foreign vgs.
+ * A few commands allow read-only access to foreign VGs.
*/
if (cmd->include_foreign_vgs)
return 1;
/*
+ * A host can access a VG with a matching system_id.
+ */
+ if (cmd->system_id && !strcmp(vg->system_id, cmd->system_id))
+ return 1;
+
+ /*
+ * A host can access a VG if the VG's system_id is in extra_system_ids list.
+ */
+ if (cmd->system_id && _allow_system_id(cmd, vg->system_id))
+ return 1;
+
+ /*
* Allow VG access if the local host has active LVs in it.
*/
if (lvs_in_vg_activated(vg)) {
- log_error("LVs should not be active in VG %s with foreign system id \"%s\"",
+ log_warn("WARNING: Found LVs active in VG %s with foreign system ID \"%s\". Possible data corruption.",
vg->name, vg->system_id);
return 1;
}
@@ -4413,29 +4425,13 @@ static int _access_vg_systemid(struct cmd_context *cmd, struct volume_group *vg)
* A host without a system_id cannot access a VG with a system_id.
*/
if (!cmd->system_id || cmd->unknown_system_id) {
- log_warn("Cannot access VG %s with system id \"%s\" with unknown local system id.",
- vg->name, vg->system_id);
+ log_error("Cannot access VG %s with system id \"%s\" with unknown local system ID.",
+ vg->name, vg->system_id);
return 0;
}
- /*
- * A host can access a VG with a matching system_id.
- */
- if (!strcmp(vg->system_id, cmd->system_id))
- return 1;
-
- /*
- * A host can access a VG if the VG's system_id is in the allow list.
- */
- if (allow_system_id(cmd, vg->system_id))
- return 1;
-
- /*
- * Silently ignore foreign VGs. They will only cause the
- * command to fail if they were named as explicit command
- * args, in which case the command will fail indicating the
- * VG was not found.
- */
+ log_error("Cannot access VG %s with system id \"%s\" with local system ID %s.",
+ vg->name, vg->system_id, cmd->system_id);
return 0;
}
@@ -4443,7 +4439,7 @@ static int _access_vg_systemid(struct cmd_context *cmd, struct volume_group *vg)
/*
* FIXME: move _vg_bad_status_bits() checks in here.
*/
-static int _access_vg(struct cmd_context *cmd, struct volume_group *vg, uint32_t *failure)
+static int _vg_access_permitted(struct cmd_context *cmd, struct volume_group *vg, uint32_t *failure)
{
if (!is_real_vg(vg->name)) {
/* Disallow use of LVM1 orphans when a host system ID is set. */
@@ -4526,7 +4522,7 @@ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const cha
goto bad;
}
- if (!_access_vg(cmd, vg, &failure))
+ if (!_vg_access_permitted(cmd, vg, &failure))
goto bad;
/* consistent == 0 when VG is not found, but failed == FAILED_NOTFOUND */
diff --git a/tools/toollib.c b/tools/toollib.c
index 659eab5..b1795e7 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -200,12 +200,12 @@ static int _ignore_vg(struct volume_group *vg, const char *vg_name,
*/
if (read_error & FAILED_SYSTEMID) {
if (arg_vgnames && str_list_match_item(arg_vgnames, vg->name)) {
- log_error("Skipping volume group %s with system id %s",
- vg->name, vg->system_id);
+ log_error("Skipping volume group %s with system ID %s",
+ vg->name, vg->system_id ? : vg->lvm1_system_id ? : "");
return 1;
} else {
read_error &= ~FAILED_SYSTEMID; /* Check for other errors */
- log_verbose("Skipping volume group %s", vg_name);
+ log_verbose("Skipping foreign volume group %s", vg_name);
*skip = 1;
}
}
@@ -666,6 +666,7 @@ int vgcreate_params_set_defaults(struct cmd_context *cmd,
{
int64_t extent_size;
+ /* Only vgsplit sets vg */
if (vg) {
vp_def->vg_name = NULL;
vp_def->extent_size = vg->extent_size;
@@ -674,7 +675,7 @@ int vgcreate_params_set_defaults(struct cmd_context *cmd,
vp_def->alloc = vg->alloc;
vp_def->clustered = vg_is_clustered(vg);
vp_def->vgmetadatacopies = vg->mda_copies;
- vp_def->system_id = vg->system_id ? dm_pool_strdup(cmd->mem, vg->system_id) : NULL;
+ vp_def->system_id = vg->system_id; /* No need to clone this */
} else {
vp_def->vg_name = NULL;
extent_size = find_config_tree_int64(cmd,
@@ -689,7 +690,7 @@ int vgcreate_params_set_defaults(struct cmd_context *cmd,
vp_def->alloc = DEFAULT_ALLOC_POLICY;
vp_def->clustered = DEFAULT_CLUSTERED;
vp_def->vgmetadatacopies = DEFAULT_VGMETADATACOPIES;
- vp_def->system_id = cmd->system_id ? dm_pool_strdup(cmd->mem, cmd->system_id) : NULL;
+ vp_def->system_id = cmd->system_id;
}
return 1;
@@ -705,7 +706,7 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
struct vgcreate_params *vp_new,
struct vgcreate_params *vp_def)
{
- const char *arg_str;
+ const char *system_id_arg_str;
vp_new->vg_name = skip_dev_dir(cmd, vp_def->vg_name, NULL);
vp_new->max_lv = arg_uint_value(cmd, maxlogicalvolumes_ARG,
@@ -745,37 +746,35 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
return 0;
}
- if (arg_count(cmd, metadatacopies_ARG)) {
+ if (arg_count(cmd, metadatacopies_ARG))
vp_new->vgmetadatacopies = arg_int_value(cmd, metadatacopies_ARG,
DEFAULT_VGMETADATACOPIES);
- } else if (arg_count(cmd, vgmetadatacopies_ARG)) {
+ else if (arg_count(cmd, vgmetadatacopies_ARG))
vp_new->vgmetadatacopies = arg_int_value(cmd, vgmetadatacopies_ARG,
DEFAULT_VGMETADATACOPIES);
- } else {
+ else
vp_new->vgmetadatacopies = find_config_tree_int(cmd, metadata_vgmetadatacopies_CFG, NULL);
- }
- if ((arg_str = arg_str_value(cmd, systemid_ARG, NULL))) {
- vp_new->system_id = system_id_from_string(cmd, arg_str);
- } else {
+ /* A clustered VG has no system ID. */
+ if (vp_new->clustered) {
+ if (arg_is_set(cmd, systemid_ARG)) {
+ log_error("System ID cannot be set on clustered Volume Groups.");
+ return 0;
+ }
+ vp_new->system_id = NULL;
+ } else if (!(system_id_arg_str = arg_str_value(cmd, systemid_ARG, NULL)))
vp_new->system_id = vp_def->system_id;
- }
-
- if (arg_str) {
- if (!vp_new->system_id)
- log_warn("No local system id found, VG will not have a system id.");
+ else {
+ if (!(vp_new->system_id = system_id_from_string(cmd, system_id_arg_str)))
+ return_0;
+ /* FIXME Take local/extra_system_ids into account */
if (vp_new->system_id && cmd->system_id &&
- strcmp(vp_new->system_id, cmd->system_id)) {
- log_warn("VG system id \"%s\" will not be accessible to local system id \"%s\"",
+ strcmp(vp_new->system_id, cmd->system_id))
+ log_warn("VG with system ID \"%s\" might become inaccessible as local system ID is \"%s\"",
vp_new->system_id, cmd->system_id);
- }
}
- /* A clustered vg has no system_id. */
- if (vp_new->clustered)
- vp_new->system_id = NULL;
-
return 1;
}
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 19aeee7..0b78230 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -301,41 +301,47 @@ static int _vgchange_clustered(struct cmd_context *cmd,
{
int clustered = arg_int_value(cmd, clustered_ARG, 0);
- if (clustered && (vg_is_clustered(vg))) {
- log_error("Volume group \"%s\" is already clustered",
- vg->name);
- return 0;
+ if (clustered && vg_is_clustered(vg)) {
+ if (vg->system_id && *vg->system_id)
+ log_warn("WARNING: Clearing invalid system ID %s from volume group %s.",
+ vg->system_id, vg->name);
+ else {
+ log_error("Volume group \"%s\" is already clustered", vg->name);
+ return 0;
+ }
}
- if (!clustered && !(vg_is_clustered(vg))) {
- log_error("Volume group \"%s\" is already not clustered",
- vg->name);
- return 0;
+ if (!clustered && !vg_is_clustered(vg)) {
+ if ((!vg->system_id || !*vg->system_id) && cmd->system_id && *cmd->system_id)
+ log_warn("Setting missing system ID on Volume Group %s to %s.",
+ vg->name, cmd->system_id);
+ else {
+ log_error("Volume group \"%s\" is already not clustered",
+ vg->name);
+ return 0;
+ }
}
if (clustered && !arg_count(cmd, yes_ARG)) {
if (!clvmd_is_running()) {
- if (yes_no_prompt("LVM cluster daemon (clvmd) is not"
- " running.\n"
- "Make volume group \"%s\" clustered"
- " anyway? [y/n]: ", vg->name) == 'n') {
+ if (yes_no_prompt("LVM cluster daemon (clvmd) is not running. "
+ "Make volume group \"%s\" clustered "
+ "anyway? [y/n]: ", vg->name) == 'n') {
log_error("No volume groups changed.");
return 0;
}
} else if (!locking_is_clustered() &&
- (yes_no_prompt("LVM locking type is not clustered.\n"
- "Make volume group \"%s\" clustered"
- " anyway? [y/n]: ", vg->name) == 'n')) {
+ (yes_no_prompt("LVM locking type is not clustered. "
+ "Make volume group \"%s\" clustered "
+ "anyway? [y/n]: ", vg->name) == 'n')) {
log_error("No volume groups changed.");
return 0;
}
}
- if (clustered)
- vg->system_id = NULL;
- else if (cmd->system_id && cmd->system_id[0])
- vg->system_id = dm_pool_strdup(cmd->mem, cmd->system_id);
+ if (!vg_set_system_id(vg, clustered ? NULL : cmd->system_id))
+ return_0;
if (!vg_set_clustered(vg, clustered))
return_0;
@@ -483,28 +489,49 @@ static int _vgchange_profile(struct cmd_context *cmd,
* extra_system_ids list. This function is not allowed to change the system_id
* of a foreign VG (VG owned by another host).
*/
-
static int _vgchange_system_id(struct cmd_context *cmd, struct volume_group *vg)
{
- const char *arg_str = arg_str_value(cmd, systemid_ARG, NULL);
- char *system_id;
+ const char *system_id;
+ const char *system_id_arg_str = arg_str_value(cmd, systemid_ARG, NULL);
- if (!arg_str)
+ if (!system_id_arg_str || !*system_id_arg_str) {
+ log_error("Invalid system ID supplied: %s", system_id_arg_str);
return 0;
+ }
+
+ if (!(system_id = system_id_from_string(cmd, system_id_arg_str)))
+ return_0;
+
+ if (!strcmp(vg->system_id, system_id)) {
+ log_error("Volume Group system ID is already \"%s\"", vg->system_id);
+ return 0;
+ }
- system_id = system_id_from_string(cmd, arg_str);
+ if (cmd->system_id && strcmp(system_id, cmd->system_id)) {
+ if (lvs_in_vg_activated(vg)) {
+ log_error("Logical Volumes in VG %s must be deactivated before system ID can be changed.",
+ vg->name);
+ return 0;
+ }
- if (system_id && cmd->system_id && strcmp(system_id, cmd->system_id)) {
- log_warn("VG \"%s\" system id \"%s\" does not match local system id \"%s\"",
- vg->name, system_id, cmd->system_id);
+ log_warn("WARNING: Requested system ID \"%s\" does not match local system ID \"%s\"",
+ system_id, cmd->system_id);
+ log_warn("WARNING: Volume group %s might become inaccessible from this machine.",
+ vg->name);
- if (yes_no_prompt("Change system id? [y/n]: ") == 'n') {
- log_error("Volume group \"%s\" not changed.", vg->name);
+ if (!arg_count(cmd, yes_ARG) &&
+ yes_no_prompt("Set foreign system ID %s on volume group %s? [y/n]: ",
+ system_id, vg->name) == 'n') {
+ log_error("Volume group \"%s\" system ID not changed.", vg->name);
return 0;
}
}
+ log_verbose("Changing system ID for VG %s: %s -> %s.",
+ vg->name, vg->system_id, system_id);
+
vg->system_id = system_id;
+
return 1;
}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2fc2928978bb592a…
Commit: 2fc2928978bb592a6b62a18bbbb0acee10efbfe2
Parent: 3d406e5a8dfe254f45585759aafa0720a251f0ad
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Feb 23 22:19:08 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Feb 23 22:19:08 2015 +0000
config: Rename allow_system_id to extra_system_ids.
Add warnings to the config file templates and briefly document
each value.
Configure lvmlocal.conf and install in /etc/lvm.
---
conf/Makefile.in | 13 +++++++-
conf/example.conf.in | 41 ++++++++++++++++++++------
conf/lvmlocal.conf.in | 63 ++++++++++++++++++++++++++++--------------
configure | 3 +-
configure.in | 1 +
lib/config/config_settings.h | 2 +-
lib/metadata/metadata.c | 12 +++----
man/lvmsystemid.7.in | 8 ++--
test/shell/system_id.sh | 2 +-
tools/vgchange.c | 2 +-
10 files changed, 99 insertions(+), 48 deletions(-)
diff --git a/conf/Makefile.in b/conf/Makefile.in
index e56b25e..2d48fb9 100644
--- a/conf/Makefile.in
+++ b/conf/Makefile.in
@@ -17,24 +17,33 @@ top_builddir = @top_builddir@
CONFSRC=example.conf
CONFDEST=lvm.conf
+CONFLOCAL=lvmlocal.conf
PROFILE_TEMPLATES=command_profile_template.profile metadata_profile_template.profile
PROFILES=$(PROFILE_TEMPLATES) $(srcdir)/thin-generic.profile $(srcdir)/thin-performance.profile
include $(top_builddir)/make.tmpl
+.PHONY: install_conf install_localconf install_profiles
+
install_conf: $(CONFSRC)
@if [ ! -e $(confdir)/$(CONFDEST) ]; then \
echo "$(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST)"; \
$(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST); \
fi
+install_localconf: $(CONFLOCAL)
+ @if [ ! -e $(confdir)/$(CONFLOCAL) ]; then \
+ echo "$(INSTALL_WDATA) -D $< $(confdir)/$(CONFLOCAL)"; \
+ $(INSTALL_WDATA) -D $< $(confdir)/$(CONFLOCAL); \
+ fi
+
install_profiles: $(PROFILES)
$(INSTALL_DIR) $(DESTDIR)$(DEFAULT_PROFILE_DIR)
$(INSTALL_DATA) $(PROFILES) $(DESTDIR)$(DEFAULT_PROFILE_DIR)/
-install_lvm2: install_conf install_profiles
+install_lvm2: install_conf install_localconf install_profiles
install: install_lvm2
-DISTCLEAN_TARGETS += $(CONFSRC) $(PROFILE_TEMPLATES)
+DISTCLEAN_TARGETS += $(CONFSRC) $(CONFLOCAL) $(PROFILE_TEMPLATES)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 777280e..574842a 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -838,18 +838,39 @@ global {
#
# cache_dump_executable = "@CACHE_DUMP_CMD@"
- # Defines the method lvm will use to find the local system_id.
- # The options are: none, machineid, uname, lvmlocal, or file.
- # Unset, or set to an empty string is equivalent to "none".
- # See lvmsystemid(7) for more information.
+ # The method, if any, used to define a local system ID on this host.
+ # By placing the same system ID on a Volume Group you can prevent
+ # other co-operating hosts in a cluster (each with a different
+ # system ID) from accessing the same Volume Group.
#
- # system_id_source = ""
-
- # Specifies the path to a file containing the local system_id.
- # It is only used when system_id_source = "file".
- # See lvmsystemid(7) for more information.
+ # Set this to one of: none, machineid, uname, lvmlocal, or file.
+ #
+ # N.B. Do not use this feature without reading 'man lvmsystemid' to
+ # understand the correct ways to use it and its limitations.
+ #
+ # system_id_source = "none"
+ #
+ # Obtain the system ID from the "system_id" setting in the "local"
+ # section of a configuration file such as @DEFAULT_SYS_DIR@/lvmlocal.conf.
+ #
+ # system_id_source = "lvmlocal"
+ #
+ # Set the system ID from the hostname of the system.
+ # System IDs beginning "localhost" are not permitted.
+ #
+ # system_id_source = "uname"
+ #
+ # Use the contents of the file @DEFAULT_SYS_DIR@/machine-id
+ # to set the system ID.
+ # Comments starting with the character # are ignored.
+ #
+ # system_id_source = "machineid"
+ #
+ # Use the contents of an alternative file to set the system ID.
+ # Comments starting with the character # are ignored.
#
- # system_id_file = ""
+ # system_id_source = "file"
+ # system_id_file = "/etc/systemid"
}
activation {
diff --git a/conf/lvmlocal.conf.in b/conf/lvmlocal.conf.in
index b95ab37..48965e4 100644
--- a/conf/lvmlocal.conf.in
+++ b/conf/lvmlocal.conf.in
@@ -1,33 +1,54 @@
-# This is an example local configuration file for the LVM2 system.
-# It contains the default settings that would be used if there was no
-# @DEFAULT_SYS_DIR@/lvmlocal.conf file.
+# This is a local configuration file template for the LVM2 system
+# which should be installed as @DEFAULT_SYS_DIR@/lvmlocal.conf .
#
-# Refer to 'man lvm.conf' for further information including the file layout.
+# This file allows you to assign a unique identity to a host running
+# LVM2 that is permitted to access storage devices visible to more than
+# one machine simultaneously.
#
-# To put this file in a different directory and override @DEFAULT_SYS_DIR@ set
-# the environment variable LVM_SYSTEM_DIR before running the tools.
+# You must ensure that every such host uses a different system_id
+# identifier, otherwise LVM2 cannot protect you from simultaneous
+# access from multiple hosts and possible data corruption.
#
-# N.B. Take care that each setting only appears once if uncommenting
-# example settings in this file.
+# Refer to 'man lvmsystemid' for information about the correct ways
+# to use this and its limitations.
#
-# The lvmlocal.conf file should contain only the "local { }" section
-# which contains settings that should not be shared or repeated among
-# different hosts.
+# Refer to 'man lvm.conf' for information about the file layout.
#
-# This file should not be copied among hosts.
+# To put this file in a different directory and override
+# @DEFAULT_SYS_DIR@ set the environment variable LVM_SYSTEM_DIR before
+# running the tools.
+#
+# The lvmlocal.conf file is normally expected to contain only the
+# "local" section which contains settings that should not be shared or
+# repeated among different hosts. (But if other sections are present,
+# they *will* get processed. Settings in this file override equivalent
+# ones in lvm.conf and are in turn overridden by ones in any enabled
+# lvm_<tag>.conf files.)
+#
+# Please take care that each setting only appears once if uncommenting
+# example settings in this file and never copy this file between
+# hosts to avoid accidentally assigning the same system ID to
+# more than one host!
local {
- # This defines the system_id of the local host. It is
- # only used if lvm.conf system_id_source = "lvmlocal".
- # When used, it should be set to a unique value.
- # See lvmsystemid(7) for more information.
+ # This defines the system ID of the local host. This is used
+ # when global/system_id_source is set to "lvmlocal" in the main
+ # configuration file, conventionally @DEFAULT_SYS_DIR@/lvm.conf.
+ # When used, it must be set to a unique value - often a hostname -
+ # across all the hosts sharing access to the storage.
#
+ # By default, no system_id is set.
# system_id = ""
+ #
+ # Set the system_id to the string "host1".
+ # system_id = "host1"
- # This defines system_id's other than the local system_id
- # that the local host is allowed to access.
- # See lvmsystemid(7) for more information.
+ # This defines a list of extra system_ids other than the local
+ # system_id that the local host is allowed to access. These are
+ # used for all values of global/system_id_source except "none".
#
- # allow_system_id = []
+ # Only use this if you have read 'man lvmsystemid' and you are sure
+ # you understand why you need to use it!
+ #
+ # extra_system_ids = []
}
-
diff --git a/configure b/configure
index 935702a..c5c3b85 100755
--- a/configure
+++ b/configure
@@ -13069,7 +13069,7 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[()]' '{print $2}'`
################################################################################
-ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/lvmetad/Makefile conf/Makefile conf/example.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/replicator/Makefile lib/misc/lvm-version.h lib/raid/Makefile lib/snapshot/Makefile lib/thin/Makefile lib/cache_segtype/Makefile libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile
python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cluster_activation_red_hat.sh scripts/lvm2_cluster_activation_systemd_red_hat.service scripts/lvm2_clvmd_systemd_red_hat.service scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat@.service scripts/lvm2_tmpfiles_red_hat.conf scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile unit-tests/datastruct/Makefile unit-tests/regex/Makefile unit-tests/mm/Makefile"
+ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/lvmetad/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/replicator/Makefile lib/misc/lvm-version.h lib/raid/Makefile lib/snapshot/Makefile lib/thin/Makefile lib/cache_segtype/Makefile libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/M
akefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cluster_activation_red_hat.sh scripts/lvm2_cluster_activation_systemd_red_hat.service scripts/lvm2_clvmd_systemd_red_hat.service scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat@.service scripts/lvm2_tmpfiles_red_hat.conf scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile unit-tests/datastruct/Makefile unit-tests/regex/Makefile unit-tests/mm/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -13780,6 +13780,7 @@ do
"daemons/lvmetad/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/lvmetad/Makefile" ;;
"conf/Makefile") CONFIG_FILES="$CONFIG_FILES conf/Makefile" ;;
"conf/example.conf") CONFIG_FILES="$CONFIG_FILES conf/example.conf" ;;
+ "conf/lvmlocal.conf") CONFIG_FILES="$CONFIG_FILES conf/lvmlocal.conf" ;;
"conf/command_profile_template.profile") CONFIG_FILES="$CONFIG_FILES conf/command_profile_template.profile" ;;
"conf/metadata_profile_template.profile") CONFIG_FILES="$CONFIG_FILES conf/metadata_profile_template.profile" ;;
"include/.symlinks") CONFIG_FILES="$CONFIG_FILES include/.symlinks" ;;
diff --git a/configure.in b/configure.in
index 7c855bf..15d371b 100644
--- a/configure.in
+++ b/configure.in
@@ -1822,6 +1822,7 @@ daemons/dmeventd/plugins/thin/Makefile
daemons/lvmetad/Makefile
conf/Makefile
conf/example.conf
+conf/lvmlocal.conf
conf/command_profile_template.profile
conf/metadata_profile_template.profile
include/.symlinks
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index fe4218e..4083785 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -282,6 +282,6 @@ cfg_section(tag_CFG_SUBSECTION, "tag", tags_CFG_SECTION, CFG_NAME_VARIABLE | CFG
cfg(tag_host_list_CFG, "host_list", tag_CFG_SUBSECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
cfg(local_system_id_CFG, "system_id", local_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL)
-cfg_array(local_allow_system_id_CFG, "allow_system_id", local_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL)
+cfg_array(local_extra_system_ids_CFG, "extra_system_ids", local_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL)
cfg(CFG_COUNT, NULL, root_CFG_SECTION, 0, CFG_TYPE_INT, 0, vsn(0, 0, 0), NULL)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 5acb2b4..c04b67c 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4344,21 +4344,18 @@ static int allow_system_id(struct cmd_context *cmd, const char *system_id)
const struct dm_config_value *cv;
const char *str;
- if (!(cn = find_config_tree_node(cmd, local_allow_system_id_CFG, NULL)))
+ if (!(cn = find_config_tree_node(cmd, local_extra_system_ids_CFG, NULL)))
return 0;
for (cv = cn->v; cv; cv = cv->next) {
if (cv->type == DM_CFG_EMPTY_ARRAY)
break;
- if (cv->type != DM_CFG_STRING) {
- log_error("Ignoring invalid string in allow_system_id list");
+ /* Ignore invalid data: Warning message already issued by config.c */
+ if (cv->type != DM_CFG_STRING)
continue;
- }
str = cv->v.str;
- if (!*str) {
- log_error("Ignoring empty string in config file");
+ if (!*str)
continue;
- }
if (!strcmp(str, system_id))
return 1;
@@ -4376,6 +4373,7 @@ static int _access_vg_clustered(struct cmd_context *cmd, struct volume_group *vg
log_verbose("Skipping clustered volume group %s", vg->name);
return 0;
}
+
return 1;
}
diff --git a/man/lvmsystemid.7.in b/man/lvmsystemid.7.in
index c0dd78b..741aafe 100644
--- a/man/lvmsystemid.7.in
+++ b/man/lvmsystemid.7.in
@@ -197,24 +197,24 @@ global {
Changing system_id_source will often cause the system_id to change, which
may prevent the host from using VGs that it previously used (see
-allow_system_id below to handle this.)
+extra_system_ids below to handle this.)
If a system_id_source other than none fails to resolve a system_id, the
host will be allowed to access VGs with no system_id, but will not be
allowed to access VGs with a defined system_id.
-.SS allow_system_id
+.SS extra_system_ids
In some cases, it may be useful for a host to access VGs with different
system_id's, e.g. if a host's system_id changes, and it wants to use VGs
that it created with its old system_id. To allow a host to access VGs
with other system_id's, those other system_id's can be listed in
-lvmlocal.conf local/allow_system_id.
+lvmlocal.conf local/extra_system_ids.
.I lvmlocal.conf
.nf
local {
- allow_system_id = [ "my_other_name" ]
+ extra_system_ids = [ "my_other_name" ]
}
.fi
diff --git a/test/shell/system_id.sh b/test/shell/system_id.sh
index 98924b0..3312ab6 100644
--- a/test/shell/system_id.sh
+++ b/test/shell/system_id.sh
@@ -386,7 +386,7 @@ rm -f $SIDFILE
# lvs --foreign: lvs in a foreign vg are reported
# TODO
-# use allow_system_id to read a foreign VG
+# use extra_system_ids to read a foreign VG
# TODO
diff --git a/tools/vgchange.c b/tools/vgchange.c
index d56b3df..19aeee7 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -480,7 +480,7 @@ static int _vgchange_profile(struct cmd_context *cmd,
* This function will not be called unless the local host is allowed to use the
* VG. Either the VG has no system_id, or the VG and host have matching
* system_ids, or the host has the VG's current system_id in its
- * allow_system_id list. This function is not allowed to change the system_id
+ * extra_system_ids list. This function is not allowed to change the system_id
* of a foreign VG (VG owned by another host).
*/