Pino Toscano
2017-Dec-01 13:49 UTC
[Libguestfs] [PATCH] v2v: bootloaders: handle no default grubby kernel (RHBZ#1519204)
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"; " -- 2.14.3
Richard W.M. Jones
2017-Dec-02 15:28 UTC
[Libguestfs] [PATCH] v2v: bootloaders: handle no default grubby kernel (RHBZ#1519204)
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
Possibly Parallel Threads
- [PATCH 3/3] v2v: bootloaders: improve detection of Grub2 default method
- [PATCH 0/3] v2v: further bits of Debian/Ubuntu guests supports
- [PATCH v2 0/3] v2v: further bits of Debian/Ubuntu guests supports
- [PATCH v2 1/2] v2v: bootloaders: Handle no Bootloader::Tools default section (RHBZ#1472208).
- [PATCH 2/2] v2v: bootloaders: look for device.map also in /boot/grub (Grub2)