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