[PATCH] virt-image: catch ParserException and CapabilitiesParserException

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 14, 2008 at 10:18:45AM +0200, Guido Günther wrote:
> attached is a patch that sets the correct mac address type when using
> virt-clone. It continues to use the Xen prefix for unknown hypervisors
> but uses the correct one for kvm/qemu. I also added some doctest.
Here's another minor cleanup patch that fell out when fixing up some
bugs against Debian's virtimage package. It tries to be a bit more
helpful than the python exceptions in virt-image. 
Cheers,
 -- Guido
# HG changeset patch
# User Guido Guenther <agx@xxxxxxxxxxx>
# Date 1218805289 -7200
# Branch cleanups
# Node ID 11c96871c497a6f0cc8e8ea96d379c97ece6c738
# Parent  e4e571fb4bc0dab4eecd29fcb2601f563eeb82ee
catch ParserException and CapabilitiesParserException

diff -r e4e571fb4bc0 -r 11c96871c497 virt-image
--- a/virt-image	Fri Aug 15 14:47:48 2008 +0200
+++ b/virt-image	Fri Aug 15 15:01:29 2008 +0200
@@ -161,8 +161,14 @@
     conn = cli.getConnection(options.connect)
     type = None
 
-    image = virtinst.ImageParser.parse_file(options.image)
-    capabilities = virtinst.CapabilitiesParser.parse(conn.getCapabilities())
+    try:
+    	image = virtinst.ImageParser.parse_file(options.image)
+    except virtinst.ImageParser.ParserException, msg:
+        fail( "%s '%s': %s" % (_("Cannot parse"),  options.image, msg))
+    try:
+        capabilities = virtinst.CapabilitiesParser.parse(conn.getCapabilities())
+    except virtinst.CapabilitiesParser.CapabilitiesParserException, msg:
+        fail( "%s : %s" % (_("Cannot parse capabilities"),  msg))
 
     if options.boot is not None:
         nboots = len(image.domain.boots)
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux