Give as much VCPUs to the DevStack machine as possible. First asking
xenapi about its CPU count, and as a fallback, count the CPUs in dom0.
This should result in faster test runs.
Change-Id: I1ffb99ecd435f1d7eb5754fe9cd99f0e8ceae6dc
| ... | ... |
@@ -287,3 +287,35 @@ function set_vm_memory() {
|
| 287 | 287 |
dynamic-max=${memory}MiB \
|
| 288 | 288 |
uuid=$vm |
| 289 | 289 |
} |
| 290 |
+ |
|
| 291 |
+function max_vcpus() {
|
|
| 292 |
+ local vm_name_label |
|
| 293 |
+ |
|
| 294 |
+ vm_name_label="$1" |
|
| 295 |
+ |
|
| 296 |
+ local vm |
|
| 297 |
+ local host |
|
| 298 |
+ local cpu_count |
|
| 299 |
+ |
|
| 300 |
+ host=$(xe host-list --minimal) |
|
| 301 |
+ vm=$(_vm_uuid "$vm_name_label") |
|
| 302 |
+ |
|
| 303 |
+ cpu_count=$(xe host-param-get \ |
|
| 304 |
+ param-name=cpu_info \ |
|
| 305 |
+ uuid=$host | |
|
| 306 |
+ sed -e 's/^.*cpu_count: \([0-9]*\);.*$/\1/g') |
|
| 307 |
+ |
|
| 308 |
+ if [ -z "$cpu_count" ]; then |
|
| 309 |
+ # get dom0's vcpu count |
|
| 310 |
+ cpu_count=$(cat /proc/cpuinfo | grep processor | wc -l) |
|
| 311 |
+ fi |
|
| 312 |
+ |
|
| 313 |
+ # Assert cpu_count is not empty |
|
| 314 |
+ [ -n "$cpu_count" ] |
|
| 315 |
+ |
|
| 316 |
+ # Assert ithas a numeric nonzero value |
|
| 317 |
+ expr "$cpu_count" + 0 |
|
| 318 |
+ |
|
| 319 |
+ xe vm-param-set uuid=$vm VCPUs-max=$cpu_count |
|
| 320 |
+ xe vm-param-set uuid=$vm VCPUs-at-startup=$cpu_count |
|
| 321 |
+} |
| ... | ... |
@@ -263,6 +263,9 @@ $THIS_DIR/prepare_guest_template.sh "$GUEST_NAME" |
| 263 | 263 |
# Set virtual machine parameters |
| 264 | 264 |
set_vm_memory "$GUEST_NAME" "$OSDOMU_MEM_MB" |
| 265 | 265 |
|
| 266 |
+# Max out VCPU count for better performance |
|
| 267 |
+max_vcpus "$GUEST_NAME" |
|
| 268 |
+ |
|
| 266 | 269 |
# start the VM to run the prepare steps |
| 267 | 270 |
xe vm-start vm="$GUEST_NAME" |
| 268 | 271 |
|