xenapi: Cleanup networking
OpenStack VM had 4 interfaces, from which eth0 was connected to HIMN (Host
Internal Management Network), and not used at all. The reason for not
using this interface according to johngarbutt is:
- VNC console would not work
- migrations would not work
- many other things
This change removes the interface, thus devstack is providing the
same architecture as described in the official documentation, YAGNI
applied on the HIMN:
http://goo.gl/dmrNF
The change also modifies some defaults, so it's easier to get started:
- The Ubuntu VM is network-installed through the management network
- OS VM is getting its address on the management network through DHCP
- Default Public IP addresses aligned to stack.sh defaults
- OS Services are listening on Management Interface
Related to blueprint xenapi-devstack-cleanup
Change-Id: I73c9751ade6f4786b8b682a1994cb87f0a624379
diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh
index a744869..be4aa16 100755
--- a/tools/xen/install_os_domU.sh
+++ b/tools/xen/install_os_domU.sh
@@ -238,6 +238,15 @@
vm_uuid=$(xe vm-install template="$TNAME" new-name-label="$GUEST_NAME")
fi
+## Setup network cards
+# Wipe out all
+destroy_all_vifs_of "$GUEST_NAME"
+# Tenant network
+add_interface "$GUEST_NAME" "$VM_BRIDGE_OR_NET_NAME" "$VM_DEV_NR"
+# Management network
+add_interface "$GUEST_NAME" "$MGT_BRIDGE_OR_NET_NAME" "$MGT_DEV_NR"
+# Public network
+add_interface "$GUEST_NAME" "$PUB_BRIDGE_OR_NET_NAME" "$PUB_DEV_NR"
#
# Inject DevStack inside VM disk
@@ -248,7 +257,7 @@
# is created by XenServer). This is required for Quantum. Also pass that as a
# kernel parameter for DomU
if is_service_enabled quantum; then
- add_interface "$GUEST_NAME" "$XEN_INT_BRIDGE_OR_NET_NAME" "4"
+ add_interface "$GUEST_NAME" "$XEN_INT_BRIDGE_OR_NET_NAME" $XEN_INT_DEV_NR
XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME")
append_kernel_cmdline \
@@ -275,19 +284,19 @@
# Get hold of the Management IP of OpenStack VM
OS_VM_MANAGEMENT_ADDRESS=$MGT_IP
if [ $OS_VM_MANAGEMENT_ADDRESS == "dhcp" ]; then
- OS_VM_MANAGEMENT_ADDRESS=$(find_ip_by_name $GUEST_NAME 2)
+ OS_VM_MANAGEMENT_ADDRESS=$(find_ip_by_name $GUEST_NAME $MGT_DEV_NR)
fi
# Get hold of the Service IP of OpenStack VM
-if [ $HOST_IP_IFACE == "eth2" ]; then
+if [ $HOST_IP_IFACE == "eth${MGT_DEV_NR}" ]; then
OS_VM_SERVICES_ADDRESS=$MGT_IP
if [ $MGT_IP == "dhcp" ]; then
- OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME 2)
+ OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME $MGT_DEV_NR)
fi
else
OS_VM_SERVICES_ADDRESS=$PUB_IP
if [ $PUB_IP == "dhcp" ]; then
- OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME 3)
+ OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME $PUB_DEV_NR)
fi
fi