mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0068-v2v-bootloaders-handle-no-default-grubby-kernel-RHBZ.patch

a30de4
From 67b740a77543bc0f0c6b4d0f52c8855b8705822b Mon Sep 17 00:00:00 2001
a30de4
From: Pino Toscano <ptoscano@redhat.com>
a30de4
Date: Fri, 1 Dec 2017 14:46:13 +0100
a30de4
Subject: [PATCH] v2v: bootloaders: handle no default grubby kernel
a30de4
 (RHBZ#1519204)
a30de4
a30de4
When using grubby to get the default kernel of a guest, do not fail
a30de4
with a bogus error like:
a30de4
a30de4
virt-v2v: error: libguestfs error: statns: statns_stub: path must start
a30de4
with a / character
a30de4
a30de4
in case there is no default kernel that can be determined (e.g. because
a30de4
of a bogus configuration).
a30de4
---
a30de4
 v2v/linux_bootloaders.ml | 5 ++++-
a30de4
 1 file changed, 4 insertions(+), 1 deletion(-)
a30de4
a30de4
diff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml
a30de4
index 25dab02fe..e241d93c2 100644
a30de4
--- a/v2v/linux_bootloaders.ml
a30de4
+++ b/v2v/linux_bootloaders.ml
a30de4
@@ -281,7 +281,10 @@ object (self)
a30de4
       let res =
a30de4
         match get_default_method with
a30de4
         | MethodGrubby ->
a30de4
-          Some (g#command [| "grubby"; "--default-kernel" |])
a30de4
+          let res = g#command [| "grubby"; "--default-kernel" |] in
a30de4
+          (match res with
a30de4
+           | "" -> None
a30de4
+           | _ -> Some res)
a30de4
         | MethodPerlBootloader ->
a30de4
           let cmd =
a30de4
             [| "/usr/bin/perl"; "-MBootloader::Tools"; "-e"; "
a30de4
-- 
a30de4
2.14.3
a30de4