On 05/27/2015 01:30 PM, Lubomir Rintel wrote:
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.
ACK.
This patch also makes bonds more consistent with bridges, which also
require the <bridge> element, but allow it to be empty.
Since this is a bugfix and straightforward, I'm pushing it now (after
adding a small bit to the commit log, and changing "ret" initialization
from 0 to -1, so that it's more in line with the rest of libvirt's
code), and will be looking at the netcf patch momentarily.
Thanks for taking the time to report this error with a patch :-)
Signed-off-by: Lubomir Rintel <lkundrak(a)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;