From nobody Mon Apr 29 22:47:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1554826742; cv=none; d=zoho.com; s=zohoarc; b=RFN57BZpj3GAsaDs93j23PJI4H8aU4/jOtJfifO/hQIVcmLiFbqxG/WAiULA9lixnQ2ljLLLQrdf+yVGMb1JjGz9KdR6FMNdeu+/tDJR6BXInRLoaREUGXxQKCEacW94yAwy8ikPbwWHJRFigPzcH4z1xk+lytOT0JZRxOo23WY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1554826742; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SkRbwWGaAfAPuW+6e59hqXqUb0nPLyFgLb7Aly6NTm8=; b=BlhXLEUjNmydad8FQu4+sE3z5wF4Qe6ohxCids0RM7f+i17yesZz7SbS9E8NasAUiQ1QZjEF5qj9lsmhWZ33U9OoPS+MZPOPbSR8vJar+y/1LGRhIwcn8nr1YTMF0mzuHr3q4hac7zx36C8ZdCRwRkJk13O5y+dmzo7hNPDSpmk= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155482674267060.126845045358664; Tue, 9 Apr 2019 09:19:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A4A288AC6; Tue, 9 Apr 2019 16:18:59 +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 DD43E6198C; Tue, 9 Apr 2019 16:18:57 +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 BDF451803386; Tue, 9 Apr 2019 16:18:40 +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 x39GIdst016346 for ; Tue, 9 Apr 2019 12:18:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A8C6104C421; Tue, 9 Apr 2019 16:18:39 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 529C41001E6B; Tue, 9 Apr 2019 16:18:37 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (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 18D123004143; Tue, 9 Apr 2019 16:18:28 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id w30so20469797qta.8; Tue, 09 Apr 2019 09:18:28 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:f701:d7d6:9e6a:ca5e:8a85:57a7]) by smtp.gmail.com with ESMTPSA id y34sm19152889qta.96.2019.04.09.09.18.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 09:18:26 -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=MPQrB+8/842T+Rbp4OenMxSghM3jvKIldILRMMsJmck=; b=Q+U3bh/lqvkvN3N+esuRcko/3FZ5bUBsq3MBg6+0HnF+7ohu1aeck9XgWe/L9JVcjV CCqbqijhM+0oOvR7ablheW09rKjlygupOilY6QdiT+ggLhuiXg4jV6nQlZeOlP+y21B3 5Kwxx/JGGCRqdnh/MV3oejKroScThecqbz06ac7Cw3kYOibI69CRkryLUOnKV97fPf87 HSsluryXaIDyTXt8SWCT2sLJ/mWPsLcQlKF+jvKzRYX1g3gNoJm5+sIaeqPNXtW3QUqQ oOEznBhWxRwD9wxDW1FfGwpQOwRvCtBV+Pj8e+4KYAV/12ONcTvG1yXDN1tXcQUR0Y5J bRIw== 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=MPQrB+8/842T+Rbp4OenMxSghM3jvKIldILRMMsJmck=; b=ufGSKoAUGljbz9ksV4jRHAMgCUw2Df4KCuRJtN8a+pvDSCzPE4NY+h8omGQ2F+fOa5 j61CSY4hTYmArsry6VzKDoB/O5g/YhWR2hlGfzHXO0WDMhL+l+nfwFQamxmLEQsQFC+9 364vrHigNosMZy47mlawulWJKdpxz+tgdBRJ/gDeAr6B+QoHFpp+0IOvWIyJqwhtCkD+ 3uYrhfuzD6yRIYO2h4rv38wJ0H9fvXouayLTxbTPaIHFgXnnMKkT6Bg5vwo8sFkkq8QC 6yWn4/1z5SW5Mi9PFCEeeiffuf2hlWk/AKmkSVVaDbCNh1kAHti+k+Gs59ZoClwav47E SblA== X-Gm-Message-State: APjAAAXYaM99cbqPpPAw+xMLY+mGHj0ujM6cayIxE3rIpb/OBnkdSZzc Eg7dNRoyAPRoXmnL+dGCbZuH3iMs X-Google-Smtp-Source: APXvYqwPdOOTKHgLz2Yrt+fos8Cdme8Yq2qdzcn0XKI78ay0ltQxB9Z8nKr9U68NLS75+ey9TeSHEg== X-Received: by 2002:a0c:81fa:: with SMTP id 55mr30147918qve.91.1554826707036; Tue, 09 Apr 2019 09:18:27 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Tue, 9 Apr 2019 13:18:14 -0300 Message-Id: <20190409161816.21542-2-danielhb413@gmail.com> In-Reply-To: <20190409161816.21542-1-danielhb413@gmail.com> References: <20190409161816.21542-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.46]); Tue, 09 Apr 2019 16:18:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 09 Apr 2019 16:18:28 +0000 (UTC) for IP:'209.85.160.195' DOMAIN:'mail-qt1-f195.google.com' HELO:'mail-qt1-f195.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.14 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS) 209.85.160.195 mail-qt1-f195.google.com 209.85.160.195 mail-qt1-f195.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , pkrempa@redhat.com Subject: [libvirt] [PATCH v2 1/3] adding QEMU_CAPS_QUERY_CURRENT_MACHINE and QEMU_CAPS_PM_WAKEUP_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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 09 Apr 2019 16:19:01 +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_PM_WAKEUP_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 ++++ tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 1 + 5 files changed, 12 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 71d4c01296..5c1b41aa3e 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 @@ -968,6 +972,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 c6f6980684..85d0c653fa 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_PM_WAKEUP_SUPPORT, /* dynamic capability that shows if the r= unning domain has wake-up from suspend support */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml b/tests/qemu= capabilitiesdata/caps_4.0.0.riscv32.xml index a8b5eb61c5..9d20be128a 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml @@ -163,6 +163,7 @@ + 3001091 0 0 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml b/tests/qemu= capabilitiesdata/caps_4.0.0.riscv64.xml index 311740f34f..a1a59e14cb 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml @@ -163,6 +163,7 @@ + 3001091 0 0 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.0.0.x86_64.xml index 4585ff9e07..899c0cf7c8 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml @@ -201,6 +201,7 @@ + 3001050 0 43100758 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 22:47:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1554826771; cv=none; d=zoho.com; s=zohoarc; b=EyZ/Iia2RmMnKtVWLK1WXbqyvnrUNvXr25rBzR6PLPeg8Azfmza38E9YGu1slmxnwn88bST8u/lxts0YjklSQpqnny9qRM4b16hxcbXkRpf3QW0F23d79wZYNQLh5+zLHoPA4fkCA7ow3sRk7EZoV1ydILFiBt6qSehzrH6NkA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1554826771; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=pduMW+lWKNfQsQ8ssU1BKoaCFF0aa6oZ9UBAnf8ghFc=; b=F5/KzwLMm6qfNzN7xYrk3tBRSPrE1jqi6zxX05+jpDTswFwtOyWoVDj+AMZndynd+MkY7vh/72eGh8I+FJXvKlhdhjaPc8pp79DAqEVrgDU4t3GBfwnwMCnxNApWbYWbJq6+ZSaC1ZQFC4sV1T7pB5NYTcIG3tiu2o4SE8kDfYU= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554826771787204.23923047178482; Tue, 9 Apr 2019 09:19:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 85A6E3003199; Tue, 9 Apr 2019 16:19:26 +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 534CC5D730; Tue, 9 Apr 2019 16:19:26 +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 7C886181AC48; Tue, 9 Apr 2019 16:19:25 +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 x39GIfvM016356 for ; Tue, 9 Apr 2019 12:18:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 69A51422B; Tue, 9 Apr 2019 16:18:41 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61034600D4; Tue, 9 Apr 2019 16:18:39 +0000 (UTC) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) (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 299B4307EAA0; Tue, 9 Apr 2019 16:18:30 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id k14so20522008qtb.0; Tue, 09 Apr 2019 09:18:30 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:f701:d7d6:9e6a:ca5e:8a85:57a7]) by smtp.gmail.com with ESMTPSA id y34sm19152889qta.96.2019.04.09.09.18.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 09:18:28 -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=AcMRf+viAVhhnc9Tu4WVxGfZ6HwC6DGSyUHI6wlGGmE=; b=qk/HrpF4VuB+pdh2mch92PppAPwDeymA4oRYWLsY2e4aGKJoBDpzmA4vvy1hAFvwm9 cNx2bZRvgjv6IB8kBGyznz+F2JW8EaqcHguzKmy7NcNw3bKqZaeituMrpsRUSxgJrNPA QtTWxlrdHLwJa4gVjZoqMoZ7OHcfqu53oYb3DLIxvvmApI0M9qNlHhQrF9be/IaiEG/j iwjuTLS35ahwFQCQecZk37Gdaxf1+lUjXGS1cQGT+TZxd+D577r+JcjryPrOqdktrtg1 bOVSJMsITVd/n7gLXFeyBpR1hQpACgL7TG3umjnx0X1qj+vXHmTiPH39t50PUbPCvFq8 antg== 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=AcMRf+viAVhhnc9Tu4WVxGfZ6HwC6DGSyUHI6wlGGmE=; b=UoFOV7IRRgqNpAd6aeRFYiuE9vvqnuiWBW6ZaZ6WYBo6fB61n9OS2cKwL34P1CZH+K 8FwfNz5X0lWK8uaKpueQAWydiuVw5+w1RVBbEQ63c9Ok/jJcqWID11pBagFpozWKYV4g 5RvSehNQkDnR3tDkfwEIzSwtsiY07xJ606rX4z1Q/H/e3RcS6Q7B9k3kKY8MfOXaQs8s 8CdsYA0deb4/SEg4MOi13TVoB8Qc5F36K9AH6GzAuoKJkJgeRqQf1XsH4U8eHgXgt7hS 4TwRRPk81TOzPjNq91osF6mcF0WJ3wWeOpJ7N1FNEzzJ86Qg4JucKqi6hFDxLiViHXu8 EReA== X-Gm-Message-State: APjAAAWGTZWVGO/WpVVeUo94SDX1qLslQ9B1Qk9iAGa6lHBmkpM+d1d2 jEIbfrjtb4AwRF+uYG1aK7vFmEx5 X-Google-Smtp-Source: APXvYqwtBm1uzOi9RnW/o7jwiKLIVXCyQ/n9PDF340HnfOHPZ4J1tQwdy5Rc6/LYS2udFd29lcs+lA== X-Received: by 2002:ac8:2dc3:: with SMTP id q3mr30647196qta.19.1554826708630; Tue, 09 Apr 2019 09:18:28 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Tue, 9 Apr 2019 13:18:15 -0300 Message-Id: <20190409161816.21542-3-danielhb413@gmail.com> In-Reply-To: <20190409161816.21542-1-danielhb413@gmail.com> References: <20190409161816.21542-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.44]); Tue, 09 Apr 2019 16:18:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 09 Apr 2019 16:18:30 +0000 (UTC) for IP:'209.85.160.193' DOMAIN:'mail-qt1-f193.google.com' HELO:'mail-qt1-f193.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.142 (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.193 mail-qt1-f193.google.com 209.85.160.193 mail-qt1-f193.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , pkrempa@redhat.com Subject: [libvirt] [PATCH v2 2/3] qemu_process: setting QEMU_CAPS_QUERY_CURRENT_MACHINE caps 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 09 Apr 2019 16:19:30 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The new QMP API query-current-machine reports VM capabilities that can vary depending on the VM configuration, in contrast to most QEMU caps that can be set once during libvirtd init as exposed in qemu_capabilities.c. As such, to properly set the runtime capabilities exposed by this API, we must query them at VM launch time. To do that, a new function called qemuProcessSetCurrentMachineCaps is called in qemuProcessLaunch. A new struct called qemuMonitorCurrentMachineInfo was created to host the output of the API (which contains only the wakeup-suspend-support flag for now, but can be expanded in the future). This struct is populated by qemuMonitorGetCurrentMachineInfo, which does the heavy work - executes query-current-machine, parses the result and populates the qemuMonitorCurrentMachineInfo struct. qemuProcessSetCurrentMachineCaps can then read the structure and set the capabilities accordingly. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_monitor.c | 17 ++++++++++++ src/qemu/qemu_monitor.h | 11 ++++++++ src/qemu/qemu_monitor_json.c | 53 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 5 ++++ src/qemu/qemu_process.c | 36 ++++++++++++++++++++++++ 5 files changed, 122 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index babcbde878..d4222f0bcc 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4472,3 +4472,20 @@ qemuMonitorGetPRManagerInfo(qemuMonitorPtr mon, virHashFree(info); return ret; } + +int +qemuMonitorGetCurrentMachineInfo(qemuMonitorPtr mon, + qemuMonitorCurrentMachineInfoPtr info) +{ + int ret =3D -1; + + QEMU_CHECK_MONITOR(mon); + + if (qemuMonitorJSONGetCurrentMachineInfo(mon, info) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + return ret; +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 086195ff98..fcd5a022b5 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1220,4 +1220,15 @@ struct _qemuMonitorPRManagerInfo { int qemuMonitorGetPRManagerInfo(qemuMonitorPtr mon, virHashTablePtr *retinfo); =20 +struct _qemuMonitorCurrentMachineInfo { + bool wakeupSuspendSupport; +}; + +typedef struct _qemuMonitorCurrentMachineInfo qemuMonitorCurrentMachineIn= fo; +typedef qemuMonitorCurrentMachineInfo *qemuMonitorCurrentMachineInfoPtr; + +int +qemuMonitorGetCurrentMachineInfo(qemuMonitorPtr mon, + qemuMonitorCurrentMachineInfoPtr info); + #endif /* LIBVIRT_QEMU_MONITOR_H */ diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8e6c3ccd63..c6a2a59e6b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8449,3 +8449,56 @@ qemuMonitorJSONGetPRManagerInfo(qemuMonitorPtr mon, return ret; =20 } + +static int +qemuMonitorJSONExtractCurrentMachineInfo(virJSONValuePtr reply, + qemuMonitorCurrentMachineInfoPtr = info) +{ + virJSONValuePtr data; + int ret =3D -1; + + data =3D virJSONValueObjectGetObject(reply, "return"); + if (!data) + goto malformed; + + if (virJSONValueObjectGetBoolean(data, "wakeup-suspend-support", + &info->wakeupSuspendSupport) < 0) { + goto malformed; + } + + ret =3D 0; + + out: + return ret; + + malformed: + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed qemu-current-machine reply")); + goto out; +} + +int +qemuMonitorJSONGetCurrentMachineInfo(qemuMonitorPtr mon, + qemuMonitorCurrentMachineInfoPtr info) +{ + int ret =3D -1; + virJSONValuePtr cmd; + 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; + + ret =3D qemuMonitorJSONExtractCurrentMachineInfo(reply, info); + + 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..746b7072ca 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -576,4 +576,9 @@ int qemuMonitorJSONGetPRManagerInfo(qemuMonitorPtr mon, virHashTablePtr info) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); =20 +int +qemuMonitorJSONGetCurrentMachineInfo(qemuMonitorPtr mon, + qemuMonitorCurrentMachineInfoPtr info) + 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 47d8ca2ff1..b60c1ecfbe 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6461,6 +6461,39 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver= Ptr driver, return ret; } =20 +static int +qemuProcessSetCurrentMachineCaps(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuDomainAsyncJob asyncJob) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + qemuMonitorCurrentMachineInfoPtr info; + int ret =3D -1; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE)) + return 0; + + if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + return -1; + + if (VIR_ALLOC(info) < 0) + return -1; + + ret =3D qemuMonitorGetCurrentMachineInfo(priv->mon, info); + + if (qemuDomainObjExitMonitor(driver, vm) < 0) + ret =3D -1; + + if (ret < 0) + goto cleanup; + + if (info->wakeupSuspendSupport) + virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_PM_WAKEUP_SUPPORT); + + cleanup: + VIR_FREE(info); + return ret; +} =20 /** * qemuProcessLaunch: @@ -6778,6 +6811,9 @@ qemuProcessLaunch(virConnectPtr conn, if (qemuProcessSetupDiskThrottlingBlockdev(driver, vm, asyncJob) < 0) goto cleanup; =20 + if (qemuProcessSetCurrentMachineCaps(driver, vm, asyncJob) < 0) + goto cleanup; + /* Since CPUs were not started yet, the balloon could not return the m= emory * to the host and thus cur_balloon needs to be updated so that GetXML= desc * and friends return the correct size in case they can't grab the job= */ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 22:47:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1554826741; cv=none; d=zoho.com; s=zohoarc; b=EZusyVbPT3VanUgav+Y88abihB1MLCTl5VSPCZGm0WkRsIIco5a5qSG/ymkyNJOlMoD/UOwjMap7qv3zTOz6BkwauFYCV2K6HFmMTaYW2nIoYQW5C/wWj2HlY7ZU4eiuyVHeAHkqrp6iuiEaX7P55n/p7Ty9MV2W7zkIUl9KNkg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1554826741; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=CdyN4acTQGM7p92D5CNZoCufMWXdOuRpA+eY003qfAE=; b=kG+49hICNffkjSI/7G5iyP4Xbe25uSjtfSdHntQkHr8N/i3TDbRe6V+RCzCPybhhubhGzK0qQCJb2ctY2VnZiv+8OE1R607faXXmYhPWPVMQr4BtWCVc/yqnGQvRvX1xJaHQAcgGOaAss79sl3Ruh2QLMaPe5Goy01JWYHZvG94= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554826741533300.5626790404484; Tue, 9 Apr 2019 09:19:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 988EB70D74; Tue, 9 Apr 2019 16:18:59 +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 F2C66600CC; Tue, 9 Apr 2019 16:18:56 +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 1C0623FB10; Tue, 9 Apr 2019 16:18:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x39GIgaT016371 for ; Tue, 9 Apr 2019 12:18:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id D0A0C5D961; Tue, 9 Apr 2019 16:18:42 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C8A475D9C9; Tue, 9 Apr 2019 16:18:40 +0000 (UTC) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) (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 81B7630611FA; Tue, 9 Apr 2019 16:18:31 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id k130so10631251qke.3; Tue, 09 Apr 2019 09:18:31 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:f701:d7d6:9e6a:ca5e:8a85:57a7]) by smtp.gmail.com with ESMTPSA id y34sm19152889qta.96.2019.04.09.09.18.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 09:18:30 -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=G1hvSyJDjT54u5HHde/p2qWl3qY+8Gj9d+UpRqTftgQ=; b=SrUpXgApEy3QXnq+DaEkYOxHsCxhkuVtKaI3KqGfDT4vSr1PJWh5ol2RdF2tqDFoKj NNd0Zv6HjfP/kzziByWOf2x/ixbhbQb9m7k+Sc6J8JXK8jZVjc5B9tvNnR79JcHXLMKt CCnvlTr2osNskG2Hhvy9eN8EUQrq9f2jPQhQFJ0+LjKnH/R1FZ80Wsy4uwHPufWjF8ZY vVTcRkRum1zsNjtsuSC5NiXKcw1dvsW0VWE+P8wE5qSKYJSxJjrHRBwcSpVLa4Eqns7H G74ILJur2zX71aitOKGDmzASd0gbnyOHoqvvWvrxIF6hMtXJho4SM3aVvWKsW4hjfe1H hkTg== 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=G1hvSyJDjT54u5HHde/p2qWl3qY+8Gj9d+UpRqTftgQ=; b=cv1GMFuVYAtvcw5PKX5Al2H5DnkpkKSYpWHhVoKhqSbbVNI7ahzVMRfDNo+DuI/zUK 5JwYS4XnrKr3J1aS8ZwKpxz82NaQY3rFtzb3BJI61bNMByI977AHFyJvXxrOSdp1Xtz6 RGGnqjuqsp8yXwt6jYbwg8Oy2/n7zHINrsFC1VkCI30zX4QeTOTik9h0ll3efANFxOGp wk4MTzEZc1CfSduETETDtk2ymmaitI/HICg2+v0ZJ1PM7KlJjsNvbPyMRfbb/s0ZihGd +5/PIuMOkXhOmSr67OjTras4SS2zIwpd8QI+obBtXdO1VfRc1Xg2y5/mQ5nMZUXzNYyz yFrA== X-Gm-Message-State: APjAAAWOwpvnwOL06dIR0JaMsWSpq4U5zXyPIruWA+McsvHFCKcFOGXf BlWjMBHC1J2+BA2TneSQfhGC7Boi X-Google-Smtp-Source: APXvYqzBjznu4GCdzb0xfFmUsrZP1vdhNOb3yb8iiabyPBx6rRq+vFr4FTxJc5FrUlLgmCsAY9EYqQ== X-Received: by 2002:a37:a543:: with SMTP id o64mr27944605qke.235.1554826710526; Tue, 09 Apr 2019 09:18:30 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Tue, 9 Apr 2019 13:18:16 -0300 Message-Id: <20190409161816.21542-4-danielhb413@gmail.com> In-Reply-To: <20190409161816.21542-1-danielhb413@gmail.com> References: <20190409161816.21542-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.48]); Tue, 09 Apr 2019 16:18:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 09 Apr 2019 16:18:31 +0000 (UTC) for IP:'209.85.222.193' DOMAIN:'mail-qk1-f193.google.com' HELO:'mail-qk1-f193.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.108 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.222.193 mail-qk1-f193.google.com 209.85.222.193 mail-qk1-f193.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , Balamuruhan S , pkrempa@redhat.com Subject: [libvirt] [PATCH v2 3/3] qemuDomainPMSuspendForDuration: check for QEMU_CAPS_PM_WAKEUP_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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 09 Apr 2019 16:19:00 +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_PM_WAKEUP_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 --- src/qemu/qemu_driver.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7e5bbc3cc9..6ee1247c7b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19152,6 +19152,7 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, virQEMUDriverPtr driver =3D dom->conn->privateData; virDomainObjPtr vm; qemuAgentPtr agent; + qemuDomainObjPrivatePtr priv; int ret =3D -1; =20 virCheckFlags(0, -1); @@ -19174,6 +19175,26 @@ 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. + */ + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE) && + !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_PM_WAKEUP_SUPPORT)) { + + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%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