When checking for the existance of /dev/mapper devices found in the fstab of a filesystem, using guestfs_exists means they are checked as files in the guest, while they really appear as devices on the appliance. Resort using a debug API to check whether a file in the appliance exists, instead.
Fixes commit 96b6504b09461aeb6850bb2e7b870a0a4c2f5edf. --- src/inspect-fs-unix.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c index c833304..7b54a4a 100644 --- a/src/inspect-fs-unix.c +++ b/src/inspect-fs-unix.c @@ -1806,6 +1806,19 @@ resolve_fstab_device_diskbyid (guestfs_h *g, const char *part, return 0; } +static bool +dev_mapper_exists (guestfs_h *g, const char *device) +{ + CLEANUP_FREE char *ret = NULL; + const char *const args[] = { device, NULL }; + + guestfs_push_error_handler (g, NULL, NULL); + ret = guestfs_debug (g, "exists", (char **) args); + guestfs_pop_error_handler (g); + + return ret && ret[0] != 0; +} + /* Resolve block device name to the libguestfs device name, eg. * /dev/xvdb1 => /dev/vdb1; and /dev/mapper/VG-LV => /dev/VG/LV. This * assumes that disks were added in the same order as they appear to @@ -1820,7 +1833,7 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map, char *type, *slice, *disk, *part; int r; - if (STRPREFIX (spec, "/dev/mapper/") && guestfs_exists (g, spec) > 0) { + if (STRPREFIX (spec, "/dev/mapper/") && dev_mapper_exists (g, spec) > 0) { /* LVM2 does some strange munging on /dev/mapper paths for VGs and * LVs which contain '-' character: * -- 2.7.4 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs