[Libguestfs] [PATCH 3/3] v2v: ignore missing kernels from grub (RHBZ#1230412)

Richard W.M. Jones rjones at redhat.com
Tue Aug 25 08:01:09 UTC 2015


On Mon, Aug 24, 2015 at 06:28:30PM +0200, Pino Toscano wrote:
> Raise a warning for each kernel specified in grub which does not
> actually exist, keep going on with the conversion using the remaining
> (existing) kernels.
> ---
>  v2v/convert_linux.ml | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
> index 986af54..adbcaa2 100644
> --- a/v2v/convert_linux.ml
> +++ b/v2v/convert_linux.ml
> @@ -364,7 +364,14 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source =
>                  statbuf.G.st_dev = s.G.st_dev && statbuf.G.st_ino = s.G.st_ino
>              ) installed_kernels in
>            Some kernel
> -        with Not_found -> None
> +        with
> +        | Not_found -> None
> +        | G.Error msg as exn ->
> +          (* If it isn't "no such file or directory", then re-raise it. *)
> +          if g#last_errno () <> G.Errno.errno_ENOENT then raise exn;
> +          warning (f_"ignoring kernel %s in grub, as it does not exist.")
> +            vmlinuz;
> +          None
>      ) vmlinuzes in
>  
>    if verbose () then (
> -- 
> 2.1.0

ACK series, thanks.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list