diff options
Diffstat (limited to 'tools/toollib.c')
-rw-r--r-- | tools/toollib.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/toollib.c b/tools/toollib.c index 7f656c6e3..397484961 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -17,6 +17,7 @@ #include <sys/stat.h> #include <signal.h> #include <sys/wait.h> +#include <sys/utsname.h> const char *command_name(struct cmd_context *cmd) { @@ -169,6 +170,9 @@ int ignore_vg(struct volume_group *vg, const char *vg_name, int allow_inconsiste if ((read_error == FAILED_INCONSISTENT) && allow_inconsistent) return 0; + if (read_error == FAILED_SYSTEMID) + return 1; + if (read_error == FAILED_NOTFOUND) *ret = ECMD_FAILED; else if (read_error == FAILED_CLUSTERED && vg->cmd->ignore_clustered_vgs) @@ -633,6 +637,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; } else { vp_def->vg_name = NULL; extent_size = find_config_tree_int64(cmd, @@ -647,6 +652,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; } return 1; @@ -662,6 +668,9 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd, struct vgcreate_params *vp_new, struct vgcreate_params *vp_def) { + const char *system_id; + const char *system_id_source; + vp_new->vg_name = skip_dev_dir(cmd, vp_def->vg_name, NULL); vp_new->max_lv = arg_uint_value(cmd, maxlogicalvolumes_ARG, vp_def->max_lv); @@ -712,6 +721,18 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd, vp_new->vgmetadatacopies = find_config_tree_int(cmd, metadata_vgmetadatacopies_CFG, NULL); } + if ((system_id = arg_str_value(cmd, systemid_ARG, NULL))) { + vp_new->system_id = system_id_from_string(cmd, system_id); + } else if ((system_id_source = arg_str_value(cmd, systemidsource_ARG, NULL))) { + vp_new->system_id = system_id_from_source(cmd, system_id_source); + } else { + vp_new->system_id = vp_def->system_id; + } + + /* A clustered vg has no system_id unless overriden with the systemid arg. */ + if (!system_id && vp_new->clustered) + vp_new->system_id = NULL; + return 1; } |