提交 86304e35 编写于 作者: L Laine Stump 提交者: Matthias Bolte

Allow empty bridges in interface xml.

上级 d22591ef
...@@ -557,28 +557,30 @@ virInterfaceDefParseBridge(virConnectPtr conn, virInterfaceDefPtr def, ...@@ -557,28 +557,30 @@ virInterfaceDefParseBridge(virConnectPtr conn, virInterfaceDefPtr def,
bridge = ctxt->node; bridge = ctxt->node;
nbItf = virXPathNodeSet(conn, "./interface", ctxt, &interfaces); nbItf = virXPathNodeSet(conn, "./interface", ctxt, &interfaces);
if (nbItf <= 0) { if (nbItf < 0) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR, virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("bridge has no interfaces")); "%s", _("bridge interfaces"));
ret = -1; ret = -1;
goto error; goto error;
} }
if (VIR_ALLOC_N(def->data.bridge.itf, nbItf) < 0) { if (nbItf > 0) {
virReportOOMError(conn); if (VIR_ALLOC_N(def->data.bridge.itf, nbItf) < 0) {
ret = -1; virReportOOMError(conn);
goto error;
}
def->data.bridge.nbItf = nbItf;
for (i = 0; i < nbItf;i++) {
ctxt->node = interfaces[i];
itf = virInterfaceDefParseBareInterface(conn, ctxt, 0);
if (itf == NULL) {
ret = -1; ret = -1;
def->data.bridge.nbItf = i;
goto error; goto error;
} }
def->data.bridge.itf[i] = itf; def->data.bridge.nbItf = nbItf;
for (i = 0; i < nbItf;i++) {
ctxt->node = interfaces[i];
itf = virInterfaceDefParseBareInterface(conn, ctxt, 0);
if (itf == NULL) {
ret = -1;
def->data.bridge.nbItf = i;
goto error;
}
def->data.bridge.itf[i] = itf;
}
} }
error: error:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册