[Pkg-libvirt-commits] [libguestfs] 20/26: v2v: Catch real exception thrown by failing aug_get (RHBZ#1239053).
Hilko Bengen
bengen at moszumanska.debian.org
Sun Nov 1 17:11:29 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag upstream/1.28.12
in repository libguestfs.
commit e1b03798d016fd79e2fffef55dd2d762846e708b
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Mon Jul 6 10:47:45 2015 +0100
v2v: Catch real exception thrown by failing aug_get (RHBZ#1239053).
When converting the old Perl virt-v2v code, I made a silly mistake
with the exception that aug_get throws when it doesn't find any node.
It throws a 'Guestfs.Error' exception, not 'Not_found'.
As a result of this, the exception was escaping and the proper error
message was not displayed. With a malformed grub configuration you
would see this error:
$ virt-v2v -i disk centos-6.img -o null
[...]
virt-v2v: error: libguestfs error: aug_get: no matching node
After applying this patch:
$ virt-v2v -i disk centos-6.img -o null
[...]
virt-v2v: error: no kernels were found in the grub configuration.
This probably indicates that virt-v2v was unable to parse the grub
configuration of this guest.
which is the correct error message.
(cherry picked from commit 659d56db3cc4333e7410cac6720c20b3b7fa66ad)
---
v2v/convert_linux.ml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 378cbad..256b0d3 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -315,7 +315,9 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
let expr =
sprintf "/files%s/title[%d]/kernel" grub_config (idx+1) in
Some expr
- with Not_found -> None in
+ with G.Error msg
+ when string_find msg "aug_get: no matching node" >= 0 ->
+ None in
(* If a default kernel was set, put it at the beginning of the paths
* list. If not set, assume the first kernel always boots (?)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list