Skip to content

Commit 24b20dd

Browse files
committed
e2e: add vm-cpu-hotplug and vm-cpu-hotremove to script API
Signed-off-by: Antti Kervinen <[email protected]>
1 parent c16909f commit 24b20dd

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
@@ -354,6 +354,42 @@ vm-reboot() { # script API
354354
deadline=$_deadline host-wait-vm-ssh-server $_vagrantdir
355355
}
356356

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

0 commit comments

Comments
 (0)