The error message "XML error: bridge stp shold be on or off got yes"
is displayed after configuring a bridge interface with NetworkManager
(Fedora 19).
Reported as:
https://bugzilla.redhat.com/show_bug.cgi?id=1031053
Problem description from BZ:
Steps to Reproduce:
1. create bridge configuration with NetworkManager
2. run virt-manager and open "Network Interfaces" tab in localhost
connection details, or run virt-install
Actual results:
"XML error: bridge stp shold be on or off got yes"
Expected results:
No error message
Additional info:
NM puts "yes" or "no" in the ifcfg file depending on the user STP
setting:
# grep STP /etc/sysconfig/network-scripts/ifcfg-br0
STP=no
the brctl tool accepts both "on"/"off" and
"yes"/"no". But libvirt handles only "on" and
"off".
---
src/conf/interface_conf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 7ca9c86..f13fef9 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -741,9 +741,9 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) {
tmp = virXMLPropString(bridge, "stp");
def->data.bridge.stp = -1;
if (tmp != NULL) {
- if (STREQ(tmp, "on")) {
+ if (STREQ(tmp, "on") || STREQ(tmp, "yes")) {
def->data.bridge.stp = 1;
- } else if (STREQ(tmp, "off")) {
+ } else if (STREQ(tmp, "off") || STREQ(tmp, "no")) {
def->data.bridge.stp = 0;
} else {
virReportError(VIR_ERR_XML_ERROR,
--
1.8.3.1