From nobody Sat Feb 7 10:08:26 2026 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