diff options
author | David Teigland <teigland@redhat.com> | 2014-10-24 12:29:04 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2015-02-13 10:10:27 -0600 |
commit | 8cdec4c434a8b043a2a0a44252bfd11f40b0a8ec (patch) | |
tree | 8b5b13f2dc142bf94504e203c703748ed9097bf8 /tools/vgimport.c | |
parent | f5d06efbab4c7c77298b18b95c23111575a8db1a (diff) | |
download | lvm2-8cdec4c434a8b043a2a0a44252bfd11f40b0a8ec.tar.gz |
system_id: use for VG ownership
See included lvmsystemid(7) for full description.
Diffstat (limited to 'tools/vgimport.c')
-rw-r--r-- | tools/vgimport.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/vgimport.c b/tools/vgimport.c index d5ca7c33b..41fd3939e 100644 --- a/tools/vgimport.c +++ b/tools/vgimport.c @@ -37,6 +37,7 @@ static int vgimport_single(struct cmd_context *cmd __attribute__((unused)), goto_bad; vg->status &= ~EXPORTED_VG; + vg->system_id = cmd->system_id ? dm_pool_strdup(cmd->mem, cmd->system_id) : NULL; dm_list_iterate_items(pvl, &vg->pvs) { pv = pvl->pv; @@ -84,6 +85,17 @@ int vgimport(struct cmd_context *cmd, int argc, char **argv) cmd->handles_missing_pvs = 1; } + /* + * Rescan devices and update lvmetad. lvmetad may hold a copy of the + * VG from before it was exported, if it was exported by another host. + * We need to reread it to see that it's been exported before we can + * import it. + */ + if (lvmetad_used() && !lvmetad_pvscan_all_devs(cmd, NULL)) { + log_error("Failed to scan devices."); + return ECMD_FAILED; + } + return process_each_vg(cmd, argc, argv, READ_FOR_UPDATE | READ_ALLOW_EXPORTED, NULL, |