[libvirt] PATCH: Fix error reporting for guest with missing network

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

 



If you attempt to create a Xen guest using a virutal network that does not
exist, or is not running you get a cryptic message

# virsh create rhel5pv.xml
error: Failed to create domain from rhel5pv.xml
error: XML description for failed to build sexpr is not well formed or invalid

This is because the XenD/XM drivers are both overwriting errors that have
already been reported. The fix is simply to remove this bogus error call.
It also tweaks the original error reporting to be more meaningful.

The result is this

# virsh create rhel5pv.xml
error: Failed to create domain from rhel5pv.xml
error: Network not found: default

Daniel

diff -r 28e19af5b719 src/xend_internal.c
--- a/src/xend_internal.c	Tue Mar 31 15:13:21 2009 +0100
+++ b/src/xend_internal.c	Tue Mar 31 16:35:41 2009 +0100
@@ -3983,8 +3983,6 @@ xenDaemonCreateXML(virConnectPtr conn, c
         return (NULL);
 
     if (!(sexpr = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion))) {
-        virXendError(conn, VIR_ERR_XML_ERROR,
-                     "%s", _("failed to build sexpr"));
         virDomainDefFree(def);
         return (NULL);
     }
@@ -5362,7 +5360,7 @@ xenDaemonFormatSxprNet(virConnectPtr con
         char *bridge;
 
         if (!network) {
-            virXendError(conn, VIR_ERR_NO_SOURCE, "%s",
+            virXendError(conn, VIR_ERR_NO_NETWORK, "%s",
                          def->data.network.name);
             return -1;
         }
@@ -5370,7 +5368,8 @@ xenDaemonFormatSxprNet(virConnectPtr con
         bridge = virNetworkGetBridgeName(network);
         virNetworkFree(network);
         if (!bridge) {
-            virXendError(conn, VIR_ERR_NO_SOURCE, "%s",
+            virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                         _("network %s is not active"),
                          def->data.network.name);
             return -1;
         }
diff -r 28e19af5b719 src/xm_internal.c
--- a/src/xm_internal.c	Tue Mar 31 15:13:21 2009 +0100
+++ b/src/xm_internal.c	Tue Mar 31 16:35:41 2009 +0100
@@ -1818,11 +1818,8 @@ int xenXMDomainCreate(virDomainPtr domai
     if (!(entry = virHashLookup(priv->configCache, filename)))
         goto error;
 
-    if (!(sexpr = xenDaemonFormatSxpr(domain->conn, entry->def, priv->xendConfigVersion))) {
-        xenXMError(domain->conn, VIR_ERR_XML_ERROR,
-                   "%s", _("failed to build sexpr"));
+    if (!(sexpr = xenDaemonFormatSxpr(domain->conn, entry->def, priv->xendConfigVersion)))
         goto error;
-    }
 
     ret = xenDaemonDomainCreateXML(domain->conn, sexpr);
     VIR_FREE(sexpr);

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]