1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

online files: fix vgname check

The pvs_online file for a PV will not contain a vgname
if the PV has no metadata, so don't require matching
vgname with the pvs_lookup file.
This commit is contained in:
David Teigland 2021-11-12 11:52:36 -06:00
parent 5dbf316cee
commit 66f0fe57c3

View File

@ -415,8 +415,17 @@ int get_pvs_lookup(struct dm_list *pvs_online, const char *vgname)
if (!online_pvid_file_read(path, &file_major, &file_minor, file_vgname, file_devname)) if (!online_pvid_file_read(path, &file_major, &file_minor, file_vgname, file_devname))
goto_bad; goto_bad;
if (vgname && strcmp(file_vgname, vgname)) /*
* PVs without metadata will not have a vgname in their pvid
* file, but the purpose of using the lookup file is that we
* know the PV is for this VG even without the pvid vgname
* field.
*/
if (vgname && file_vgname[0] && strcmp(file_vgname, vgname)) {
/* Should never happen */
log_error("Incorrect VG lookup file %s PVID %s %s.", vgname, pvid, file_vgname);
goto_bad; goto_bad;
}
if (!(po = zalloc(sizeof(*po)))) if (!(po = zalloc(sizeof(*po))))
goto_bad; goto_bad;