All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qga: ignore non present cpus when handling qmp_guest_get_vcpus()
@ 2018-08-30 12:08 Igor Mammedov
  2018-08-30 15:51 ` Laszlo Ersek
  0 siblings, 1 reply; 12+ messages in thread
From: Igor Mammedov @ 2018-08-30 12:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: lersek, mdroth

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>
---
 qga/commands-posix.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 37e8a2d..2929872 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2044,7 +2044,9 @@ static void transfer_vcpu(GuestLogicalProcessor *vcpu, bool sys2vcpu,
                               vcpu->logical_id);
     dirfd = open(dirpath, O_RDONLY | O_DIRECTORY);
     if (dirfd == -1) {
-        error_setg_errno(errp, errno, "open(\"%s\")", dirpath);
+        if (!(sys2vcpu && errno == ENOENT)) {
+            error_setg_errno(errp, errno, "open(\"%s\")", dirpath);
+        }
     } else {
         static const char fn[] = "online";
         int fd;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-09-06 12:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-30 12:08 [Qemu-devel] [PATCH] qga: ignore non present cpus when handling qmp_guest_get_vcpus() Igor Mammedov
2018-08-30 15:51 ` Laszlo Ersek
2018-08-31  8:00   ` Igor Mammedov
2018-08-31 10:19     ` Laszlo Ersek
2018-09-06  9:00       ` [Qemu-devel] [libvirt] " Peter Krempa
2018-08-31 11:22   ` [Qemu-devel] " Andrew Jones
2018-09-05  0:12     ` Michael Roth
2018-09-06  9:49   ` Igor Mammedov
2018-09-06 10:26     ` Laszlo Ersek
2018-09-06 10:50       ` Igor Mammedov
2018-09-06 11:52         ` Laszlo Ersek
2018-09-06 12:00           ` Igor Mammedov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.