Skip to content

Commit 28ce215

Browse files
committed
e2e: add vm-cpu-hotplug and vm-cpu-hotremove to script API
Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
1 parent 0cdf7e7 commit 28ce215

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/e2e/lib/vm.bash

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,42 @@ vm-reboot() { # script API
345345
deadline=$_deadline host-wait-vm-ssh-server $_vagrantdir
346346
}
347347

348+
vm-cpu-hotplug() { # script API
349+
# Usage: vm-cpu-hotplug SOCKETID COREID THREADID
350+
#
351+
# Hotplug currently unplugged CPU to VM.
352+
#
353+
# Examples:
354+
# vm-cpu-hotplug 0 255 0
355+
local socketid=$1
356+
local coreid=$2
357+
local threadid=$3
358+
local deviceid="cpu-s$socketid-c$coreid-t$threadid"
359+
if [[ -z "$threadid" ]]; then
360+
error "missing one or more IDs: socket core thread"
361+
return 1
362+
fi
363+
vm-monitor "device_add driver=host-x86_64-cpu,id=${deviceid},socket-id=${socketid},core-id=${coreid},thread-id=${threadid}"
364+
}
365+
366+
vm-cpu-hotremove() { # script API
367+
# Usage: vm-cpu-hotremove SOCKETID COREID THREADID
368+
#
369+
# Hotremove currently plugged CPU from VM.
370+
#
371+
# Examples:
372+
# vm-cpu-hotremove 0 255 0
373+
local socketid=$1
374+
local coreid=$2
375+
local threadid=$3
376+
local deviceid="cpu-s$socketid-c$coreid-t$threadid"
377+
if [[ -z "$threadid" ]]; then
378+
error "missing one or more IDs: socket core thread"
379+
return 1
380+
fi
381+
vm-monitor "device_del ${deviceid}"
382+
}
383+
348384
vm-mem-hotplug() { # script API
349385
# Usage: vm-mem-hotplug MEMORY
350386
#

0 commit comments

Comments
 (0)