mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
interface: move parsing of bridge attributes into appropriate function
For some reason the bridge stp mode and delay were put directly into the "bridge" case of the switch in virInterfaceDefParseXML(), although they are inside the <bridge> element, and so should be parsed in the function created for that purpose - virInterfaceBridgeDefFormat().
This commit is contained in:
parent
69db5f921a
commit
7edc46ac26
@ -487,11 +487,27 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def,
|
|||||||
xmlNodePtr *interfaces = NULL;
|
xmlNodePtr *interfaces = NULL;
|
||||||
xmlNodePtr bridge;
|
xmlNodePtr bridge;
|
||||||
virInterfaceDefPtr itf;
|
virInterfaceDefPtr itf;
|
||||||
|
char *tmp = NULL;
|
||||||
int nbItf;
|
int nbItf;
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
bridge = ctxt->node;
|
bridge = ctxt->node;
|
||||||
|
def->data.bridge.stp = -1;
|
||||||
|
if ((tmp = virXMLPropString(bridge, "stp"))) {
|
||||||
|
if (STREQ(tmp, "on")) {
|
||||||
|
def->data.bridge.stp = 1;
|
||||||
|
} else if (STREQ(tmp, "off")) {
|
||||||
|
def->data.bridge.stp = 0;
|
||||||
|
} else {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
|
_("bridge interface stp should be on or off got %s"),
|
||||||
|
tmp);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def->data.bridge.delay = virXMLPropString(bridge, "delay");
|
||||||
|
|
||||||
nbItf = virXPathNodeSet("./interface", ctxt, &interfaces);
|
nbItf = virXPathNodeSet("./interface", ctxt, &interfaces);
|
||||||
if (nbItf < 0) {
|
if (nbItf < 0) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -517,6 +533,7 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
VIR_FREE(tmp);
|
||||||
VIR_FREE(interfaces);
|
VIR_FREE(interfaces);
|
||||||
ctxt->node = bridge;
|
ctxt->node = bridge;
|
||||||
return ret;
|
return ret;
|
||||||
@ -751,23 +768,6 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType)
|
|||||||
"%s", _("bridge interface misses the bridge element"));
|
"%s", _("bridge interface misses the bridge element"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
tmp = virXMLPropString(bridge, "stp");
|
|
||||||
def->data.bridge.stp = -1;
|
|
||||||
if (tmp != NULL) {
|
|
||||||
if (STREQ(tmp, "on")) {
|
|
||||||
def->data.bridge.stp = 1;
|
|
||||||
} else if (STREQ(tmp, "off")) {
|
|
||||||
def->data.bridge.stp = 0;
|
|
||||||
} else {
|
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
|
||||||
_("bridge interface stp should be on or off got %s"),
|
|
||||||
tmp);
|
|
||||||
VIR_FREE(tmp);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
VIR_FREE(tmp);
|
|
||||||
}
|
|
||||||
def->data.bridge.delay = virXMLPropString(bridge, "delay");
|
|
||||||
ctxt->node = bridge;
|
ctxt->node = bridge;
|
||||||
if (virInterfaceDefParseBridge(def, ctxt) < 0)
|
if (virInterfaceDefParseBridge(def, ctxt) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user