From nobody Sun Apr 28 20:58:31 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=1556140625; cv=none; d=zoho.com; s=zohoarc; b=aaD9QlqXx5wCXPK71NYbH6fgYk7hnvFT40xMVkr2cIGmiqeTW4pSAKxNeZxcF+9se7JdcraiCGPj/cDBsxJobFp5YYe8wVXT0VLfZFDFtluC4gDICSOJVRmbq5eJwFsir0Sm5AfMlGoykR0Fjl5YOqt4/02hmWM5e3q22jitakE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556140625; 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=VrENKCvBfVaHFZccWlIfTcpoPp6ZSuKqQCM59YSHs3k=; b=Q2D5hiVPC7KwIzPgFNqN8Yn7yLtJvBRxtZS3ScKSoCt4tCZDw3nXFc0mbNOoXKpuc4vL7FN2WTLxEKs0aj2BMHHUhJpBichOmbTzLTYxSuTxPdsEDkNFcHyvNSXByYN4WvQkHjdgMwxvyjQq4C8tksdHGrw0gviKVDT3eumm2JM= 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 1556140625549644.5237774460758; Wed, 24 Apr 2019 14:17:05 -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 51E56C0467E4; Wed, 24 Apr 2019 21:17:04 +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 2D6AE1825B; Wed, 24 Apr 2019 21:17:04 +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 D8D20181B9EC; Wed, 24 Apr 2019 21:17:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3OLGkw4023215 for ; Wed, 24 Apr 2019 17:16:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 056261754D; Wed, 24 Apr 2019 21:16:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F15EF5C207; Wed, 24 Apr 2019 21:16: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 2E5593098457; Wed, 24 Apr 2019 21:16:43 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id d13so22082158qth.5; Wed, 24 Apr 2019 14:16:43 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:f700:e6ba:b454:b6bb:95ea:4a7d]) by smtp.gmail.com with ESMTPSA id s55sm12194122qte.17.2019.04.24.14.16.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2019 14:16: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=jgNEthpEhWkJaa8B9HmpwNmwTBViYqIw2zRxt+FPhEU=; b=ir6W/OSRKFdJmAEhpbElFbyp6YDz96+8YbKEXya/vuBMYvcn6+J4vWkESWYkpr1km0 fvjEv7TNr0OHyKxdqCH2VNnpraRT6qJd6lDbVfy2HPkW8Mxymb6Bkvem9opSn6QtULL4 yKkGiM/8WtNgg2UDfE7zLSRBR74MkFq/sN8zTy8/fWSxBwaB2iiPHcvbjRWj/bEQUH65 LjwxXffjuIAgnl8ih5M8aEdtBm2HJRvgzycZnAoZQsYZBAbEFaJ7RnOBjyQjsm7Bu4ze WNczZ4Fs+FX4xt2vh6abeFMKfEpG2+zrOxsnGHQN4VYkiRCKV8CkhUGM+8Ps3f8kPGBP yFKw== 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=jgNEthpEhWkJaa8B9HmpwNmwTBViYqIw2zRxt+FPhEU=; b=fuMcEzfu8zCpl+7d5UnEYCIhvfjwcErssRT9Po/X9cqhaHdD5G6o3rhjoUGFZjPPar yJlXk4FS3NjItBRTwhOt4KJkSQ+/iYiPOQHQ+U6bWMwohd9Zs/AkeBszKshAogC7iNp5 a2uFAQZwb/H3gqux//wcP3WE1GD4F0ea+rJWmnNgMOhoiIf6HJQBO5aNsjUcakJbRkM+ vZObs6U/2PaI4i/2nruiuZU0DqPRLoFbD02K8x9oTi7gXtjLU/0tkwHqtIHIT62wX/mr pm1F7/jTaKr0ZhgjBsF6gC75b0K5GjULHw12yXATtR4MqfJKP7Ygibw/SM5H1rMMYf6q Wlog== X-Gm-Message-State: APjAAAV5sss9mZTdYBm5gNhitgIrJCqYXDZru652YRd+RawG6Ea3r5Pu nb5W5jjZ0pNdKTfrjar6D+aKL1/Um2s= X-Google-Smtp-Source: APXvYqxQHxfpzSFbWNaXgwRexo+8Ok/pCJO0x82XrBriCwYnoK9A92sGpShtu1+B7l03R5ehJ/T9dA== X-Received: by 2002:a0c:d1f7:: with SMTP id k52mr27579392qvh.5.1556140602276; Wed, 24 Apr 2019 14:16:42 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Wed, 24 Apr 2019 18:16:27 -0300 Message-Id: <20190424211629.20929-2-danielhb413@gmail.com> In-Reply-To: <20190424211629.20929-1-danielhb413@gmail.com> References: <20190424211629.20929-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.42]); Wed, 24 Apr 2019 21:16:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 24 Apr 2019 21:16:43 +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.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.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.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com, Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 1/3] qemu_capabilities: Add QEMU_CAPS_QUERY_CURRENT_MACHINE 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.31]); Wed, 24 Apr 2019 21:17:04 +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. Introduce a libvirt capability that reflects whether qemu has the monitor command. Signed-off-by: Daniel Henrique Barboza Signed-off-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + 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, 6 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f8ea66b577..a0b2ca73fb 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -524,6 +524,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "scsi-disk.device_id", "virtio-pci-non-transitional", "overcommit", + "query-current-machine", ); =20 =20 @@ -969,6 +970,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 23ecef8c63..67c8e80462 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -506,6 +506,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_SCSI_DISK_DEVICE_ID, /* 'device_id' property of scsi disk */ QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL, /* virtio *-pci-{non-}transitional = devices */ QEMU_CAPS_OVERCOMMIT, /* -overcommit */ + QEMU_CAPS_QUERY_CURRENT_MACHINE, /* query-current-machine command */ =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 d6fc996528..2b6aa7b371 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 fcc34b0ae6..8c0965a634 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 bc8e35e226..f4be7017fe 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 Sun Apr 28 20:58:31 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=1556140630; cv=none; d=zoho.com; s=zohoarc; b=izUJUGGlvtxkdflV2dcS8nam3Sky/nNPZ4W/DQZeK+eFH0Azv1rBBTJE3yePO6GshUnehZ6ncVwA+VMaS1LUnwkh8q8pVtd3zZTt/POmJfPlDi2rOzFKU29eNdN2iHzVM0sV/avEOL2QI7VICXCSNH/4V7+lYtWCFH2tVQnV4JM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556140630; 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=ayh6dW8eSC2nA6OzmPy9Z3bOjcNah2QdrXHoJdpolr0=; b=NjtzvAGxHqAVGaxos0NGYi2aFNny86pEYCRQlaxwkBNbxagCDYELOxq/z7tyDm2RGd7CEwl8Lpj+PaF6TfwQ++WZtSehZaGEF7ORxNhpAzbdpmAkPxFpeFS+4wEeABu2g9Aj6IPV09C4oqh1SteFweu1JoL1dTs2/2JBR/USSk0= 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 1556140630328835.2833738504493; Wed, 24 Apr 2019 14:17:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE76A3DBC0; Wed, 24 Apr 2019 21:17:08 +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 A30F119729; Wed, 24 Apr 2019 21:17:08 +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 650FA41F3D; Wed, 24 Apr 2019 21:17:08 +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 x3OLGknl023230 for ; Wed, 24 Apr 2019 17:16:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 693391001DE7; Wed, 24 Apr 2019 21:16:46 +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 604CC1001DDB; Wed, 24 Apr 2019 21:16:46 +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 2275A7F36F; Wed, 24 Apr 2019 21:16:45 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id p19so9443026qkm.10; Wed, 24 Apr 2019 14:16:45 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:f700:e6ba:b454:b6bb:95ea:4a7d]) by smtp.gmail.com with ESMTPSA id s55sm12194122qte.17.2019.04.24.14.16.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2019 14:16:43 -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=KsiHfU9VpoVI9XhVDtDWJD0oEG8zJTA1F6a3rAJo92Y=; b=LTB+oLfZWrZ4ecX41Akm+KqaOx2VRJxaxPMkI6+hwTowN4rMmjPgBgYlpFyf/twp5n DdH2w9qdZQvgw5VYFA//C81Gh57HjktT9bvFOkw0vyGFCDuFpW1IBQpAyiMtbd6VXoIs ELYa2a15ouY3J9WUHmsulkFXASRR9n5p+aDko7r8WBwep5in060fmFABlR3h9xmTxfzZ EZAMQxATmraYogpxC3WVZXBCfCZ0dmmKW47UnMleyVkztnMWTIOnE7Fb10k/7vt8MbK9 2lvaN3x4rvgCmz3pYs1eGps5juRKfa4uukmI7Xn9muZF5dOj2HegOhiLMKmk4h5jBA3x JNSw== 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=KsiHfU9VpoVI9XhVDtDWJD0oEG8zJTA1F6a3rAJo92Y=; b=QTmhCZZrumWSoTfOv8YQBHIdXDaALdxgC4R6l8gkirnUaEy/5dTyBCljCctJyyQbne xMf1KH35tRpULkkyG5yEGCRl0iYxCkNGyR51m2WsS+d1OKJCoVbLESRl8Tdq7BfvJ2eY 9df/mYLPsUZL6gkYZPl0iDhWEAUUXHAx6O5uWh2Ehnq4P6BDlwabUY5wXqAul14gVTe7 WWS7qagyP7fHm8FEuBlx0/lVUWWoXHXEoFJI451wID57ajxl9svuQOPlBFJ1mNwI/F70 6xZFTpsphkiUdHqI/DCi+/CCCkAsxoIVPwvSy852cH6w0JpgoNVb2rt8CitaCSkXw7UN dxpA== X-Gm-Message-State: APjAAAVChOnMaEY7PzOTp5VSXVzPY9K+ro1US6b5FnZNAkr1yvtCUIRu mBxEwysbz737JUjGj7OSjDnXHVa76eE= X-Google-Smtp-Source: APXvYqyFwpOLDV6UteR/eFvJSw9bwRTBjy/yW+X7JZlG7WZiHayfzRq44Wir8fp20+r5lt9FMXzaww== X-Received: by 2002:a37:5a05:: with SMTP id o5mr23792411qkb.94.1556140604287; Wed, 24 Apr 2019 14:16:44 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Wed, 24 Apr 2019 18:16:28 -0300 Message-Id: <20190424211629.20929-3-danielhb413@gmail.com> In-Reply-To: <20190424211629.20929-1-danielhb413@gmail.com> References: <20190424211629.20929-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]); Wed, 24 Apr 2019 21:16:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 24 Apr 2019 21:16:45 +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.023 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, 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.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v4 2/3] qemu_monitor: Introduce handler for 'query-current-machine' command 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 24 Apr 2019 21:17:09 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Michal Privoznik So far, this command returns a structure with only one member: 'wakeup-suspend-support'. But that's okay. It's what we are after anyway. Based-on-work-of: Daniel Henrique Barboza Signed-off-by: Michal Privoznik --- src/qemu/qemu_monitor.c | 10 ++++++++ src/qemu/qemu_monitor.h | 9 +++++++ src/qemu/qemu_monitor_json.c | 50 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 5 ++++ 4 files changed, 74 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index babcbde878..e1fcbac13f 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4472,3 +4472,13 @@ qemuMonitorGetPRManagerInfo(qemuMonitorPtr mon, virHashFree(info); return ret; } + + +int +qemuMonitorGetCurrentMachineInfo(qemuMonitorPtr mon, + qemuMonitorCurrentMachineInfoPtr info) +{ + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONGetCurrentMachineInfo(mon, info); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index caf62af5e2..9242d37407 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1221,4 +1221,13 @@ struct _qemuMonitorPRManagerInfo { int qemuMonitorGetPRManagerInfo(qemuMonitorPtr mon, virHashTablePtr *retinfo); =20 +typedef struct _qemuMonitorCurrentMachineInfo qemuMonitorCurrentMachineIn= fo; +typedef qemuMonitorCurrentMachineInfo *qemuMonitorCurrentMachineInfoPtr; +struct _qemuMonitorCurrentMachineInfo { + bool wakeupSuspendSupport; +}; + +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 e7d063a5a8..908967f46c 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8459,3 +8459,53 @@ qemuMonitorJSONGetPRManagerInfo(qemuMonitorPtr mon, return ret; =20 } + + +static int +qemuMonitorJSONExtractCurrentMachineInfo(virJSONValuePtr reply, + qemuMonitorCurrentMachineInfoPtr = info) +{ + virJSONValuePtr data; + + data =3D virJSONValueObjectGetObject(reply, "return"); + if (!data) + goto malformed; + + if (virJSONValueObjectGetBoolean(data, "wakeup-suspend-support", + &info->wakeupSuspendSupport) < 0) + goto malformed; + + return 0; + + malformed: + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed qemu-current-machine reply")); + return -1; +} + + +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 */ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 20:58:31 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=1556140613; cv=none; d=zoho.com; s=zohoarc; b=Ts3cdVhfitUjbiL9q7cAiyEAhWJRMGv6wqZOArmA+q/PJULupxNQf6mdT7IV4vKTsy3iE2mfqHIH1w1fqBthrYKRA5uQAL8YwxbAfQGgMG9rwLn4VgmCrL6qat7bJLgwt0wYSlJ7mkplk7im8v1VGIU6x32Dm7eXRs5hGyqt2pY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556140613; 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=hpNy5YAH2vIKj5UUMPgRodKuSgnedvZNBCtjhCf6AnU=; b=cPBLZDMaIkRNfAFaIOf65qStxeJG7jUT79aMrzVe02ePsOWY74xTWj5BT9J7kff6rRouoGq8LxmYArqiij+6LIHoBxRC82Q+Twa6hiD3vib6CGBb5rHzaLYbCc/v4HDh1rp/vrL3Y2Bt/Rra9nrF7ysukdIKCox3Q6Uy+1Vgaj8= 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 1556140613764138.0392310368992; Wed, 24 Apr 2019 14:16:53 -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 6B0763082A24; Wed, 24 Apr 2019 21:16: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 3D371600C1; Wed, 24 Apr 2019 21:16:52 +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 7584A181B9E0; Wed, 24 Apr 2019 21:16:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3OLGo57023245 for ; Wed, 24 Apr 2019 17:16:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 633A117A7C; Wed, 24 Apr 2019 21:16:50 +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 5BACB4384; Wed, 24 Apr 2019 21:16:48 +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 421FF7BDC4; Wed, 24 Apr 2019 21:16:47 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id c35so7343210qtk.3; Wed, 24 Apr 2019 14:16:47 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:f700:e6ba:b454:b6bb:95ea:4a7d]) by smtp.gmail.com with ESMTPSA id s55sm12194122qte.17.2019.04.24.14.16.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2019 14:16:46 -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=nqu2q8ZNg8w+RrS+YwAvICpy17YPfd+NvjqI/gbc5og=; b=W/KThND1k6F3Htt0ButNMprJBIfiLDhdnMYFDtITFj79nTh7b6K0NhyW4V/NV1IrUb 1nCgg+OPq5UYAy9ZWeJ7j2R5x3UX4hODq+i+EkB2zV/hDvhq1oi4PpBHbVx7Eb9AsYh2 WPTMFvwTXkkqCUzxA//MfiZv7d9QLdlgEoS4nDz5uOa8L7GYXe/D5vE6392KPFQPPEDj wbcHM9E4pTQ/gP7F9DL86D2hDCT3Jx5H+pwEj/lScLzLkNM7Iti9JGGXfY9AwmD8pTOL ADfobctawf7TLkb8yDwn+XPngVllkjjeX8CYyQK5PfDmmww6OJIDjiyfZ0yXANNQM6h9 roMA== 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=nqu2q8ZNg8w+RrS+YwAvICpy17YPfd+NvjqI/gbc5og=; b=P2RWwkG8sGr5l7e5BENP6WkWoFg5sM2fNPpypef9mwzpwmgzXocC0+c2QFsh7P0iml J2pT/Bxc85tp3qgAxNp4CJITAKARBXrzwHyj/tOsOLFDhrr68pWwfwRvcgJKxUixZqdZ 0h2dCCe/P9jcJkh9mZZZEXhs+CtAjFnMuwcJWq5KvY7a6GMcUHqoSXeEhlkUmd/cNsBr zX5eZyunOwafUayG7wlEtD0woGJ4tyMAK1C3GdV7OJc0wQg+/69RyyLm537j+QL8os9O gCei8FliVc8eeKr1J1qpenZ2xYoYwRSKqyNYSkUNEiPvGQQyLtyE5R1jb85BY6W+yHbu t9Yw== X-Gm-Message-State: APjAAAVqUORz4KuP/2gYzx2ZYOrnYX8NvaGJUhd6CrXzCqEiq7eKkla1 Im+3Q4JcmXv0CYM9r8pzCBmYPyUm0zQ= X-Google-Smtp-Source: APXvYqww/rU4Y8hFSrPpXkjX/ekgMVgui1d9yuQiD8exvksridDMt1oCnNAeTmTol8hwwcc047OCaA== X-Received: by 2002:a0c:d6ce:: with SMTP id l14mr11857983qvi.2.1556140606442; Wed, 24 Apr 2019 14:16:46 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Wed, 24 Apr 2019 18:16:29 -0300 Message-Id: <20190424211629.20929-4-danielhb413@gmail.com> In-Reply-To: <20190424211629.20929-1-danielhb413@gmail.com> References: <20190424211629.20929-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]); Wed, 24 Apr 2019 21:16:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 24 Apr 2019 21:16:47 +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.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Balamuruhan S , pkrempa@redhat.com, Daniel Henrique Barboza Subject: [libvirt] [PATCH v4 3/3] qemuDomainPMSuspendForDuration: check for wake-up 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.45]); Wed, 24 Apr 2019 21:16:53 +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, and we are able to determine that, avoid suspending the guest at all. To be able to determine this support, QEMU needs to implement the 'query-current-machine' QMP call. This is reflected by the QEMU_CAPS_QUERY_CURRENT_MACHINE cap. If the cap is enabled, a new function qemuDomainProbeQMPCurrentMachine is called. This is wrapper for qemuMonitorGetCurrentMachineInfo, where the 'wakeup-suspend-support' flag is retrieved from 'query-current-machine'. If wakeupSuspendSupport is true, proceed with the regular flow of qemuDomainPMSuspendForDuration. The absence of QEMU_CAPS_QUERY_CURRENT_MACHINE 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 of qemuDomainPMSuspendForDuration, since we can't assume whether the guest has support or not. 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 | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 31d8647eee..d584f6ae66 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19145,6 +19145,35 @@ qemuDomainGetCPUStats(virDomainPtr domain, return ret; } =20 +static int +qemuDomainProbeQMPCurrentMachine(virQEMUDriverPtr driver, + virDomainObjPtr vm, + bool *enabled) +{ + qemuMonitorCurrentMachineInfo info =3D { 0 }; + qemuDomainObjPrivatePtr priv; + int ret =3D -1; + + *enabled =3D false; + priv =3D vm->privateData; + + qemuDomainObjEnterMonitor(driver, vm); + + if (qemuMonitorGetCurrentMachineInfo(priv->mon, &info) < 0) + goto cleanup; + + ret =3D 0; + + if (info.wakeupSuspendSupport) + *enabled =3D true; + + cleanup: + if (qemuDomainObjExitMonitor(driver, vm) < 0) + ret =3D -1; + + return ret; +} + static int qemuDomainPMSuspendForDuration(virDomainPtr dom, unsigned int target, @@ -19152,6 +19181,7 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, unsigned int flags) { virQEMUDriverPtr driver =3D dom->conn->privateData; + qemuDomainObjPrivatePtr priv; virDomainObjPtr vm; qemuAgentPtr agent; int ret =3D -1; @@ -19185,6 +19215,30 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, if (virDomainObjCheckActive(vm) < 0) goto endjob; =20 + /* + * The case we want to handle here is when QEMU has the API (i.e. + * QEMU_CAPS_QUERY_CURRENT_MACHINE is set). Otherwise, do not interfere + * with the suspend process. This means that existing running domains, + * that don't know about this cap, will keep their old behavior of + * suspending 'in the dark'. + */ + priv =3D vm->privateData; + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE)) { + bool enabled; + + if (qemuDomainProbeQMPCurrentMachine(driver, vm, &enabled) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Error executing query-current-machine call")= ); + goto endjob; + } + + if (!enabled) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("Domain does not have suspend support")); + goto endjob; + } + } + if (vm->def->pm.s3 || vm->def->pm.s4) { if (vm->def->pm.s3 =3D=3D VIR_TRISTATE_BOOL_NO && (target =3D=3D VIR_NODE_SUSPEND_TARGET_MEM || --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list