Browse code

Merge "xenapi: kernel_cmdline moved out from template"

Jenkins authored on 2013/06/04 02:18:03
Showing 3 changed files
... ...
@@ -94,6 +94,14 @@ function find_ip_by_name() {
94 94
     done
95 95
 }
96 96
 
97
+function _vm_uuid() {
98
+    local vm_name_label
99
+
100
+    vm_name_label="$1"
101
+
102
+    xe vm-list name-label="$vm_name_label" --minimal
103
+}
104
+
97 105
 function _create_new_network() {
98 106
     local name_label
99 107
     name_label=$1
... ...
@@ -135,17 +143,17 @@ function _network_uuid() {
135 135
 }
136 136
 
137 137
 function add_interface() {
138
-    local vm_name
138
+    local vm_name_label
139 139
     local bridge_or_network_name
140 140
 
141
-    vm_name="$1"
141
+    vm_name_label="$1"
142 142
     bridge_or_network_name="$2"
143 143
     device_number="$3"
144 144
 
145 145
     local vm
146 146
     local net
147 147
 
148
-    vm=$(xe vm-list name-label="$vm_name" --minimal)
148
+    vm=$(_vm_uuid "$vm_name_label")
149 149
     net=$(_network_uuid "$bridge_or_network_name")
150 150
     xe vif-create network-uuid=$net vm-uuid=$vm device=$device_number
151 151
 }
... ...
@@ -200,3 +208,19 @@ function parameter_is_specified() {
200 200
 
201 201
     compgen -v | grep "$parameter_name"
202 202
 }
203
+
204
+function append_kernel_cmdline()
205
+{
206
+    local vm_name_label
207
+    local kernel_args
208
+
209
+    vm_name_label="$1"
210
+    kernel_args="$2"
211
+
212
+    local vm
213
+    local pv_args
214
+
215
+    vm=$(_vm_uuid "$vm_name_label")
216
+    pv_args=$(xe vm-param-get param-name=PV-args uuid=$vm)
217
+    xe vm-param-set PV-args="$pv_args $kernel_args" uuid=$vm
218
+}
... ...
@@ -200,21 +200,13 @@ if [ -z "$templateuuid" ]; then
200 200
 
201 201
     # create a new VM with the given template
202 202
     # creating the correct VIFs and metadata
203
-    FLAT_NETWORK_BRIDGE=$(bridge_for "$VM_BRIDGE_OR_NET_NAME")
204
-
205
-    KERNEL_PARAMS_FOR_QUANTUM=""
206
-    if is_service_enabled quantum; then
207
-        XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME")
208
-        KERNEL_PARAMS_FOR_QUANTUM="xen_integration_bridge=${XEN_INTEGRATION_BRIDGE}"
209
-    fi
210 203
     $THIS_DIR/scripts/install-os-vpx.sh \
211 204
         -t "$UBUNTU_INST_TEMPLATE_NAME" \
212 205
         -v "$VM_BRIDGE_OR_NET_NAME" \
213 206
         -m "$MGT_BRIDGE_OR_NET_NAME" \
214 207
         -p "$PUB_BRIDGE_OR_NET_NAME" \
215 208
         -l "$GUEST_NAME" \
216
-        -r "$OSDOMU_MEM_MB" \
217
-        -k "flat_network_bridge=${FLAT_NETWORK_BRIDGE} ${KERNEL_PARAMS_FOR_QUANTUM}"
209
+        -r "$OSDOMU_MEM_MB"
218 210
 
219 211
     # wait for install to finish
220 212
     wait_for_VM_to_halt
... ...
@@ -253,11 +245,20 @@ fi
253 253
 $THIS_DIR/build_xva.sh "$GUEST_NAME"
254 254
 
255 255
 # Attach a network interface for the integration network (so that the bridge
256
-# is created by XenServer). This is required for Quantum.
256
+# is created by XenServer). This is required for Quantum. Also pass that as a
257
+# kernel parameter for DomU
257 258
 if is_service_enabled quantum; then
258 259
     add_interface "$GUEST_NAME" "$XEN_INT_BRIDGE_OR_NET_NAME" "4"
260
+
261
+    XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME")
262
+    append_kernel_cmdline \
263
+        "$GUEST_NAME" \
264
+        "xen_integration_bridge=${XEN_INTEGRATION_BRIDGE}"
259 265
 fi
260 266
 
267
+FLAT_NETWORK_BRIDGE=$(bridge_for "$VM_BRIDGE_OR_NET_NAME")
268
+append_kernel_cmdline "$GUEST_NAME" "flat_network_bridge=${FLAT_NETWORK_BRIDGE}"
269
+
261 270
 # create a snapshot before the first boot
262 271
 # to allow a quick re-run with the same settings
263 272
 xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME_FIRST_BOOT"
... ...
@@ -25,7 +25,6 @@ NAME="XenServer OpenStack VPX"
25 25
 DATA_VDI_SIZE="500MiB"
26 26
 BRIDGE_M=
27 27
 BRIDGE_P=
28
-KERNEL_PARAMS=
29 28
 VPX_FILE=os-vpx.xva
30 29
 AS_TEMPLATE=
31 30
 FROM_TEMPLATE=
... ...
@@ -38,7 +37,7 @@ usage()
38 38
 cat << EOF
39 39
 
40 40
   Usage: $0 [-f FILE_PATH] [-d DISK_SIZE] [-v BRIDGE_NAME] [-m BRIDGE_NAME] [-p BRIDGE_NAME]
41
-            [-k PARAMS] [-r RAM] [-i|-c] [-w] [-b] [-l NAME_LABEL] [-t TEMPLATE_NW_INSTALL]
41
+            [-r RAM] [-i|-c] [-w] [-b] [-l NAME_LABEL] [-t TEMPLATE_NW_INSTALL]
42 42
 
43 43
   Installs XenServer OpenStack VPX.
44 44
 
... ...
@@ -57,7 +56,6 @@ cat << EOF
57 57
                   Defaults to xenbr0.
58 58
      -v bridge    Specifies the bridge for the vm network
59 59
      -p bridge    Specifies the bridge for the externally facing network.
60
-     -k params    Specifies kernel parameters.
61 60
      -r MiB       Specifies RAM used by the VPX, in MiB.
62 61
                   By default it will take the value from the XVA.
63 62
      -l name      Specifies the name label for the VM.
... ...
@@ -81,15 +79,12 @@ cat << EOF
81 81
      using the default for management traffic:
82 82
             install-os-vpx.sh -m xapi4
83 83
 
84
-     Create a VPX that automatically becomes the master:
85
-            install-os-vpx.sh -k geppetto_master=true
86
-
87 84
 EOF
88 85
 }
89 86
 
90 87
 get_params()
91 88
 {
92
-  while getopts "hicwbf:d:v:m:p:k:r:l:t:" OPTION;
89
+  while getopts "hicwbf:d:v:m:p:r:l:t:" OPTION;
93 90
   do
94 91
     case $OPTION in
95 92
       h) usage
... ...
@@ -119,9 +114,6 @@ get_params()
119 119
       p)
120 120
          BRIDGE_P=$OPTARG
121 121
          ;;
122
-      k)
123
-         KERNEL_PARAMS=$OPTARG
124
-         ;;
125 122
       r)
126 123
          RAM=$OPTARG
127 124
          ;;
... ...
@@ -328,20 +320,6 @@ create_data_disk()
328 328
 }
329 329
 
330 330
 
331
-set_kernel_params()
332
-{
333
-  local v="$1"
334
-  local args=$KERNEL_PARAMS
335
-  if [ "$args" != "" ]
336
-  then
337
-    echo "Passing Geppetto args to VPX: $args."
338
-    pvargs=$(xe vm-param-get param-name=PV-args uuid="$v")
339
-    args="$pvargs $args"
340
-    xe vm-param-set PV-args="$args" uuid="$v"
341
-  fi
342
-}
343
-
344
-
345 331
 set_memory()
346 332
 {
347 333
   local v="$1"
... ...
@@ -367,7 +345,6 @@ set_auto_start()
367 367
 set_all()
368 368
 {
369 369
   local v="$1"
370
-  set_kernel_params "$v"
371 370
   set_memory "$v"
372 371
   set_auto_start "$v"
373 372
   label_system_disk "$v"
... ...
@@ -430,7 +407,6 @@ then
430 430
   create_vm_vif "$vm_uuid"
431 431
   create_management_vif "$vm_uuid"
432 432
   create_public_vif "$vm_uuid"
433
-  set_kernel_params "$vm_uuid"
434 433
   xe vm-param-set other-config:os-vpx=true uuid="$vm_uuid"
435 434
   xe vm-param-set actions-after-reboot=Destroy uuid="$vm_uuid"
436 435
   set_memory "$vm_uuid"