Blame SOURCES/netcf-linux-include-bond-element-for-bonds-with-no-slaves.patch

ff66b3
From cfe1eb87f7f152ab5d6456ef8ecd7aab38d376fa Mon Sep 17 00:00:00 2001
ff66b3
From: Lubomir Rintel <lkundrak@v3.sk>
ff66b3
Date: Wed, 27 May 2015 19:30:25 +0200
ff66b3
Subject: [PATCH 1/2] linux: include <bond> element for bonds with no slaves
ff66b3
ff66b3
The missing element makes libvirt sad:
ff66b3
ff66b3
  $ ncftool dumpxml --live nm-bond
ff66b3
  
ff66b3
  <interface name="nm-bond" type="bond">
ff66b3
    <link state="unknown" speed="0"/>
ff66b3
    <protocol family="ipv4">
ff66b3
      <ip address="1.2.3.4" prefix="8"/>
ff66b3
    </protocol>
ff66b3
  </interface>
ff66b3
ff66b3
  $ virsh iface-dumpxml nm-bond
ff66b3
  error: XML error: bond interface misses the bond element
ff66b3
ff66b3
This is analogous what was done in d32a464c (Always add <bridge> element to
ff66b3
bridge if, even if no physdev is attached) for bridges.
ff66b3
---
ff66b3
 src/dutil_linux.c | 9 ++++++---
ff66b3
 1 file changed, 6 insertions(+), 3 deletions(-)
ff66b3
ff66b3
diff --git a/src/dutil_linux.c b/src/dutil_linux.c
ff66b3
index 24f4d95..022eed0 100644
ff66b3
--- a/src/dutil_linux.c
ff66b3
+++ b/src/dutil_linux.c
ff66b3
@@ -1055,9 +1055,6 @@ static void add_bond_info_cb(struct nl_object *obj,
ff66b3
         || rtnl_link_get_master(iflink) != cb_data->master_ifindex)
ff66b3
         return;
ff66b3
 
ff66b3
-    cb_data->bond = xml_node(cb_data->doc, cb_data->root, "bond");
ff66b3
-    ERR_NOMEM(cb_data->bond == NULL, ncf);
ff66b3
-
ff66b3
     /* XXX - if we learn where to get bridge "mode" property, set it here */
ff66b3
 
ff66b3
     /* XXX - need to add node like one of these:
ff66b3
@@ -1089,7 +1086,13 @@ static void add_bond_info(struct netcf *ncf,
ff66b3
     if (ifindex == RTNL_LINK_NOT_FOUND)
ff66b3
         return;
ff66b3
 
ff66b3
+    cb_data.bond = xml_node(doc, root, "bond");
ff66b3
+    ERR_NOMEM(cb_data.bond == NULL, ncf);
ff66b3
+
ff66b3
     nl_cache_foreach(ncf->driver->link_cache, add_bond_info_cb, &cb_data);
ff66b3
+
ff66b3
+error:
ff66b3
+    return;
ff66b3
 }
ff66b3
 
ff66b3
 
ff66b3
-- 
ff66b3
2.4.3
ff66b3