]> git.proxmox.com Git - mirror_qemu.git/commit - qga/commands-posix.c
qga: ignore non present cpus when handling qmp_guest_get_vcpus()
authorIgor Mammedov <imammedo@redhat.com>
Thu, 6 Sep 2018 12:51:54 +0000 (14:51 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 30 Oct 2018 21:48:49 +0000 (16:48 -0500)
commitb4bf912a6c19449e68af7b4173a8c6da21904d99
tree5487060e948f1940617f2105fb9ff0960159e8d6
parent0692b03ee135f6295168082199af55c6f289794d
qga: ignore non present cpus when handling qmp_guest_get_vcpus()

If VM has VCPUs plugged sparselly (for example a VM started with
3 VCPUs (cpu0, cpu1 and cpu2) and then cpu1 was hotunplugged so
only cpu0 and cpu2 are present), QGA will rise a error
  error: internal error: unable to execute QEMU agent command 'guest-get-vcpus':
  open("/sys/devices/system/cpu/cpu1/"): No such file or directory
when
  virsh vcpucount FOO --guest
is executed.
Fix it by ignoring non present CPUs when fetching CPUs status from sysfs.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qga/commands-posix.c