| ... | ... |
@@ -77,7 +77,7 @@ SPICE_DIR=$DEST/spice-html5 |
| 77 | 77 |
|
| 78 | 78 |
# Set defaults according to the virt driver |
| 79 | 79 |
if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
| 80 |
- PUBLIC_INTERFACE_DEFAULT=eth3 |
|
| 80 |
+ PUBLIC_INTERFACE_DEFAULT=eth2 |
|
| 81 | 81 |
GUEST_INTERFACE_DEFAULT=eth1 |
| 82 | 82 |
# Allow ``build_domU.sh`` to specify the flat network bridge via kernel args |
| 83 | 83 |
FLAT_NETWORK_BRIDGE_DEFAULT=$(sed -e 's/.* flat_network_bridge=\([[:alnum:]]*\).*$/\1/g' /proc/cmdline) |
| ... | ... |
@@ -1001,6 +1001,9 @@ if is_service_enabled nova; then |
| 1001 | 1001 |
|
| 1002 | 1002 |
if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
| 1003 | 1003 |
echo_summary "Using XenServer virtualization driver" |
| 1004 |
+ if [ -z "$XENAPI_CONNECTION_URL" ]; then |
|
| 1005 |
+ die $LINENO "XENAPI_CONNECTION_URL is not specified" |
|
| 1006 |
+ fi |
|
| 1004 | 1007 |
read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN." |
| 1005 | 1008 |
iniset $NOVA_CONF DEFAULT compute_driver "xenapi.XenAPIDriver" |
| 1006 | 1009 |
iniset $NOVA_CONF DEFAULT xenapi_connection_url "$XENAPI_CONNECTION_URL" |
| ... | ... |
@@ -34,6 +34,13 @@ The `install_os_domU.sh` script will: |
| 34 | 34 |
`eth0`. |
| 35 | 35 |
- eth3 - Public interface, connected to `PUB_BRIDGE_OR_NET_NAME` defaults to |
| 36 | 36 |
`"OpenStack Public Network"`. |
| 37 |
+ - After the Ubuntu install process finished, the network configuration is |
|
| 38 |
+ modified to: |
|
| 39 |
+ - eth0 - Management interface, connected to `MGT_BRIDGE_OR_NET_NAME` |
|
| 40 |
+ - eth1 - VM interface, connected to `VM_BRIDGE_OR_NET_NAME` |
|
| 41 |
+ - eth2 - Public interface, connected to `PUB_BRIDGE_OR_NET_NAME` |
|
| 42 |
+ - (eth3) - Optional network interface if quantum is used, to enforce xapi to |
|
| 43 |
+ create the underlying bridge. |
|
| 37 | 44 |
- Start devstack inside the created OpenStack VM |
| 38 | 45 |
|
| 39 | 46 |
## Step 1: Install Xenserver |
| ... | ... |
@@ -92,30 +99,12 @@ Of course, use real passwords if this machine is exposed. |
| 92 | 92 |
MULTI_HOST=1 |
| 93 | 93 |
# Give extra time for boot |
| 94 | 94 |
ACTIVE_TIMEOUT=45 |
| 95 |
- # Host Interface, i.e. the interface on the OpenStack vm you want to expose |
|
| 96 |
- # the services on. The default is eth3, which means the public network, but |
|
| 97 |
- # as the public network is going to be virtual, we are setting the services |
|
| 98 |
- # to listen on the management network, which defaults to 'xenbr0', the |
|
| 99 |
- # XenServer's network. |
|
| 100 |
- HOST_IP_IFACE=eth2 |
|
| 101 |
- |
|
| 102 |
- # Use DHCP server to configure the Management IP of OpenStack VM |
|
| 103 |
- MGT_IP="dhcp" |
|
| 104 | 95 |
|
| 105 | 96 |
# Settings for netinstalling Ubuntu |
| 106 | 97 |
UBUNTU_INST_RELEASE=precise |
| 107 | 98 |
|
| 108 |
- # First time Ubuntu network install params, use the DHCP server on the |
|
| 109 |
- # management network |
|
| 110 |
- UBUNTU_INST_IFACE="eth2" |
|
| 111 |
- UBUNTU_INST_IP="dhcp" |
|
| 112 |
- |
|
| 113 | 99 |
# NOTE: the value of FLAT_NETWORK_BRIDGE will automatically be determined |
| 114 | 100 |
# by install_os_domU.sh script. |
| 115 |
- |
|
| 116 |
- # Public IP address is aligned with the devstack defaults (see FLOATING_RANGE) |
|
| 117 |
- PUB_IP=172.24.4.10 |
|
| 118 |
- PUB_NETMASK=255.255.255.0 |
|
| 119 | 101 |
EOF |
| 120 | 102 |
|
| 121 | 103 |
## Step 4: Run `./install_os_domU.sh` from the `tools/xen` directory |
| ... | ... |
@@ -32,6 +32,41 @@ source xenrc |
| 32 | 32 |
# |
| 33 | 33 |
GUEST_NAME="$1" |
| 34 | 34 |
|
| 35 |
+function _print_interface_config() {
|
|
| 36 |
+ local device_nr |
|
| 37 |
+ local ip_address |
|
| 38 |
+ local netmask |
|
| 39 |
+ |
|
| 40 |
+ device_nr="$1" |
|
| 41 |
+ ip_address="$2" |
|
| 42 |
+ netmask="$3" |
|
| 43 |
+ |
|
| 44 |
+ local device |
|
| 45 |
+ |
|
| 46 |
+ device="eth${device_nr}"
|
|
| 47 |
+ |
|
| 48 |
+ echo "auto $device" |
|
| 49 |
+ if [ $ip_address == "dhcp" ]; then |
|
| 50 |
+ echo "iface $device inet dhcp" |
|
| 51 |
+ else |
|
| 52 |
+ echo "iface $device inet static" |
|
| 53 |
+ echo " address $ip_address" |
|
| 54 |
+ echo " netmask $netmask" |
|
| 55 |
+ fi |
|
| 56 |
+ |
|
| 57 |
+ # Turn off tx checksumming for better performance |
|
| 58 |
+ echo " post-up ethtool -K $device tx off" |
|
| 59 |
+} |
|
| 60 |
+ |
|
| 61 |
+function print_interfaces_config() {
|
|
| 62 |
+ echo "auto lo" |
|
| 63 |
+ echo "iface lo inet loopback" |
|
| 64 |
+ |
|
| 65 |
+ _print_interface_config $PUB_DEV_NR $PUB_IP $PUB_NETMASK |
|
| 66 |
+ _print_interface_config $VM_DEV_NR $VM_IP $VM_NETMASK |
|
| 67 |
+ _print_interface_config $MGT_DEV_NR $MGT_IP $MGT_NETMASK |
|
| 68 |
+} |
|
| 69 |
+ |
|
| 35 | 70 |
# |
| 36 | 71 |
# Mount the VDI |
| 37 | 72 |
# |
| ... | ... |
@@ -81,42 +116,7 @@ $HOSTS_FILE_IP $GUEST_NAME |
| 81 | 81 |
EOF |
| 82 | 82 |
|
| 83 | 83 |
# Configure the network |
| 84 |
-INTERFACES=$STAGING_DIR/etc/network/interfaces |
|
| 85 |
-TEMPLATES_DIR=$TOP_DIR/templates |
|
| 86 |
-cp $TEMPLATES_DIR/interfaces.in $INTERFACES |
|
| 87 |
-if [ $VM_IP == "dhcp" ]; then |
|
| 88 |
- echo 'eth1 on dhcp' |
|
| 89 |
- sed -e "s,iface eth1 inet static,iface eth1 inet dhcp,g" -i $INTERFACES |
|
| 90 |
- sed -e '/@ETH1_/d' -i $INTERFACES |
|
| 91 |
-else |
|
| 92 |
- sed -e "s,@ETH1_IP@,$VM_IP,g" -i $INTERFACES |
|
| 93 |
- sed -e "s,@ETH1_NETMASK@,$VM_NETMASK,g" -i $INTERFACES |
|
| 94 |
-fi |
|
| 95 |
- |
|
| 96 |
-if [ $MGT_IP == "dhcp" ]; then |
|
| 97 |
- echo 'eth2 on dhcp' |
|
| 98 |
- sed -e "s,iface eth2 inet static,iface eth2 inet dhcp,g" -i $INTERFACES |
|
| 99 |
- sed -e '/@ETH2_/d' -i $INTERFACES |
|
| 100 |
-else |
|
| 101 |
- sed -e "s,@ETH2_IP@,$MGT_IP,g" -i $INTERFACES |
|
| 102 |
- sed -e "s,@ETH2_NETMASK@,$MGT_NETMASK,g" -i $INTERFACES |
|
| 103 |
-fi |
|
| 104 |
- |
|
| 105 |
-if [ $PUB_IP == "dhcp" ]; then |
|
| 106 |
- echo 'eth3 on dhcp' |
|
| 107 |
- sed -e "s,iface eth3 inet static,iface eth3 inet dhcp,g" -i $INTERFACES |
|
| 108 |
- sed -e '/@ETH3_/d' -i $INTERFACES |
|
| 109 |
-else |
|
| 110 |
- sed -e "s,@ETH3_IP@,$PUB_IP,g" -i $INTERFACES |
|
| 111 |
- sed -e "s,@ETH3_NETMASK@,$PUB_NETMASK,g" -i $INTERFACES |
|
| 112 |
-fi |
|
| 113 |
- |
|
| 114 |
-if [ "$ENABLE_GI" == "true" ]; then |
|
| 115 |
- cat <<EOF >>$INTERFACES |
|
| 116 |
-auto eth0 |
|
| 117 |
-iface eth0 inet dhcp |
|
| 118 |
-EOF |
|
| 119 |
-fi |
|
| 84 |
+print_interfaces_config > $STAGING_DIR/etc/network/interfaces |
|
| 120 | 85 |
|
| 121 | 86 |
# Gracefully cp only if source file/dir exists |
| 122 | 87 |
function cp_it {
|
| ... | ... |
@@ -224,3 +224,19 @@ function append_kernel_cmdline() |
| 224 | 224 |
pv_args=$(xe vm-param-get param-name=PV-args uuid=$vm) |
| 225 | 225 |
xe vm-param-set PV-args="$pv_args $kernel_args" uuid=$vm |
| 226 | 226 |
} |
| 227 |
+ |
|
| 228 |
+function destroy_all_vifs_of() |
|
| 229 |
+{
|
|
| 230 |
+ local vm_name_label |
|
| 231 |
+ |
|
| 232 |
+ vm_name_label="$1" |
|
| 233 |
+ |
|
| 234 |
+ local vm |
|
| 235 |
+ |
|
| 236 |
+ vm=$(_vm_uuid "$vm_name_label") |
|
| 237 |
+ IFS=, |
|
| 238 |
+ for vif in $(xe vif-list vm-uuid=$vm --minimal); do |
|
| 239 |
+ xe vif-destroy uuid="$vif" |
|
| 240 |
+ done |
|
| 241 |
+ unset IFS |
|
| 242 |
+} |
| ... | ... |
@@ -238,6 +238,15 @@ else |
| 238 | 238 |
vm_uuid=$(xe vm-install template="$TNAME" new-name-label="$GUEST_NAME") |
| 239 | 239 |
fi |
| 240 | 240 |
|
| 241 |
+## Setup network cards |
|
| 242 |
+# Wipe out all |
|
| 243 |
+destroy_all_vifs_of "$GUEST_NAME" |
|
| 244 |
+# Tenant network |
|
| 245 |
+add_interface "$GUEST_NAME" "$VM_BRIDGE_OR_NET_NAME" "$VM_DEV_NR" |
|
| 246 |
+# Management network |
|
| 247 |
+add_interface "$GUEST_NAME" "$MGT_BRIDGE_OR_NET_NAME" "$MGT_DEV_NR" |
|
| 248 |
+# Public network |
|
| 249 |
+add_interface "$GUEST_NAME" "$PUB_BRIDGE_OR_NET_NAME" "$PUB_DEV_NR" |
|
| 241 | 250 |
|
| 242 | 251 |
# |
| 243 | 252 |
# Inject DevStack inside VM disk |
| ... | ... |
@@ -248,7 +257,7 @@ $THIS_DIR/build_xva.sh "$GUEST_NAME" |
| 248 | 248 |
# is created by XenServer). This is required for Quantum. Also pass that as a |
| 249 | 249 |
# kernel parameter for DomU |
| 250 | 250 |
if is_service_enabled quantum; then |
| 251 |
- add_interface "$GUEST_NAME" "$XEN_INT_BRIDGE_OR_NET_NAME" "4" |
|
| 251 |
+ add_interface "$GUEST_NAME" "$XEN_INT_BRIDGE_OR_NET_NAME" $XEN_INT_DEV_NR |
|
| 252 | 252 |
|
| 253 | 253 |
XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME") |
| 254 | 254 |
append_kernel_cmdline \ |
| ... | ... |
@@ -288,19 +297,19 @@ function ssh_no_check() {
|
| 288 | 288 |
# Get hold of the Management IP of OpenStack VM |
| 289 | 289 |
OS_VM_MANAGEMENT_ADDRESS=$MGT_IP |
| 290 | 290 |
if [ $OS_VM_MANAGEMENT_ADDRESS == "dhcp" ]; then |
| 291 |
- OS_VM_MANAGEMENT_ADDRESS=$(find_ip_by_name $GUEST_NAME 2) |
|
| 291 |
+ OS_VM_MANAGEMENT_ADDRESS=$(find_ip_by_name $GUEST_NAME $MGT_DEV_NR) |
|
| 292 | 292 |
fi |
| 293 | 293 |
|
| 294 | 294 |
# Get hold of the Service IP of OpenStack VM |
| 295 |
-if [ $HOST_IP_IFACE == "eth2" ]; then |
|
| 295 |
+if [ $HOST_IP_IFACE == "eth${MGT_DEV_NR}" ]; then
|
|
| 296 | 296 |
OS_VM_SERVICES_ADDRESS=$MGT_IP |
| 297 | 297 |
if [ $MGT_IP == "dhcp" ]; then |
| 298 |
- OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME 2) |
|
| 298 |
+ OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME $MGT_DEV_NR) |
|
| 299 | 299 |
fi |
| 300 | 300 |
else |
| 301 | 301 |
OS_VM_SERVICES_ADDRESS=$PUB_IP |
| 302 | 302 |
if [ $PUB_IP == "dhcp" ]; then |
| 303 |
- OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME 3) |
|
| 303 |
+ OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME $PUB_DEV_NR) |
|
| 304 | 304 |
fi |
| 305 | 305 |
fi |
| 306 | 306 |
|
| 307 | 307 |
deleted file mode 100644 |
| ... | ... |
@@ -1,23 +0,0 @@ |
| 1 |
-auto lo |
|
| 2 |
-iface lo inet loopback |
|
| 3 |
- |
|
| 4 |
-# If eth3 is static, the order should not matter |
|
| 5 |
-# and eth0 will have the default gateway. If not, |
|
| 6 |
-# we probably want the default gateway to be |
|
| 7 |
-# what is on the public interface. Hence changed |
|
| 8 |
-# the order here. |
|
| 9 |
-auto eth3 |
|
| 10 |
-iface eth3 inet static |
|
| 11 |
- address @ETH3_IP@ |
|
| 12 |
- netmask @ETH3_NETMASK@ |
|
| 13 |
- |
|
| 14 |
-auto eth1 |
|
| 15 |
-iface eth1 inet static |
|
| 16 |
- address @ETH1_IP@ |
|
| 17 |
- netmask @ETH1_NETMASK@ |
|
| 18 |
-post-up ethtool -K eth1 tx off |
|
| 19 |
- |
|
| 20 |
-auto eth2 |
|
| 21 |
-iface eth2 inet static |
|
| 22 |
- address @ETH2_IP@ |
|
| 23 |
- netmask @ETH2_NETMASK@ |
| ... | ... |
@@ -30,32 +30,35 @@ XEN_INT_BRIDGE_OR_NET_NAME="OpenStack VM Integration Network" |
| 30 | 30 |
# VM Password |
| 31 | 31 |
GUEST_PASSWORD=${GUEST_PASSWORD:-secrete}
|
| 32 | 32 |
|
| 33 |
+# Extracted variables for OpenStack VM network device numbers. |
|
| 34 |
+# Make sure, they form a continous sequence starting from 0 |
|
| 35 |
+MGT_DEV_NR=0 |
|
| 36 |
+VM_DEV_NR=1 |
|
| 37 |
+PUB_DEV_NR=2 |
|
| 38 |
+XEN_INT_DEV_NR=3 |
|
| 39 |
+ |
|
| 33 | 40 |
# Host Interface, i.e. the interface on the nova vm you want to expose the |
| 34 |
-# services on. Usually eth2 (management network) or eth3 (public network) and |
|
| 35 |
-# not eth0 (private network with XenServer host) or eth1 (VM traffic network) |
|
| 36 |
-HOST_IP_IFACE=${HOST_IP_IFACE:-eth3}
|
|
| 41 |
+# services on. Usually the device connected to the management network or the |
|
| 42 |
+# one connected to the public network is used. |
|
| 43 |
+HOST_IP_IFACE=${HOST_IP_IFACE:-"eth${MGT_DEV_NR}"}
|
|
| 37 | 44 |
|
| 38 | 45 |
# |
| 39 | 46 |
# Our nova host's network info |
| 40 | 47 |
# |
| 41 | 48 |
|
| 42 | 49 |
# Management network |
| 43 |
-MGT_IP=${MGT_IP:-172.16.100.55}
|
|
| 44 |
-MGT_NETMASK=${MGT_NETMASK:-255.255.255.0}
|
|
| 50 |
+MGT_IP=${MGT_IP:-dhcp}
|
|
| 51 |
+MGT_NETMASK=${MGT_NETMASK:-ignored}
|
|
| 45 | 52 |
|
| 46 | 53 |
# VM Network |
| 47 | 54 |
VM_IP=${VM_IP:-10.255.255.255}
|
| 48 | 55 |
VM_NETMASK=${VM_NETMASK:-255.255.255.0}
|
| 49 | 56 |
|
| 50 | 57 |
# Public network |
| 51 |
-PUB_IP=${PUB_IP:-192.168.1.55}
|
|
| 58 |
+# Aligned with stack.sh - see FLOATING_RANGE |
|
| 59 |
+PUB_IP=${PUB_IP:-172.24.4.10}
|
|
| 52 | 60 |
PUB_NETMASK=${PUB_NETMASK:-255.255.255.0}
|
| 53 | 61 |
|
| 54 |
-# Decide if you should enable eth0, |
|
| 55 |
-# the guest installer network |
|
| 56 |
-# You need to disable this on xcp-xapi on Ubuntu 12.04 |
|
| 57 |
-ENABLE_GI=true |
|
| 58 |
- |
|
| 59 | 62 |
# Ubuntu install settings |
| 60 | 63 |
UBUNTU_INST_RELEASE="oneiric" |
| 61 | 64 |
UBUNTU_INST_TEMPLATE_NAME="Ubuntu 11.10 (64-bit) for DevStack" |
| ... | ... |
@@ -69,8 +72,11 @@ UBUNTU_INST_HTTP_DIRECTORY="/ubuntu" |
| 69 | 69 |
UBUNTU_INST_HTTP_PROXY="" |
| 70 | 70 |
UBUNTU_INST_LOCALE="en_US" |
| 71 | 71 |
UBUNTU_INST_KEYBOARD="us" |
| 72 |
-# network configuration for ubuntu netinstall |
|
| 73 |
-UBUNTU_INST_IFACE="eth3" |
|
| 72 |
+# network configuration for ubuntu netinstall. |
|
| 73 |
+# TODO(matelakat): get rid of legacy network interfaces |
|
| 74 |
+# specify "eth2" to use the management network |
|
| 75 |
+# specify "eth3" to use the public network |
|
| 76 |
+UBUNTU_INST_IFACE="eth2" |
|
| 74 | 77 |
UBUNTU_INST_IP="dhcp" |
| 75 | 78 |
UBUNTU_INST_NAMESERVERS="" |
| 76 | 79 |
UBUNTU_INST_NETMASK="" |