xenapi: enable user to specify FLAT_NETWORK_BRIDGE

install_os_domU.sh failed, if the FLAT_NETWORK_BRIDGE is found in
localrc. As nova looks up the network by either name-label or bridge
name, it makes sense to enable the user to specify this parameter. As an
example, if the user wants to use name-labels to specify networks, and
those name-labels could be used in domU to create bridges:

VM_BRIDGE_OR_NET_NAME="osvmnet"
FLAT_NETWORK_BRIDGE="osvmnet"

In this case, the domU will know only about a name label, so it could be
decoupled from which xapi bridges used.

This change also adds some fixes (missing double quotes).

Change-Id: I045e367ef441be20c4e8cb8af3c1149392db796b
This commit is contained in:
Mate Lakat 2013-09-25 17:07:06 +01:00
parent 66c5424980
commit 2b8814d0ec
2 changed files with 11 additions and 8 deletions

View File

@ -137,14 +137,14 @@ function _network_exists() {
local name_label local name_label
name_label=$1 name_label=$1
! [ -z $(xe network-list name-label="$name_label" --minimal) ] ! [ -z "$(xe network-list name-label="$name_label" --minimal)" ]
} }
function _bridge_exists() { function _bridge_exists() {
local bridge local bridge
bridge=$1 bridge=$1
! [ -z $(xe network-list bridge="$bridge" --minimal) ] ! [ -z "$(xe network-list bridge="$bridge" --minimal)" ]
} }
function _network_uuid() { function _network_uuid() {

View File

@ -111,13 +111,16 @@ if is_service_enabled neutron; then
fi fi
if parameter_is_specified "FLAT_NETWORK_BRIDGE"; then if parameter_is_specified "FLAT_NETWORK_BRIDGE"; then
if [ "$(bridge_for "$VM_BRIDGE_OR_NET_NAME")" != "$(bridge_for "$FLAT_NETWORK_BRIDGE")" ]; then
cat >&2 << EOF cat >&2 << EOF
ERROR: FLAT_NETWORK_BRIDGE is specified in localrc file ERROR: FLAT_NETWORK_BRIDGE is specified in localrc file, and either no network
This is considered as an error, as its value will be derived from the found on XenServer by searching for networks by that value as name-label or
VM_BRIDGE_OR_NET_NAME variable's value. bridge name or the network found does not match the network specified by
VM_BRIDGE_OR_NET_NAME. Please check your localrc file.
EOF EOF
exit 1 exit 1
fi fi
fi
if ! xenapi_is_listening_on "$MGT_BRIDGE_OR_NET_NAME"; then if ! xenapi_is_listening_on "$MGT_BRIDGE_OR_NET_NAME"; then
cat >&2 << EOF cat >&2 << EOF
@ -310,7 +313,7 @@ if is_service_enabled neutron; then
"xen_integration_bridge=${XEN_INTEGRATION_BRIDGE}" "xen_integration_bridge=${XEN_INTEGRATION_BRIDGE}"
fi fi
FLAT_NETWORK_BRIDGE=$(bridge_for "$VM_BRIDGE_OR_NET_NAME") FLAT_NETWORK_BRIDGE="${FLAT_NETWORK_BRIDGE:-$(bridge_for "$VM_BRIDGE_OR_NET_NAME")}"
append_kernel_cmdline "$GUEST_NAME" "flat_network_bridge=${FLAT_NETWORK_BRIDGE}" append_kernel_cmdline "$GUEST_NAME" "flat_network_bridge=${FLAT_NETWORK_BRIDGE}"
# Add a separate xvdb, if it was requested # Add a separate xvdb, if it was requested