[libvirt] [PATCH libvirt] interface: don't error out if a bond has no interfaces

Lubomir Rintel lkundrak at v3.sk
Wed May 27 17:30:50 UTC 2015


It's not a problem at all and causes virt-manager to break down.

Note: netcf 0.2.8 generates invalid XML for a bond with no interfaces anyway,
so this error is in fact not reached as we fail earlier. Fix submitted upstream.

Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
---
 src/conf/interface_conf.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index c2eb945..29769ac 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -553,19 +553,15 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
     nbItf = virXPathNodeSet("./interface", ctxt, &interfaces);
     if (nbItf < 0) {
         ret = -1;
-        goto error;
+        goto cleanup;
     }
 
-    if (nbItf == 0) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       "%s", _("bond has no interfaces"));
-        ret = -1;
-        goto error;
-    }
+    if (nbItf == 0)
+        goto cleanup;
 
     if (VIR_ALLOC_N(def->data.bond.itf, nbItf) < 0) {
         ret = -1;
-        goto error;
+        goto cleanup;
     }
     def->data.bond.nbItf = nbItf;
 
@@ -575,12 +571,12 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
         if (itf == NULL) {
             ret = -1;
             def->data.bond.nbItf = i;
-            goto error;
+            goto cleanup;
         }
         def->data.bond.itf[i] = itf;
     }
 
- error:
+ cleanup:
     VIR_FREE(interfaces);
     ctxt->node = bond;
     return ret;
-- 
2.4.1




More information about the libvir-list mailing list