|
|
aa0300 |
From 60e21f49f1da66af4531b4472670e075d83cd0c1 Mon Sep 17 00:00:00 2001
|
|
|
aa0300 |
From: Pino Toscano <ptoscano@redhat.com>
|
|
|
aa0300 |
Date: Tue, 6 Dec 2016 15:18:34 +0100
|
|
|
aa0300 |
Subject: [PATCH] inspect: fix existance check of /dev/mapper devices
|
|
|
aa0300 |
|
|
|
aa0300 |
When checking for the existance of /dev/mapper devices found in the
|
|
|
aa0300 |
fstab of a filesystem, using guestfs_exists means they are checked as
|
|
|
aa0300 |
files in the guest, while they really appear as devices on the
|
|
|
aa0300 |
appliance. Instead, try the lvm name resolution anyway, and ignore them
|
|
|
aa0300 |
when they are reported as missing.
|
|
|
aa0300 |
|
|
|
aa0300 |
Thanks to: Richard W.M. Jones.
|
|
|
aa0300 |
|
|
|
aa0300 |
Fixes commit 96b6504b09461aeb6850bb2e7b870a0a4c2f5edf.
|
|
|
aa0300 |
|
|
|
aa0300 |
(cherry picked from commit dad35e55fac526dbcd50964500f2d5047ae011af)
|
|
|
aa0300 |
---
|
|
|
aa0300 |
src/inspect-fs-unix.c | 13 ++++++++++++-
|
|
|
aa0300 |
1 file changed, 12 insertions(+), 1 deletion(-)
|
|
|
aa0300 |
|
|
|
aa0300 |
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
|
|
|
aa0300 |
index 8e27ade..8b7a7ee 100644
|
|
|
aa0300 |
--- a/src/inspect-fs-unix.c
|
|
|
aa0300 |
+++ b/src/inspect-fs-unix.c
|
|
|
aa0300 |
@@ -24,6 +24,7 @@
|
|
|
aa0300 |
#include <unistd.h>
|
|
|
aa0300 |
#include <string.h>
|
|
|
aa0300 |
#include <libintl.h>
|
|
|
aa0300 |
+#include <errno.h>
|
|
|
aa0300 |
|
|
|
aa0300 |
#ifdef HAVE_ENDIAN_H
|
|
|
aa0300 |
#include <endian.h>
|
|
|
aa0300 |
@@ -1850,7 +1851,7 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map,
|
|
|
aa0300 |
char *type, *slice, *disk, *part;
|
|
|
aa0300 |
int r;
|
|
|
aa0300 |
|
|
|
aa0300 |
- if (STRPREFIX (spec, "/dev/mapper/") && guestfs_exists (g, spec) > 0) {
|
|
|
aa0300 |
+ if (STRPREFIX (spec, "/dev/mapper/")) {
|
|
|
aa0300 |
/* LVM2 does some strange munging on /dev/mapper paths for VGs and
|
|
|
aa0300 |
* LVs which contain '-' character:
|
|
|
aa0300 |
*
|
|
|
aa0300 |
@@ -1861,7 +1862,17 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map,
|
|
|
aa0300 |
* This makes it impossible to reverse those paths directly, so
|
|
|
aa0300 |
* we have implemented lvm_canonical_lv_name in the daemon.
|
|
|
aa0300 |
*/
|
|
|
aa0300 |
+ guestfs_push_error_handler (g, NULL, NULL);
|
|
|
aa0300 |
device = guestfs_lvm_canonical_lv_name (g, spec);
|
|
|
aa0300 |
+ guestfs_pop_error_handler (g);
|
|
|
aa0300 |
+ if (device == NULL) {
|
|
|
aa0300 |
+ if (guestfs_last_errno (g) == ENOENT) {
|
|
|
aa0300 |
+ /* Ignore devices that don't exist. (RHBZ#811872) */
|
|
|
aa0300 |
+ } else {
|
|
|
aa0300 |
+ guestfs_int_error_errno (g, guestfs_last_errno (g), "%s", guestfs_last_error (g));
|
|
|
aa0300 |
+ return NULL;
|
|
|
aa0300 |
+ }
|
|
|
aa0300 |
+ }
|
|
|
aa0300 |
}
|
|
|
aa0300 |
else if (match3 (g, spec, re_xdev, &type, &disk, &part)) {
|
|
|
aa0300 |
r = resolve_fstab_device_xdev (g, type, disk, part, &device);
|
|
|
aa0300 |
--
|
|
|
7af31e |
1.8.3.1
|
|
|
aa0300 |
|