mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
systemid: Init and merge lvm2 and lvm1 fields.
Use system_id field in preference to lvm1_system_id. Initialise both for now.
This commit is contained in:
parent
dcba4781ea
commit
3562b5ab39
@ -695,7 +695,7 @@ void vgdisplay_full(const struct volume_group *vg)
|
|||||||
|
|
||||||
log_print("--- Volume group ---");
|
log_print("--- Volume group ---");
|
||||||
log_print("VG Name %s", vg->name);
|
log_print("VG Name %s", vg->name);
|
||||||
log_print("System ID %s", vg->system_id);
|
log_print("System ID %s", (vg->system_id && *vg->system_id) ? vg->system_id : vg->lvm1_system_id ? : "");
|
||||||
log_print("Format %s", vg->fid->fmt->name);
|
log_print("Format %s", vg->fid->fmt->name);
|
||||||
if (vg->fid->fmt->features & FMT_MDAS) {
|
if (vg->fid->fmt->features & FMT_MDAS) {
|
||||||
log_print("Metadata Areas %d",
|
log_print("Metadata Areas %d",
|
||||||
|
@ -156,8 +156,10 @@ int export_pv(struct cmd_context *cmd, struct dm_pool *mem __attribute__((unused
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Preserve existing system_id if it exists */
|
/* Preserve existing system_id if it exists */
|
||||||
if (vg && *vg->lvm1_system_id)
|
if (vg && vg->lvm1_system_id && *vg->lvm1_system_id)
|
||||||
strncpy((char *)pvd->system_id, vg->lvm1_system_id, sizeof(pvd->system_id));
|
strncpy((char *)pvd->system_id, vg->lvm1_system_id, sizeof(pvd->system_id));
|
||||||
|
else if (vg && vg->system_id && *vg->system_id)
|
||||||
|
strncpy((char *)pvd->system_id, vg->system_id, sizeof(pvd->system_id));
|
||||||
|
|
||||||
/* Is VG already exported or being exported? */
|
/* Is VG already exported or being exported? */
|
||||||
if (vg && vg_is_exported(vg)) {
|
if (vg && vg_is_exported(vg)) {
|
||||||
|
@ -417,6 +417,8 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
|
|||||||
|
|
||||||
if (vg->system_id && *vg->system_id)
|
if (vg->system_id && *vg->system_id)
|
||||||
outf(f, "system_id = \"%s\"", vg->system_id);
|
outf(f, "system_id = \"%s\"", vg->system_id);
|
||||||
|
else if (vg->lvm1_system_id && *vg->lvm1_system_id)
|
||||||
|
outf(f, "system_id = \"%s\"", vg->lvm1_system_id);
|
||||||
|
|
||||||
outsize(f, (uint64_t) vg->extent_size, "extent_size = %u",
|
outsize(f, (uint64_t) vg->extent_size, "extent_size = %u",
|
||||||
vg->extent_size);
|
vg->extent_size);
|
||||||
|
@ -883,8 +883,6 @@ static struct volume_group *_read_vg(struct format_instance *fid,
|
|||||||
dm_hash_destroy(pv_hash);
|
dm_hash_destroy(pv_hash);
|
||||||
dm_hash_destroy(lv_hash);
|
dm_hash_destroy(lv_hash);
|
||||||
|
|
||||||
/* FIXME Determine format type from file contents */
|
|
||||||
/* eg Set to instance of fmt1 here if reading a format1 backup? */
|
|
||||||
vg_set_fid(vg, fid);
|
vg_set_fid(vg, fid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -47,6 +47,8 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vg->system_id = "";
|
||||||
|
|
||||||
vg->cmd = cmd;
|
vg->cmd = cmd;
|
||||||
vg->vgmem = vgmem;
|
vg->vgmem = vgmem;
|
||||||
vg->alloc = ALLOC_NORMAL;
|
vg->alloc = ALLOC_NORMAL;
|
||||||
@ -627,6 +629,9 @@ int vg_set_system_id(struct volume_group *vg, const char *system_id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vg->lvm1_system_id)
|
||||||
|
*vg->lvm1_system_id = '\0';
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -989,7 +989,7 @@ static int _vgsystemid_disp(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
const void *data, void *private)
|
const void *data, void *private)
|
||||||
{
|
{
|
||||||
const struct volume_group *vg = (const struct volume_group *) data;
|
const struct volume_group *vg = (const struct volume_group *) data;
|
||||||
const char *repstr = vg->system_id ? : vg->lvm1_system_id ? : "";
|
const char *repstr = (vg->system_id && *vg->system_id) ? vg->system_id : vg->lvm1_system_id ? : "";
|
||||||
|
|
||||||
return _string_disp(rh, mem, field, &repstr, private);
|
return _string_disp(rh, mem, field, &repstr, private);
|
||||||
}
|
}
|
||||||
|
@ -200,8 +200,9 @@ static int _ignore_vg(struct volume_group *vg, const char *vg_name,
|
|||||||
*/
|
*/
|
||||||
if (read_error & FAILED_SYSTEMID) {
|
if (read_error & FAILED_SYSTEMID) {
|
||||||
if (arg_vgnames && str_list_match_item(arg_vgnames, vg->name)) {
|
if (arg_vgnames && str_list_match_item(arg_vgnames, vg->name)) {
|
||||||
log_error("Cannot access VG %s with system ID %s with local system ID %s.",
|
log_error("Cannot access VG %s with system ID %s with %slocal system ID%s%s.",
|
||||||
vg->name, vg->system_id, vg->cmd->system_id);
|
vg->name, vg->system_id, vg->cmd->system_id ? "" : "unknown ",
|
||||||
|
vg->cmd->system_id ? " " : "", vg->cmd->system_id ? vg->cmd->system_id : "");
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
read_error &= ~FAILED_SYSTEMID; /* Check for other errors */
|
read_error &= ~FAILED_SYSTEMID; /* Check for other errors */
|
||||||
|
@ -576,6 +576,9 @@ static int _vgchange_system_id(struct cmd_context *cmd, struct volume_group *vg)
|
|||||||
|
|
||||||
vg->system_id = system_id;
|
vg->system_id = system_id;
|
||||||
|
|
||||||
|
if (vg->lvm1_system_id)
|
||||||
|
*vg->lvm1_system_id = '\0';
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user