xenapi: xe network-attach for OVS bridge creation
For Neutron we need an additional OVS bridge to be present. The xe
network-create command did not create the bridge immediately. A
workaround was applied to attach a network interface to that network,
forcing xapi to create the underlying OVS bridge. It turned out, that
the xe network-attach command could be used instead, so the workaround
is removed and replaced with the proper solution by this patch.
Fixes bug 1197305
Change-Id: I10cc763531b71238f0bc12a12de985f8f35d7e27
diff --git a/tools/xen/functions b/tools/xen/functions
index 4e37554..fd14075 100644
--- a/tools/xen/functions
+++ b/tools/xen/functions
@@ -250,3 +250,21 @@
done
unset IFS
}
+
+function have_multiple_hosts() {
+ xe host-list --minimal | grep -q ","
+}
+
+function attach_network() {
+ local bridge_or_net_name
+
+ bridge_or_net_name="$1"
+
+ local net
+ local host
+
+ net=$(_network_uuid "$bridge_or_net_name")
+ host=$(xe host-list --minimal)
+
+ xe network-attach uuid=$net host-uuid=$host
+}