1 # Functional test that hotplugs a CPU and checks it on a Linux guest
3 # Copyright (c) 2021 Red Hat, Inc.
6 # Cleber Rosa <crosa@redhat.com>
8 # This work is licensed under the terms of the GNU GPL, version 2 or
9 # later. See the COPYING file in the top-level directory.
11 from avocado_qemu
import LinuxTest
14 class HotPlugCPU(LinuxTest
):
18 :avocado: tags=arch:x86_64
19 :avocado: tags=machine:q35
20 :avocado: tags=accel:kvm
22 self
.require_accelerator('kvm')
23 self
.vm
.add_args('-accel', 'kvm')
24 self
.vm
.add_args('-cpu', 'Haswell')
25 self
.vm
.add_args('-smp', '1,sockets=1,cores=2,threads=1,maxcpus=2')
26 self
.launch_and_wait()
28 self
.ssh_command('test -e /sys/devices/system/cpu/cpu0')
29 with self
.assertRaises(AssertionError):
30 self
.ssh_command('test -e /sys/devices/system/cpu/cpu1')
32 self
.vm
.cmd('device_add',
33 driver
='Haswell-x86_64-cpu',
37 self
.ssh_command('test -e /sys/devices/system/cpu/cpu1')