From nobody Tue Apr 30 03:35:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554153540518890.755160873729; Mon, 1 Apr 2019 14:19:00 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ECEF43087BB3; Mon, 1 Apr 2019 21:18:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D095260610; Mon, 1 Apr 2019 21:18:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0FFA41803389; Mon, 1 Apr 2019 21:18:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31LIhLP012345 for ; Mon, 1 Apr 2019 17:18:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4C49A1974C; Mon, 1 Apr 2019 21:18:43 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 46FD019936 for ; Mon, 1 Apr 2019 21:18:41 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 120D5309707A for ; Mon, 1 Apr 2019 21:18:40 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id v20so12489982qtv.12 for ; Mon, 01 Apr 2019 14:18:40 -0700 (PDT) Received: from rekt.ibmmodules.com ([2804:431:f700:6702:8bc5:7364:e3c:ea55]) by smtp.gmail.com with ESMTPSA id l129sm5781689qkb.44.2019.04.01.14.18.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 14:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yRXKNOOOAEKHXzUP1GYkkz6WSJz55/dKrwgdWE8STrw=; b=H8aKkgtVRIb/AIeHThcR2KxNk3J3h2Zle+iityfOCjbjORyfLbdpvHJDhZdiyaW8CQ +F4TTskjJh8xw0uqiDGPD9aTFUoHxpbNaQQK8fs9dGoUE8I21xT4nOq4ViXq4dI5RD0O /JNr5S2nUUZM5EKNc0gXb4GNskDOYxZjA9KVq3vktuQuQosWI4sRwx4Wge7Be9amDDMV PppaUeaiP0+wRhDi2yz4uRVClGl1NESZtsDLp45CSmIcDeRgaKoLtf45vp48QE9CDCtl d2cQenmPQ0f2QibAEe/VCsxNhxmQGimrGBhEsasflFxwG4vhYUIYiqUASP0vxE9hkc86 h55Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yRXKNOOOAEKHXzUP1GYkkz6WSJz55/dKrwgdWE8STrw=; b=s4MLRmps/6GBNnWRa5MhcfBGMaJ70Qbq//aSHGoCyqZ6SdtYzmBozRboW23WhG6kfZ czw+U4e0b8/53b4UggnqGeRvi22gu+YNU5K63kH+2rvdi1cGeSoZkBmdTp5Oq4nN1Hpc bFqJl6uAnS2asXRbuT63ytt5FLqkapcfF7uwH8SgXR/0xUrWPRNAph+X74gyNh/rgyUG kxjDlXgfex7BCCfrJ7Z9k2lY1TqjM+vqt7P7WexccYsqwZsI30Kk/jJI7pOJhTS36+MQ sOoTgp3s1xuzvBYa8zII0K70X6D0OYhh66o0/19kl0VKIIX+ICI4gYMfXM7pRgJEY2Oc +eAw== X-Gm-Message-State: APjAAAUs02ioy8eCMOn8wRCtCikKHBN7Vl5t3ezUATLU7scLw3lIdPBP 1Um4lEmtmcOuVCEnH6KBvtXokjr5 X-Google-Smtp-Source: APXvYqzSw9+uNqIDI3xppOxEwa/2k5Ff/TDFf5sYGdWOX2GV8mUwa9hTODq0T3IExgKybm10BTQ8sw== X-Received: by 2002:ac8:33cf:: with SMTP id d15mr56115261qtb.149.1554153518385; Mon, 01 Apr 2019 14:18:38 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Mon, 1 Apr 2019 18:18:24 -0300 Message-Id: <20190401211826.8598-2-danielhb413@gmail.com> In-Reply-To: <20190401211826.8598-1-danielhb413@gmail.com> References: <20190401211826.8598-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 01 Apr 2019 21:18:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 01 Apr 2019 21:18:40 +0000 (UTC) for IP:'209.85.160.194' DOMAIN:'mail-qt1-f194.google.com' HELO:'mail-qt1-f194.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.160.194 mail-qt1-f194.google.com 209.85.160.194 mail-qt1-f194.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH 1/3] adding QEMU_CAPS_QUERY_CURRENT_MACHINE and QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 01 Apr 2019 21:18:58 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" QEMU commit 46ea94ca9cf ("qmp: query-current-machine with wakeup-suspend-support") added a new QMP command called 'query-current-machine' that retrieves guest parameters that can vary in the same machine model (e.g. ACPI support for x86 VMs depends on the '--no-acpi' option). Currently, this API has a single flag, 'wakeup-suspend-support', that indicates whether the guest has the capability of waking up from suspended state. The original intent of this new API is to avoid situations such as [1], where an user can execute "virsh dompmsuspend" in a guest that can't wake up due to lack of support, making the guest unusable. This is currently the case for any non-x86 arch guests and for some x86 guests that starts with --no-acpi (q35 machines implements suspend support even with the --no-acpi flag). This is the Libvirt side of this API that will be available in QEMU 4.0. QEMU_CAPS_QUERY_CURRENT_MACHINE is a new virQEMUCapsCommands that will indicate if the QEMU binary supports the 'query-current-machine' API. QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT is a flag that reflects the 'wakeup-suspend-support' value for the current QEMU instance. In the next patches these two caps will be populated and used in qemu_driver.c, 'qemuDomainPMSuspendForDuration', to complete the fix for [1]. [1] https://github.com/open-power-host-os/qemu/issues/31 Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_capabilities.c | 5 +++++ src/qemu/qemu_capabilities.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 56228e7a36..318198cbdd 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -523,6 +523,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "nvdimm.unarmed", "scsi-disk.device_id", "virtio-pci-non-transitional", + "query-current-machine", + + /* 330 */ + "wakeup-suspend-support", ); =20 =20 @@ -978,6 +982,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] =3D= { { "query-cpus-fast", QEMU_CAPS_QUERY_CPUS_FAST }, { "qom-list-properties", QEMU_CAPS_QOM_LIST_PROPERTIES }, { "blockdev-del", QEMU_CAPS_BLOCKDEV_DEL }, + { "query-current-machine", QEMU_CAPS_QUERY_CURRENT_MACHINE }, }; =20 struct virQEMUCapsStringFlags virQEMUCapsMigration[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 06c7606e2f..633f2690a3 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -506,6 +506,10 @@ typedef enum { /* virQEMUCapsFlags grouping marker for= syntax-check */ QEMU_CAPS_DEVICE_NVDIMM_UNARMED, /* -device nvdimm,unarmed=3D */ QEMU_CAPS_SCSI_DISK_DEVICE_ID, /* 'device_id' property of scsi disk */ QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL, /* virtio *-pci-{non-}transitional = devices */ + QEMU_CAPS_QUERY_CURRENT_MACHINE, /* query-current-machine command */ + + /* 330 */ + QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT, /* query-current-machine API flag */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 03:35:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554153539814484.8262512528064; Mon, 1 Apr 2019 14:18:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 576823082E03; Mon, 1 Apr 2019 21:18:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2B441001DC1; Mon, 1 Apr 2019 21:18:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 46A56180338A; Mon, 1 Apr 2019 21:18:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31LIg6W012340 for ; Mon, 1 Apr 2019 17:18:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id E93241001DC1; Mon, 1 Apr 2019 21:18:42 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C2871001DF1 for ; Mon, 1 Apr 2019 21:18:42 +0000 (UTC) Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0899F88AC0 for ; Mon, 1 Apr 2019 21:18:41 +0000 (UTC) Received: by mail-qt1-f196.google.com with SMTP id x12so12745881qts.7 for ; Mon, 01 Apr 2019 14:18:40 -0700 (PDT) Received: from rekt.ibmmodules.com ([2804:431:f700:6702:8bc5:7364:e3c:ea55]) by smtp.gmail.com with ESMTPSA id l129sm5781689qkb.44.2019.04.01.14.18.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 14:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uVzi3j2jL7GrxXbzxEzHGuxo6i4HsdxgEffWMsmwe9s=; b=Og6mH7hqt25C4k9EFWF32XAgUoVuZx4bEqAIxYs7jjawlfExJ9bszA+gThSUtPDOBX E6djBJqL8OBPv1D2J+qc2hpPXLs5I/QUMgUIJABXGfjd9+rU2kX0i13kMxrh3RoI11c1 wFQzo0V3T8A/irRJuJERZ5bE1mDsI06FvZTAU/XhceJ8l0GM6pGa2DW8Dg86qdxGKLWN QVG1kfYPaMcGNojve62D+WlkfLDdeS60ABC3QiioYsBwdl1XWC8dpSk/fKoxJH9MLbve r+wURoZzJPLb/sIbZryc5DG7zpuf2ohS37pWpEP6kp6DkrWQLdfsAPOtNrpDIBZoGs6Y VbzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uVzi3j2jL7GrxXbzxEzHGuxo6i4HsdxgEffWMsmwe9s=; b=BNKUSGm9xgsoQXnVtbNLZhK7n5deTueW3Mw8Sq4Xu9HiFFmmaBnZNimJ4dKKBODMpz KBoMk/4mlIYxC0hJj4bzwm1N53yCS5bLNGENu/VmmEMNteqNKNeT3NSfTiCuK4/Gc8Lh 5hS4/hljRKmjNq5kCIjImRlUEqWeTWJz5+uvAM7oR2StMPrBxg+iFOMDti3chffhydd1 wL3EDyVUolCJSqIiOCmiHSoo+R8Jtj4JQBgNyw6OsKv7d0srmrL2XqK6M7r20DI/wAHQ ndtvKWZRyz9hfnYjSJX8MmwibYuMeDf7aAPuw8kan1Qe+gTsSI7g+H1RI4TB/Q+aXo/k HrYg== X-Gm-Message-State: APjAAAWsHF640TV9q31Dgh0ltvuJu9roUZSvLem18Ruh5umiGHtEo97n RY+iiPv4PbS6k/AVxLSfMm9z95kZ X-Google-Smtp-Source: APXvYqyoJ38UvKGBwad6uqwxkeJI5rgJJ/xqVf5oCogUiUeSvU7iTQAtqNE9FqavbET3NE2Da+ti7A== X-Received: by 2002:ac8:13c3:: with SMTP id i3mr54106047qtj.211.1554153520101; Mon, 01 Apr 2019 14:18:40 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Mon, 1 Apr 2019 18:18:25 -0300 Message-Id: <20190401211826.8598-3-danielhb413@gmail.com> In-Reply-To: <20190401211826.8598-1-danielhb413@gmail.com> References: <20190401211826.8598-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 01 Apr 2019 21:18:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 01 Apr 2019 21:18:41 +0000 (UTC) for IP:'209.85.160.196' DOMAIN:'mail-qt1-f196.google.com' HELO:'mail-qt1-f196.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.160.196 mail-qt1-f196.google.com 209.85.160.196 mail-qt1-f196.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH 2/3] setting QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT qemu capability X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 01 Apr 2019 21:18:54 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT is a bool that represents the value of the wakeup-suspend-support flag of the new query-current-machine QMP API, available in QEMU 4.0. The flag is set in qemuProcessLaunch, using a new function called qemuProcessSetupWakeupSuspendSupport. This function checks first if the QEMU process has support for the new API, which is reflected by the QEMU_CAPS_QUERY_CURRENT_MACHINE cap. If positive, query it and set QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT with the current value of wakeup-suspend-support. --- src/qemu/qemu_monitor.c | 8 ++++++++ src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 35 +++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 4 ++++ src/qemu/qemu_process.c | 38 ++++++++++++++++++++++++++++++++++++ 5 files changed, 88 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index babcbde878..fc6dc2197a 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4472,3 +4472,11 @@ qemuMonitorGetPRManagerInfo(qemuMonitorPtr mon, virHashFree(info); return ret; } + +int +qemuMonitorGetWakeupSuspendSupport(qemuMonitorPtr mon, bool *enabled) +{ + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONGetWakeupSuspendSupport(mon, enabled); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 086195ff98..62074c1acb 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1220,4 +1220,7 @@ struct _qemuMonitorPRManagerInfo { int qemuMonitorGetPRManagerInfo(qemuMonitorPtr mon, virHashTablePtr *retinfo); =20 +int qemuMonitorGetWakeupSuspendSupport(qemuMonitorPtr mon, + bool *enabled); + #endif /* LIBVIRT_QEMU_MONITOR_H */ diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 743a88b914..16d34fb217 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8452,3 +8452,38 @@ qemuMonitorJSONGetPRManagerInfo(qemuMonitorPtr mon, return ret; =20 } + +int +qemuMonitorJSONGetWakeupSuspendSupport(qemuMonitorPtr mon, bool *enabled) +{ + int ret =3D -1; + virJSONValuePtr cmd, data; + virJSONValuePtr reply =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("query-current-machine", + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_OBJECT) < 0) + goto cleanup; + + data =3D virJSONValueObjectGetObject(reply, "return"); + + if (virJSONValueObjectGetBoolean(data, "wakeup-suspend-support", + enabled)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing wakeup-suspend-support in " + "query-current-machine response")); + goto cleanup; + } + + ret =3D 0; + + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index c10513da15..ede828d622 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -576,4 +576,8 @@ int qemuMonitorJSONGetPRManagerInfo(qemuMonitorPtr mon, virHashTablePtr info) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); =20 +int qemuMonitorJSONGetWakeupSuspendSupport(qemuMonitorPtr mon, + bool *enabled) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + #endif /* LIBVIRT_QEMU_MONITOR_JSON_H */ diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index dc7317b723..71984714de 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6449,6 +6449,41 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver= Ptr driver, return ret; } =20 +/** + * qemuProcessSetupWakeupSuspendSupport: + * + * Sets up QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT in case QEMU has support + * for the query-current-machine QMP API. This can be verified by + * checking for the QEMU_CAPS_QUERY_CURRENT_MACHINE cap. + */ +static int +qemuProcessSetupWakeupSuspendSupport(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuDomainAsyncJob asyncJob) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + bool enabled; + int ret =3D -1; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE)) + return 0; + + if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + return -1; + + if (qemuMonitorGetWakeupSuspendSupport(qemuDomainGetMonitor(vm), &enab= led) < 0) + goto cleanup; + + if (enabled) + virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT); + + ret =3D 0; + + cleanup: + if (qemuDomainObjExitMonitor(driver, vm) < 0) + ret =3D -1; + return ret; +} =20 /** * qemuProcessLaunch: @@ -6777,6 +6812,9 @@ qemuProcessLaunch(virConnectPtr conn, qemuProcessAutoDestroyAdd(driver, vm, conn) < 0) goto cleanup; =20 + if (qemuProcessSetupWakeupSuspendSupport(driver, vm, asyncJob) < 0) + goto cleanup; + ret =3D 0; =20 cleanup: --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 03:35:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554153580738177.86576782774296; Mon, 1 Apr 2019 14:19:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B24031524C4; Mon, 1 Apr 2019 21:19:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5563460603; Mon, 1 Apr 2019 21:19:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 13D183FB11; Mon, 1 Apr 2019 21:19:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31LIkjv012366 for ; Mon, 1 Apr 2019 17:18:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0397760141; Mon, 1 Apr 2019 21:18:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F064D60123 for ; Mon, 1 Apr 2019 21:18:43 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 60DC030C3B6B for ; Mon, 1 Apr 2019 21:18:42 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id h39so12787707qte.2 for ; Mon, 01 Apr 2019 14:18:42 -0700 (PDT) Received: from rekt.ibmmodules.com ([2804:431:f700:6702:8bc5:7364:e3c:ea55]) by smtp.gmail.com with ESMTPSA id l129sm5781689qkb.44.2019.04.01.14.18.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 14:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S6dllr2HvXwcrXBbqZSF8d6ET45fmXpi2RB2/juVhtc=; b=WFW2XRwMkQLurACAOqO9FDow08zZN0B3+XeIFf7Tjo0pAbyTGN46PUWEAKFT1gRqqe NWudWiXEJ6H7rUOMNAkOzGT4G5AdlPFqrHVYi9dd86YT9xmjx0Cf065+TLHN8NPQNDy0 ObdHIUtyV1FyQXNwhmrOxWjvEErk0DyQARy6xoW5PRSRR13zxRZqtWyguzPpJ8DAz5C0 UEG7CacjkD2svLcKkQz5QLEaFGlCfKJc6CQ/ArdTQ4IIoWsMWX1i7mIQB15dq4X8Xqtk +SlQ2zZpKv9HyvF+yBeGoAiB7OHP8dibM9QnGGnk7ZrY4gJTWe4aDEfI4p4xQsc0li0E +o0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S6dllr2HvXwcrXBbqZSF8d6ET45fmXpi2RB2/juVhtc=; b=TD9+HxGrLk27I9UFE2jpfd3kRvCrtXudgE9AZlyobaKOuDgw//Dgevkmpzw7SZUQxR DwRB/RpJmJ7vEAJNfRvNSwC8tHoHCKFVfsVmN/lqL8tESHR3xQGOlt9pg6oEdPN7gma+ NXvEg3GrU+OKQMm9AMdMEIRc87BMw/LsyAWn17tpFLT7B4z63GWUdRTat8zINnLMZh26 TDLsjUBNuosA/kChAacoElxNcPcVmbf4lQfnuRp8iCaj1xy4fBhvhse7J4mcb6eO17w3 JNwhf9JNTVNe5Teq68RopaiI/zIh6d8iHOAOPug1ApxjSoGqLZTt+nrYrI7Rxwitjhpg NDpw== X-Gm-Message-State: APjAAAVQu3yq0MRHr/dwFeuwFAEnYQQGySY/B/ltgC1Xt2/SB0Ogqu6r Quv3vmKPY7R1FyTRzB4w5wMU0iAF X-Google-Smtp-Source: APXvYqzcCo6T1tikMhOMTAJ84pGk0T3+7HIyRXDCxv+A0aFhY25roRyx+7EMfa+rwxru4VDWiaTMLw== X-Received: by 2002:aed:3eea:: with SMTP id o39mr54411505qtf.25.1554153521521; Mon, 01 Apr 2019 14:18:41 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Mon, 1 Apr 2019 18:18:26 -0300 Message-Id: <20190401211826.8598-4-danielhb413@gmail.com> In-Reply-To: <20190401211826.8598-1-danielhb413@gmail.com> References: <20190401211826.8598-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 01 Apr 2019 21:18:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 01 Apr 2019 21:18:42 +0000 (UTC) for IP:'209.85.160.194' DOMAIN:'mail-qt1-f194.google.com' HELO:'mail-qt1-f194.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.160.194 mail-qt1-f194.google.com 209.85.160.194 mail-qt1-f194.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Balamuruhan S , Daniel Henrique Barboza Subject: [libvirt] [PATCH 3/3] qemuDomainPMSuspendForDuration: check for QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 01 Apr 2019 21:19:39 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" If the current QEMU guest can't wake up from suspend properly, avoid suspending the guest at all. This is done by checking the QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT cap. The absence of the cap indicates that we're dealing with a QEMU version older than 4.0 (which implements the required QMP API). In this case, proceed as usual with the suspend logic since we can't assume whether the guest has support or not. This is the output of dompmsuspend in a guest that does not have wake-up support declared in the query-current-machine: $ sudo ./run tools/virsh dompmsuspend ub1810-noACPI3 mem error: Domain ub1810-noACPI3 could not be suspended error: this function is not supported by the connection driver: Domain does= not have suspend support Fixes: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1759509 Reported-by: Balamuruhan S Signed-off-by: Daniel Henrique Barboza --- I am not sure if Libvirt uses Launchpad for bug tracking like QEMU does. If it's not the case, I believe the 'Fixes:' line up above can be ignored/deleted. src/qemu/qemu_driver.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 62d8d977c5..9f1f170dfc 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19209,6 +19209,8 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, virQEMUDriverPtr driver =3D dom->conn->privateData; virDomainObjPtr vm; qemuAgentPtr agent; + qemuDomainObjPrivatePtr priv; + bool hasQueryMachineAPI =3D false; int ret =3D -1; =20 virCheckFlags(0, -1); @@ -19231,6 +19233,28 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, if (!(vm =3D qemuDomObjFromDomain(dom))) goto cleanup; =20 + priv =3D vm->privateData; + + /* + * We can't check just for QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT because, + * in case this cap is disabled, it is not possible to tell if the gue= st + * does not have wake-up from suspend support or if the current QEMU + * instance does not have the API. + * + * The case we want to handle here is when QEMU has the API and + * QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT cap is disabled. Otherwise, do + * not interfere with the suspend process. + */ + hasQueryMachineAPI =3D virQEMUCapsGet(priv->qemuCaps, + QEMU_CAPS_QUERY_CURRENT_MACHINE); + if (hasQueryMachineAPI && + !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP_SUSPEND_SUPPORT))= { + + virReportError(VIR_ERR_NO_SUPPORT, "%s", + _("Domain does not have suspend support")); + goto cleanup; + } + if (virDomainPMSuspendForDurationEnsureACL(dom->conn, vm->def) < 0) goto cleanup; =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list