Pino Toscano
2018-Jul-27 13:33 UTC
[Libguestfs] [PATCH] daemon: inspect: ignore fstab devs that cannot be resolved (RHBZ#1608131)
If the /etc/fstab of a guest contains devices specified with UUID or LABEL, then the new OCaml inspection code will report the findfs failure as general failure of the inspection. OTOH, the old C inspection code simply ignored all the devices that cannot be resolved. Hence, restore the old behaviour by ignoring unresolvable devices. --- daemon/inspect_fs_unix_fstab.ml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml index edb797e3f..170440d2c 100644 --- a/daemon/inspect_fs_unix_fstab.ml +++ b/daemon/inspect_fs_unix_fstab.ml @@ -115,12 +115,20 @@ and check_fstab_entry md_map root_mountable os_type aug entry if String.is_prefix spec "UUID=" then ( let uuid = String.sub spec 5 (String.length spec - 5) in let uuid = shell_unquote uuid in - Mountable.of_device (Findfs.findfs_uuid uuid) + (* Just ignore the device if the UUID cannot be resolved. *) + try + Mountable.of_device (Findfs.findfs_uuid uuid) + with + Failure _ -> return None ) else if String.is_prefix spec "LABEL=" then ( let label = String.sub spec 6 (String.length spec - 6) in let label = shell_unquote label in - Mountable.of_device (Findfs.findfs_label label) + (* Just ignore the device if the label cannot be resolved. *) + try + Mountable.of_device (Findfs.findfs_label label) + with + Failure _ -> return None ) (* Resolve /dev/root to the current device. * Do the same for the / partition of the *BSD -- 2.17.1
Richard W.M. Jones
2018-Jul-27 14:09 UTC
Re: [Libguestfs] [PATCH] daemon: inspect: ignore fstab devs that cannot be resolved (RHBZ#1608131)
On Fri, Jul 27, 2018 at 03:33:51PM +0200, Pino Toscano wrote:> If the /etc/fstab of a guest contains devices specified with UUID or > LABEL, then the new OCaml inspection code will report the findfs failure > as general failure of the inspection. OTOH, the old C inspection code > simply ignored all the devices that cannot be resolved. > > Hence, restore the old behaviour by ignoring unresolvable devices. > --- > daemon/inspect_fs_unix_fstab.ml | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/daemon/inspect_fs_unix_fstab.ml b/daemon/inspect_fs_unix_fstab.ml > index edb797e3f..170440d2c 100644 > --- a/daemon/inspect_fs_unix_fstab.ml > +++ b/daemon/inspect_fs_unix_fstab.ml > @@ -115,12 +115,20 @@ and check_fstab_entry md_map root_mountable os_type aug entry > if String.is_prefix spec "UUID=" then ( > let uuid = String.sub spec 5 (String.length spec - 5) in > let uuid = shell_unquote uuid in > - Mountable.of_device (Findfs.findfs_uuid uuid) > + (* Just ignore the device if the UUID cannot be resolved. *) > + try > + Mountable.of_device (Findfs.findfs_uuid uuid) > + with > + Failure _ -> return None > ) > else if String.is_prefix spec "LABEL=" then ( > let label = String.sub spec 6 (String.length spec - 6) in > let label = shell_unquote label in > - Mountable.of_device (Findfs.findfs_label label) > + (* Just ignore the device if the label cannot be resolved. *) > + try > + Mountable.of_device (Findfs.findfs_label label) > + with > + Failure _ -> return None > ) > (* Resolve /dev/root to the current device. > * Do the same for the / partition of the *BSDACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Reasonably Related Threads
- [PATCH REPOST 1/2] common/mlstdutils: Add return statement.
- [PATCH 0/2] (mainly for discussion) Add ‘return’ statement.
- [PATCH v12 09/11] daemon: Implement inspection of Linux and other Unix-like operating systems.
- [PATCH v11 08/10] daemon: Implement inspection of Linux and other Unix-like operating systems.
- [PATCH] inspect: fix inspection of partition-less devices (RHBZ#1661038)