On 05/28/2015 04:36 PM, Laine Stump wrote:
From: Lubomir Rintel <lkundrak(a)v3.sk>
The missing element makes libvirt sad:
A perfect comment on the error message given by libvirt :-)
$ ncftool dumpxml --live nm-bond
<?xml version="1.0"?>
<interface name="nm-bond" type="bond">
<link state="unknown" speed="0"/>
<protocol family="ipv4">
<ip address="1.2.3.4" prefix="8"/>
</protocol>
</interface>
$ virsh iface-dumpxml nm-bond
error: XML error: bond interface misses the bond element
This is analogous what was done in d32a464c (Always add <bridge> element to
bridge if, even if no physdev is attached) for bridges.
Exactly. ACK. I'll push this as soon as I get clarification on the other
patch. Thanks again for taking the time to figure this out!
---
src/dutil_linux.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/dutil_linux.c b/src/dutil_linux.c
index 0850593..45039cd 100644
--- a/src/dutil_linux.c
+++ b/src/dutil_linux.c
@@ -1049,9 +1049,6 @@ static void add_bond_info_cb(struct nl_object *obj,
|| rtnl_link_get_master(iflink) != cb_data->master_ifindex)
return;
- cb_data->bond = xml_node(cb_data->doc, cb_data->root, "bond");
- ERR_NOMEM(cb_data->bond == NULL, ncf);
-
/* XXX - if we learn where to get bridge "mode" property, set it here */
/* XXX - need to add node like one of these:
@@ -1083,7 +1080,13 @@ static void add_bond_info(struct netcf *ncf,
if (ifindex == RTNL_LINK_NOT_FOUND)
return;
+ cb_data.bond = xml_node(doc, root, "bond");
+ ERR_NOMEM(cb_data.bond == NULL, ncf);
+
nl_cache_foreach(ncf->driver->link_cache, add_bond_info_cb, &cb_data);
+
+error:
+ return;
}