[Libguestfs] [PATCH] v2v: bootloaders: handle no default grubby kernel (RHBZ#1519204)

Richard W.M. Jones rjones at redhat.com
Sat Dec 2 15:28:20 UTC 2017


On Fri, Dec 01, 2017 at 02:49:30PM +0100, Pino Toscano wrote:
> When using grubby to get the default kernel of a guest, do not fail
> with a bogus error like:
> 
> virt-v2v: error: libguestfs error: statns: statns_stub: path must start
> with a / character
> 
> in case there is no default kernel that can be determined (e.g. because
> of a bogus configuration).
> ---
>  v2v/linux_bootloaders.ml | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml
> index 8de3f0469..b820f731f 100644
> --- a/v2v/linux_bootloaders.ml
> +++ b/v2v/linux_bootloaders.ml
> @@ -239,7 +239,10 @@ object (self)
>        let res =
>          match get_default_method with
>          | MethodGrubby ->
> -          Some (g#command [| "grubby"; "--default-kernel" |])
> +          let res = g#command [| "grubby"; "--default-kernel" |] in
> +          (match res with
> +           | "" -> None
> +           | _ -> Some res)
>          | MethodPerlBootloader ->
>            let cmd =
>              [| "/usr/bin/perl"; "-MBootloader::Tools"; "-e"; "

Looks good, ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list