From cfe1eb87f7f152ab5d6456ef8ecd7aab38d376fa Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 27 May 2015 19:30:25 +0200 Subject: [PATCH 1/2] linux: include element for bonds with no slaves The missing element makes libvirt sad: $ ncftool dumpxml --live nm-bond $ virsh iface-dumpxml nm-bond error: XML error: bond interface misses the bond element This is analogous what was done in d32a464c (Always add element to bridge if, even if no physdev is attached) for bridges. --- 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 24f4d95..022eed0 100644 --- a/src/dutil_linux.c +++ b/src/dutil_linux.c @@ -1055,9 +1055,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: @@ -1089,7 +1086,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; } -- 2.4.3