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