Browse code

Xen: restrict devstack VM use upto 8 vCPUs.

Change-Id: Iea6086a3feb03dff581d9c04560133c4f57a6f6c
Closes-Bug: 1672642

jianghua authored on 2017/03/14 17:04:53
Showing 1 changed files
... ...
@@ -294,6 +294,18 @@ function max_vcpus {
294 294
     # Assert ithas a numeric nonzero value
295 295
     expr "$cpu_count" + 0
296 296
 
297
+    # 8 VCPUs should be enough for devstack VM; avoid using too
298
+    # many VCPUs:
299
+    # 1. too many VCPUs may trigger a kernel bug which result VM
300
+    #    not able to boot:
301
+    #    https://kernel.googlesource.com/pub/scm/linux/kernel/git/wsa/linux/+/e2e004acc7cbe3c531e752a270a74e95cde3ea48
302
+    # 2. The remaining CPUs can be used for other purpose:
303
+    #    e.g. boot test VMs.
304
+    MAX_VCPUS=8
305
+    if [ $cpu_count -ge $MAX_VCPUS ]; then
306
+        cpu_count=$MAX_VCPUS
307
+    fi
308
+
297 309
     xe vm-param-set uuid=$vm VCPUs-max=$cpu_count
298 310
     xe vm-param-set uuid=$vm VCPUs-at-startup=$cpu_count
299 311
 }