summaryrefslogtreecommitdiff
path: root/tools/vgimport.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-01-28 16:40:26 -0600
committerDavid Teigland <teigland@redhat.com>2016-04-13 14:05:42 -0500
commit56c68b3476f52a07c877496a07ebef619724e224 (patch)
treeec05b270f9d17da209d32a34eb80fd5fe883bc40 /tools/vgimport.c
parenta28c81cbae308e371ece31679615d673b29fccec (diff)
downloadlvm2-56c68b3476f52a07c877496a07ebef619724e224.tar.gz
lvmetad: preemptively check and rescan in commands
Move checking the lvmetad state, and the possible rescan, out of lvmetad_send() to the start of the command. Previously, the token mismatch and rescan would occur within lvmetad_send() for some other request. Now, the token mismatch is detected earlier, so the rescan can be done before the main command is in progress. Rescanning deep within the processing of another command will disturb the lvmcache state of that other command. A rescan already exists at the start of the command for the case where foreign VGs are going to be read. This same rescan is now also performed when there is an lvmetad token mismatch (from a changed global_filter). The commands pvscan/vgscan/lvscan/vgimport are excluded from this preemptive checking/rescanning for lvmetad because they want to do rescanning themselves explicitly. If rescanning devices fails, then lvmetad has not been correctly repopulated and should not be used, so make the command revert to not using lvmetad.
Diffstat (limited to 'tools/vgimport.c')
-rw-r--r--tools/vgimport.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/vgimport.c b/tools/vgimport.c
index caeaf09cf..3c08876f0 100644
--- a/tools/vgimport.c
+++ b/tools/vgimport.c
@@ -93,9 +93,11 @@ int vgimport(struct cmd_context *cmd, int argc, char **argv)
* We need to reread it to see that it's been exported before we can
* import it.
*/
- if (lvmetad_active() && !lvmetad_pvscan_all_devs(cmd, NULL)) {
- log_error("Failed to scan devices.");
- return ECMD_FAILED;
+ if (lvmetad_used()) {
+ if (!lvmetad_pvscan_all_devs(cmd, NULL, 1)) {
+ log_warn("WARNING: Not using lvmetad because cache update failed.");
+ lvmetad_set_active(cmd, 0);
+ }
}
return process_each_vg(cmd, argc, argv, NULL,