Browse code

Merge "xenapi: enable user to specify FLAT_NETWORK_BRIDGE"

Jenkins authored on 2013/11/22 22:40:04
Showing 2 changed files
... ...
@@ -137,14 +137,14 @@ function _network_exists() {
137 137
     local name_label
138 138
     name_label=$1
139 139
 
140
-    ! [ -z $(xe network-list name-label="$name_label" --minimal) ]
140
+    ! [ -z "$(xe network-list name-label="$name_label" --minimal)" ]
141 141
 }
142 142
 
143 143
 function _bridge_exists() {
144 144
     local bridge
145 145
     bridge=$1
146 146
 
147
-    ! [ -z $(xe network-list bridge="$bridge" --minimal) ]
147
+    ! [ -z "$(xe network-list bridge="$bridge" --minimal)" ]
148 148
 }
149 149
 
150 150
 function _network_uuid() {
... ...
@@ -111,12 +111,15 @@ if is_service_enabled neutron; then
111 111
 fi
112 112
 
113 113
 if parameter_is_specified "FLAT_NETWORK_BRIDGE"; then
114
-    cat >&2 << EOF
115
-ERROR: FLAT_NETWORK_BRIDGE is specified in localrc file
116
-This is considered as an error, as its value will be derived from the
117
-VM_BRIDGE_OR_NET_NAME variable's value.
114
+    if [ "$(bridge_for "$VM_BRIDGE_OR_NET_NAME")" != "$(bridge_for "$FLAT_NETWORK_BRIDGE")" ]; then
115
+        cat >&2 << EOF
116
+ERROR: FLAT_NETWORK_BRIDGE is specified in localrc file, and either no network
117
+found on XenServer by searching for networks by that value as name-label or
118
+bridge name or the network found does not match the network specified by
119
+VM_BRIDGE_OR_NET_NAME. Please check your localrc file.
118 120
 EOF
119
-    exit 1
121
+        exit 1
122
+    fi
120 123
 fi
121 124
 
122 125
 if ! xenapi_is_listening_on "$MGT_BRIDGE_OR_NET_NAME"; then
... ...
@@ -310,7 +313,7 @@ if is_service_enabled neutron; then
310 310
         "xen_integration_bridge=${XEN_INTEGRATION_BRIDGE}"
311 311
 fi
312 312
 
313
-FLAT_NETWORK_BRIDGE=$(bridge_for "$VM_BRIDGE_OR_NET_NAME")
313
+FLAT_NETWORK_BRIDGE="${FLAT_NETWORK_BRIDGE:-$(bridge_for "$VM_BRIDGE_OR_NET_NAME")}"
314 314
 append_kernel_cmdline "$GUEST_NAME" "flat_network_bridge=${FLAT_NETWORK_BRIDGE}"
315 315
 
316 316
 # Add a separate xvdb, if it was requested