mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-07 05:58:00 +03:00
0d0d50182d
With use_lvmetad=0, duplicate PVs /dev/loop0 and /dev/loop1, where in this example, /dev/loop1 is the cached device referenced by pv->dev, the command 'pvs /dev/loop0' reports: Failed to find physical volume "/dev/loop0". This is because the duplicate PV detection by pvid is not working because _get_all_devices() is not setting any dev->pvid for any entries. This is because the pvid information has not yet been saved in lvmcache. This is fixed by calling _get_vgnameids_on_system() before _get_all_devices(), which has the effect of caching the necessary pvid information. With this fix, running pvs /dev/loop0, or pvs /dev/loop1, produces no error and one line of output for the PV (the device printed is the one cached in pv->dev, in this example /dev/loop1.) Running 'pvs /dev/loop0 /dev/loop1' produces no error and two lines of output, with each device displayed on one of the lines. Running 'pvs -a' shows two PVs, one with loop0 and one with loop1, and both shown as a member of the same VG. Running 'pvs' shows only one of the duplicate PVs, and that shows the device cached in pv->dev (loop1). The above output is what the duplicate handling code was previously designed to output in commits: b64da4d8b521 toollib: search for duplicate PVs only when needed 3a7c47af0e88 toollib: pvs -a should display VG name for each duplicate PV 57d74a45a05e toollib: override the PV device with duplicates c1f246fedfc3 toollib: handle duplicate pvs in process_in_pv As a further step after this, we may choose to change some of those. For all of these commands, a warning is printed about the existence of the duplicate PVs: Found duplicate PV ...: using /dev/loop1 not /dev/loop0