1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-09-29 13:44:18 +03:00

Compare commits

...

1 Commits

Author SHA1 Message Date
David Teigland
af828fbc49 config: add use_vg_without_system_id
The default is 1 (the existing behavior) which means a
VG without a system ID can accessed by any machine, whether
that machine has a system ID set for itself or not.

When this setting is changed to 0, it means that a VG
without a system ID cannot be accessed.
2019-03-04 15:47:20 -06:00
4 changed files with 18 additions and 2 deletions

View File

@@ -526,6 +526,8 @@ static int _init_system_id(struct cmd_context *cmd)
const char *source, *system_id;
int local_set = 0;
cmd->use_vg_without_system_id = find_config_tree_bool(cmd, global_use_vg_without_system_id_CFG, NULL);
cmd->system_id = NULL;
cmd->unknown_system_id = 0;

View File

@@ -151,6 +151,7 @@ struct cmd_context {
unsigned include_foreign_vgs:1; /* report/display cmds can reveal foreign VGs */
unsigned include_shared_vgs:1; /* report/display cmds can reveal lockd VGs */
unsigned include_active_foreign_vgs:1; /* cmd should process foreign VGs with active LVs */
unsigned use_vg_without_system_id:1; /* a VG without a system id can be accessed */
unsigned vg_read_print_access_error:1; /* print access errors from vg_read */
unsigned force_access_clustered:1;
unsigned lockd_gl_disable:1;

View File

@@ -1200,6 +1200,13 @@ cfg(global_system_id_file_CFG, "system_id_file", global_CFG_SECTION, CFG_DEFAULT
"This is used when system_id_source is set to 'file'.\n"
"Comments starting with the character # are ignored.\n")
cfg(global_use_vg_without_system_id_CFG, "use_vg_without_system_id", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 1, vsn(2, 3, 2), 0, 0, NULL,
"Allow a VG without a system ID to be used by the local machine.\n"
"The default is to allow unrestricted access to a VG that does not\n"
"have a system ID set. Before disabling this (turning off access\n"
"to VGs without a system ID), ensure that any VG needed by the local\n"
"machine has a system ID set, matching the local machine.\n")
cfg(activation_checks_CFG, "checks", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ACTIVATION_CHECKS, vsn(2, 2, 86), NULL, 0, NULL,
"Perform internal checks of libdevmapper operations.\n"
"Useful for debugging problems with activation. Some of the checks may\n"

View File

@@ -3491,6 +3491,9 @@ static int _check_reappeared_pv(struct volume_group *correct_vg,
static int _is_foreign_vg(struct volume_group *vg)
{
if (!vg->cmd->use_vg_without_system_id && !vg->system_id[0])
return 1;
return vg->cmd->system_id && strcmp(vg->system_id, vg->cmd->system_id);
}
@@ -4882,8 +4885,11 @@ int is_system_id_allowed(struct cmd_context *cmd, const char *system_id)
/*
* A VG without a system_id can be accessed by anyone.
*/
if (!system_id || !system_id[0])
return 1;
if (!system_id || !system_id[0]) {
if (cmd->use_vg_without_system_id)
return 1;
return 0;
}
/*
* Allowed if the host and VG system_id's match.