[libvirt] [PATCH] conf/interface_conf.c: allow "yes" and "no" for STP

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

On Fri, Nov 15, 2013 at 06:44:02PM +0100, Martin Wilck wrote:
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".
The XML schema does not care what values the brctl tool exposes. It standardizes on on & off for values. Whatever tool is creating this XML (netcf I guess) should translate from the values brctl uses to what the XML requires. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Martin Wilck