summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2014-06-18 15:25:46 -0500
committerDavid Teigland <teigland@redhat.com>2014-06-18 15:54:57 -0500
commitd8fe3ebb2d2cb0e439cef4404e7fe12ea4a83186 (patch)
tree858ad98432feebd8d23082135f9c599e72865233
parent65a6f296e197bb8b572fe8b90f1088cc15adf967 (diff)
downloadlvm2-dev-dct-process-v18.tar.gz
toollib: process_each_pv workaround for no mda pvsdev-dct-process-v18
Add a workaround for a bug somewhere that can cause a pv with no mda to appear in both its real vg and in the orphan vg when not using lvmetad.
-rw-r--r--tools/toollib.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/tools/toollib.c b/tools/toollib.c
index aed352cd1..bbe00111a 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1858,17 +1858,17 @@ static int get_all_devs(struct cmd_context *cmd, struct dm_list *all_devs)
return ECMD_PROCESSED;
}
-static void device_list_remove(struct dm_list *all_devs, struct device *dev)
+static int device_list_remove(struct dm_list *all_devs, struct device *dev)
{
struct device_list *devl;
dm_list_iterate_items(devl, all_devs) {
if (devl->dev == dev) {
dm_list_del(&devl->list);
- return;
+ return 1;
}
}
- log_error(INTERNAL_ERROR "device_list_remove %s not found", dev_name(dev));
+ return 0;
}
static int process_dev_list(struct cmd_context *cmd, struct dm_list *all_devs,
@@ -1914,6 +1914,7 @@ static int process_pvs_in_vg(struct cmd_context *cmd,
struct pv_list *pvl;
const char *pv_name;
int process_pv;
+ int found;
int ret_max = ECMD_PROCESSED;
int ret = 0;
@@ -1949,7 +1950,18 @@ static int process_pvs_in_vg(struct cmd_context *cmd,
log_very_verbose("Processing PV %s in VG %s", pv_name, vg->name);
if (all_devs)
- device_list_remove(all_devs, pv->dev);
+ found = device_list_remove(all_devs, pv->dev);
+
+ if (all_devs && !found) {
+ /*
+ * There's a bug somewhere that can cause pvs with no mdas
+ * to appear in both their real vg and the orphan vg,
+ * which triggers this condition when not using lvmetad.
+ */
+ log_verbose("Skipping VG %s PV %s not found in device list",
+ vg->name, pv_name);
+ continue;
+ }
if (!skip)
ret = process_single_pv(cmd, vg, pv, handle);