mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0214-v2v-ignore-missing-kernels-from-grub-RHBZ-1230412.patch

ffd6ed
From 7f13b7cbc515fbd9af4c28ae184f3e66ce573d63 Mon Sep 17 00:00:00 2001
ffd6ed
From: Pino Toscano <ptoscano@redhat.com>
ffd6ed
Date: Mon, 24 Aug 2015 18:25:10 +0200
ffd6ed
Subject: [PATCH] v2v: ignore missing kernels from grub (RHBZ#1230412)
ffd6ed
ffd6ed
Raise a warning for each kernel specified in grub which does not
ffd6ed
actually exist, keep going on with the conversion using the remaining
ffd6ed
(existing) kernels.
ffd6ed
ffd6ed
(cherry picked from commit 74f0b45ddf35f1cb1684702e9d3318d77fc3b520)
ffd6ed
---
ffd6ed
 v2v/convert_linux.ml | 9 ++++++++-
ffd6ed
 1 file changed, 8 insertions(+), 1 deletion(-)
ffd6ed
ffd6ed
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
ffd6ed
index c110825..19cdabc 100644
ffd6ed
--- a/v2v/convert_linux.ml
ffd6ed
+++ b/v2v/convert_linux.ml
ffd6ed
@@ -357,7 +357,14 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
ffd6ed
                 statbuf.G.st_dev = s.G.st_dev && statbuf.G.st_ino = s.G.st_ino
ffd6ed
             ) installed_kernels in
ffd6ed
           Some kernel
ffd6ed
-        with Not_found -> None
ffd6ed
+        with
ffd6ed
+        | Not_found -> None
ffd6ed
+        | G.Error msg as exn ->
ffd6ed
+          (* If it isn't "no such file or directory", then re-raise it. *)
ffd6ed
+          if g#last_errno () <> G.Errno.errno_ENOENT then raise exn;
ffd6ed
+          warning ~prog (f_"ignoring kernel %s in grub, as it does not exist.")
ffd6ed
+            vmlinuz;
ffd6ed
+          None
ffd6ed
     ) vmlinuzes in
ffd6ed
 
ffd6ed
   if verbose then (
ffd6ed
-- 
ffd6ed
1.8.3.1
ffd6ed