v2v: ignore missing kernels from grub (RHBZ#1230412)

Raise a warning for each kernel specified in grub which does not
actually exist, keep going on with the conversion using the remaining
(existing) kernels.
This commit is contained in:
Pino Toscano
2015-08-24 18:25:10 +02:00
parent baa4ec6e45
commit 74f0b45ddf

View File

@@ -364,7 +364,14 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source =
statbuf.G.st_dev = s.G.st_dev && statbuf.G.st_ino = s.G.st_ino
) installed_kernels in
Some kernel
with Not_found -> None
with
| Not_found -> None
| G.Error msg as exn ->
(* If it isn't "no such file or directory", then re-raise it. *)
if g#last_errno () <> G.Errno.errno_ENOENT then raise exn;
warning (f_"ignoring kernel %s in grub, as it does not exist.")
vmlinuz;
None
) vmlinuzes in
if verbose () then (