mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

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