Browse code

xenapi: Use a jeos vm as a template

DevStack was using templating to speed up the setup process with
XenServer. The template already included some devstack customisations,
not just a clean OS. This change modifies devstack behaviour, so that
the template is a simple clean operating system. This makes it easier to
use custom OS as a template, potentially speeding up the tests.

related to blueprint xenapi-devstack-cleanup

Change-Id: I6cb0a7ed7a90e749b78329a8e2b65fb8b7fcfa5f

Mate Lakat authored on 2013/07/31 03:43:10
Showing 1 changed files
... ...
@@ -167,8 +167,8 @@ fi
167 167
 #
168 168
 
169 169
 GUEST_NAME=${GUEST_NAME:-"DevStackOSDomU"}
170
-TNAME="devstack_template"
171
-SNAME_PREPARED="template_prepared"
170
+TNAME="jeos_template_for_devstack"
171
+SNAME_TEMPLATE="jeos_snapshot_for_devstack"
172 172
 SNAME_FIRST_BOOT="before_first_boot"
173 173
 
174 174
 function wait_for_VM_to_halt() {
... ...
@@ -234,21 +234,8 @@ if [ -z "$templateuuid" ]; then
234 234
     vm_uuid=$(xe_min vm-list name-label="$GUEST_NAME")
235 235
     xe vm-param-set actions-after-reboot=Restart uuid="$vm_uuid"
236 236
 
237
-    #
238
-    # Prepare VM for DevStack
239
-    #
240
-
241
-    # Install XenServer tools, and other such things
242
-    $THIS_DIR/prepare_guest_template.sh "$GUEST_NAME"
243
-
244
-    # start the VM to run the prepare steps
245
-    xe vm-start vm="$GUEST_NAME"
246
-
247
-    # Wait for prep script to finish and shutdown system
248
-    wait_for_VM_to_halt
249
-
250 237
     # Make template from VM
251
-    snuuid=$(xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME_PREPARED")
238
+    snuuid=$(xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME_TEMPLATE")
252 239
     xe snapshot-clone uuid=$snuuid new-name-label="$TNAME"
253 240
 else
254 241
     #
... ...
@@ -257,6 +244,19 @@ else
257 257
     vm_uuid=$(xe vm-install template="$TNAME" new-name-label="$GUEST_NAME")
258 258
 fi
259 259
 
260
+#
261
+# Prepare VM for DevStack
262
+#
263
+
264
+# Install XenServer tools, and other such things
265
+$THIS_DIR/prepare_guest_template.sh "$GUEST_NAME"
266
+
267
+# start the VM to run the prepare steps
268
+xe vm-start vm="$GUEST_NAME"
269
+
270
+# Wait for prep script to finish and shutdown system
271
+wait_for_VM_to_halt
272
+
260 273
 ## Setup network cards
261 274
 # Wipe out all
262 275
 destroy_all_vifs_of "$GUEST_NAME"