From nobody Sun Feb 8 17:42:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594930340; cv=none; d=zohomail.com; s=zohoarc; b=VzlZGFzQAWPdfHb6x9TrjopMhqk7sQlyYRWyohD22yTg2r2ukhtGH45oxWStiThhcubruPid8gU3nzjWAs6rLWwFwe2pWjwk9b703z08VddmmPZx766SK0JbnvnwjdxBkAQHRt+alWNZ1du84hC9fPBZEyQE5eeziyE/feastXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594930340; 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; bh=UEdGdUnHZfF7evPEBwI1hrFVDY7/RTwDXdYvkX0n4T0=; b=m6YDC3T0IrDtSrmhVZSMmpqRGGZt9x/gSKUelsjbXVcrGH0Wux3rEts/z3uSuBtZzvlscbyAK5VQ6C1NfTL0g2EFecAqCYVP//m8uIN7bi/HhI4d9aB0xC6zN7lsPT+I7SqWAhOQs/VgA7ZSk8RcENER1AKha1ogVRNI68AXi6k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 159493034086458.73536210517966; Thu, 16 Jul 2020 13:12:20 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-9o7bixGNP7y4gC6t5_xYHw-1; Thu, 16 Jul 2020 16:12:17 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F5D810059AA; Thu, 16 Jul 2020 20:12:12 +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 E410772AE0; Thu, 16 Jul 2020 20:12:11 +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 58A2F1809554; Thu, 16 Jul 2020 20:12:10 +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 06GK97fb009554 for ; Thu, 16 Jul 2020 16:09:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8A59B19D7B; Thu, 16 Jul 2020 20:09:07 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.40.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B24919D7D for ; Thu, 16 Jul 2020 20:09:04 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id CC2C52406B8; Thu, 16 Jul 2020 22:09:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594930339; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=UEdGdUnHZfF7evPEBwI1hrFVDY7/RTwDXdYvkX0n4T0=; b=YgE62bS50GPiyAyS+oAG0/d5kDj6xILSpgu4WbPHMiahIx+IfmdOWi/2foUFpCbmrpRZ2B /4VY/MZf2DbboGgxeD0ZwdUHfd1lZnjW8RAMSXyIA0DOz/5cY2BFgoz64owlxJ3uSoMdwZ 2+u3le8ewIZYL3rear+gPmwPlTlv1G0= X-MC-Unique: 9o7bixGNP7y4gC6t5_xYHw-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] qemu_monitor: Add API for checking CPU migratable property Date: Thu, 16 Jul 2020 22:08:46 +0200 Message-Id: <19e8b0318698e58fbf8e0e1fd3020c914e3e1d8a.1594930068.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Mark Mielke 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark --- src/qemu/qemu_monitor.c | 18 ++++++++++++++++++ src/qemu/qemu_monitor.h | 4 ++++ src/qemu/qemu_monitor_json.c | 27 +++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 4 ++++ 4 files changed, 53 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 2c66397f8b..637361d24d 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4526,6 +4526,24 @@ qemuMonitorGetJobInfo(qemuMonitorPtr mon, } =20 =20 +/* qemuMonitorGetCPUMigratable: + * + * Get the migratable property of the CPU object. + * + * Returns -1 on error, + * 1 when the property is not supported, + * 0 on success (@migratable is set accordingly). + */ +int +qemuMonitorGetCPUMigratable(qemuMonitorPtr mon, + bool *migratable) +{ + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONGetCPUMigratable(mon, migratable); +} + + int qemuMonitorTransactionBitmapAdd(virJSONValuePtr actions, const char *node, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 50a337715d..1c1b0c9b89 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1377,6 +1377,10 @@ int qemuMonitorGetJobInfo(qemuMonitorPtr mon, qemuMonitorJobInfoPtr **jobs, size_t *njobs); =20 +int +qemuMonitorGetCPUMigratable(qemuMonitorPtr mon, + bool *migratable); + int qemuMonitorTransactionBitmapAdd(virJSONValuePtr actions, const char *node, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index d808c4b55b..83f169e31b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -9388,3 +9388,30 @@ qemuMonitorJSONGetJobInfo(qemuMonitorPtr mon, =20 return 0; } + + +int +qemuMonitorJSONGetCPUMigratable(qemuMonitorPtr mon, + bool *migratable) +{ + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("qom-get", + "s:path", QOM_CPU_PATH, + "s:property", "migratable", + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return -1; + + if (qemuMonitorJSONHasError(reply, "GenericError")) + return 1; + + if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_BOOLEAN) < 0) + return -1; + + return virJSONValueGetBoolean(virJSONValueObjectGet(reply, "return"), + migratable); +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 83c5e25ca5..84fea25983 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -690,3 +690,7 @@ int qemuMonitorJSONSetDBusVMStateIdList(qemuMonitorPtr = mon, const char *vmstatepath, const char **list) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); + +int +qemuMonitorJSONGetCPUMigratable(qemuMonitorPtr mon, + bool *migratable); --=20 2.27.0