summaryrefslogtreecommitdiff
path: root/tools/vgimport.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2014-10-24 12:29:04 -0500
committerDavid Teigland <teigland@redhat.com>2015-02-13 10:10:27 -0600
commit8cdec4c434a8b043a2a0a44252bfd11f40b0a8ec (patch)
tree8b5b13f2dc142bf94504e203c703748ed9097bf8 /tools/vgimport.c
parentf5d06efbab4c7c77298b18b95c23111575a8db1a (diff)
downloadlvm2-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.c12
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,