[netcf-devel] [PATCH] Always add <bridge> element to bridge if, even if no physdev is attached
Laine Stump
laine at laine.org
Sun Jun 26 20:04:30 UTC 2011
This patch resolves the following bug filed against RHEL:
https://bugzilla.redhat.com/show_bug.cgi?id=713180
If a bridge has no physical devices attached, ncf_if_xml_state() had
not been adding a <bridge> element to the returned XML. However,
<bridge> is required by the grammer if the interface is of
type="bridge" (even if it's empty), and libvirt enforces that.
The solution is to add in the <bridge> element *before* checking to
see if there are any physical devices attached.
---
src/dutil_linux.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/dutil_linux.c b/src/dutil_linux.c
index 0979a40..841c2a1 100644
--- a/src/dutil_linux.c
+++ b/src/dutil_linux.c
@@ -1022,13 +1022,16 @@ static void add_bridge_info(struct netcf *ncf,
int nphys, ii;
xmlNodePtr bridge_node = NULL, interface_node = NULL;
+ /* The <bridge> element is required by the grammar, so always add
+ * it, even if there are no physical devices attached.
+ */
+ bridge_node = xml_node(doc, root, "bridge");
+ ERR_NOMEM(bridge_node == NULL, ncf);
+
nphys = if_bridge_phys_name(ncf, ifname, &phys_names);
if (nphys <= 0)
return;
- bridge_node = xml_node(doc, root, "bridge");
- ERR_NOMEM(bridge_node == NULL, ncf);
-
for (ii = 0; ii < nphys; ii++) {
int phys_ifindex;
--
1.7.3.4
More information about the netcf-devel
mailing list