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
This commit is contained in:
Mate Lakat 2013-07-03 10:44:44 +01:00
parent cf6d809d8d
commit d8511034e6
3 changed files with 28 additions and 2 deletions

View File

@ -250,3 +250,21 @@ function destroy_all_vifs_of()
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
}

View File

@ -50,6 +50,15 @@ xe_min()
cd $THIS_DIR
# Die if multiple hosts listed
if have_multiple_hosts; then
cat >&2 << EOF
ERROR: multiple hosts found. This might mean that the XenServer is a member
of a pool - Exiting.
EOF
exit 1
fi
# Install plugins
## Nova plugins
@ -256,7 +265,7 @@ $THIS_DIR/build_xva.sh "$GUEST_NAME"
# is created by XenServer). This is required for Neutron. Also pass that as a
# kernel parameter for DomU
if is_service_enabled neutron; then
add_interface "$GUEST_NAME" "$XEN_INT_BRIDGE_OR_NET_NAME" $XEN_INT_DEV_NR
attach_network "$XEN_INT_BRIDGE_OR_NET_NAME"
XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME")
append_kernel_cmdline \

View File

@ -35,7 +35,6 @@ GUEST_PASSWORD=${GUEST_PASSWORD:-secrete}
MGT_DEV_NR=0
VM_DEV_NR=1
PUB_DEV_NR=2
XEN_INT_DEV_NR=3
# Host Interface, i.e. the interface on the nova vm you want to expose the
# services on. Usually the device connected to the management network or the