[Libguestfs] [PATCH] daemon: inspect: ignore fstab devs that cannot be resolved (RHBZ#1608131)

Richard W.M. Jones rjones at redhat.com
Fri Jul 27 14:09:14 UTC 2018


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 *BSD

ACK.

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




More information about the Libguestfs mailing list