diff --git a/tools/xen/functions b/tools/xen/functions index 261f14fdc2..7146858f7d 100644 --- a/tools/xen/functions +++ b/tools/xen/functions @@ -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 +} diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh index 21aa729c0c..6eb30130cd 100755 --- a/tools/xen/install_os_domU.sh +++ b/tools/xen/install_os_domU.sh @@ -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 \ diff --git a/tools/xen/xenrc b/tools/xen/xenrc index 97c0930e4f..03b30ac55e 100644 --- a/tools/xen/xenrc +++ b/tools/xen/xenrc @@ -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