summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2019-06-26 16:03:42 -0500
committerDavid Teigland <teigland@redhat.com>2019-06-26 16:06:23 -0500
commitb13ebfa4c289a5bc6eb4f8ba26126db8e6d78296 (patch)
tree94b3314547e259c0fc0d979f90e6e47f28e16c59
parentb62c0787debeb3a66a2e3658d1edb8a61a6f247b (diff)
downloadlvm2-b13ebfa4c289a5bc6eb4f8ba26126db8e6d78296.tar.gz
pvremove/vgextend: fix using device aliases with lvmetad
These commands were looking for the requested device alias before dev_cache_scan had created the list of devs on the system, so they would fail and report the dev wasn't found.
-rw-r--r--tools/toollib.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/toollib.c b/tools/toollib.c
index 3221e5f1c..1b01cccfa 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -5544,6 +5544,15 @@ int pvcreate_each_device(struct cmd_context *cmd,
lvmcache_label_scan(cmd);
/*
+ * When using lvmetad, we want to do a dev cache scan here (if not done
+ * already) so that the dev_cache_get just below will be able to find
+ * device aliases. When not using lvmetad, the label_scan just above
+ * has done dev_cache_scan, and this will not be run.
+ */
+ if (!dev_cache_has_scanned())
+ dev_cache_scan();
+
+ /*
* Translate arg names into struct device's.
*/
dm_list_iterate_items(pd, &pp->arg_devices)