From nobody Mon Apr 29 20:20:07 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1567086351; cv=none; d=zoho.com; s=zohoarc; b=lFttp3lavJAzBHX7zESxI+uX3xD7PBZBVjjULLaP6l69iAmoq5mlWLbBhxRxDiKfsxxscSkIHjNbcOAEuD6LiM2N00ZPLgEBwfUn3rFCpP71hhKQY6dFWSsmWpH4OLaq2rqZpigGB3ih1BBA5N84waZ6UHfFzmMi7VQMk1o+I5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567086351; 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=unYDuP9/RZyQuaO3aeHvQ+gU+ID7B9OvbWHMnDoHviw=; b=i73v7JsslXhSo4oFEPieFNg7X/cjlN6+V8gvqSd14gQnK0fhDRMpC85V7GiGf7tkUGjjWRarXOvgtf74eIfyooy8s9uWciPpfxSZUUHiI+kHVNTX3XIGzBF9CKfvpo4m99l3jo0uvtRutlbfSnG+aqvNpNtZ1IFgss7YKs+VCH4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1567086351279803.1202053046326; Thu, 29 Aug 2019 06:45:51 -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 DF52630832E1; Thu, 29 Aug 2019 13:45:49 +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 B676F1001B13; Thu, 29 Aug 2019 13:45: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 7A25B180B536; Thu, 29 Aug 2019 13:45:49 +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 x7TDjSWs011502 for ; Thu, 29 Aug 2019 09:45:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6C98C60623; Thu, 29 Aug 2019 13:45:28 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id C29676061E; Thu, 29 Aug 2019 13:45:27 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 29 Aug 2019 15:45:16 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/2] qemu: Extract and store vCPU properties as qemu returned them 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.44]); Thu, 29 Aug 2019 13:45:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In addition to the data that libvirt needs and extracts internally, copy and store the whole 'props' JSON sub-object of the data returned by query-hotpluggable-cpus for future use. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 3 +++ src/qemu/qemu_domain.h | 3 +++ src/qemu/qemu_monitor.c | 2 ++ src/qemu/qemu_monitor.h | 6 ++++++ src/qemu/qemu_monitor_json.c | 4 ++++ 5 files changed, 18 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4998474dc9..657f3ecfe4 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1144,6 +1144,7 @@ qemuDomainVcpuPrivateDispose(void *obj) VIR_FREE(priv->type); VIR_FREE(priv->alias); + virJSONValueFree(priv->props); return; } @@ -11920,6 +11921,8 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver, VIR_STEAL_PTR(vcpupriv->type, info[i].type); VIR_FREE(vcpupriv->alias); VIR_STEAL_PTR(vcpupriv->alias, info[i].alias); + virJSONValueFree(vcpupriv->props); + VIR_STEAL_PTR(vcpupriv->props, info[i].props); vcpupriv->enable_id =3D info[i].id; vcpupriv->qemu_id =3D info[i].qemu_id; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 37a00323a7..d097f23342 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -449,6 +449,9 @@ struct _qemuDomainVcpuPrivate { char *alias; virTristateBool halted; + /* copy of the data that qemu returned */ + virJSONValuePtr props; + /* information for hotpluggable cpus */ char *type; int socket_id; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a880da3ab6..58ad109680 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1780,6 +1780,7 @@ qemuMonitorCPUInfoClear(qemuMonitorCPUInfoPtr cpus, VIR_FREE(cpus[i].qom_path); VIR_FREE(cpus[i].alias); VIR_FREE(cpus[i].type); + virJSONValueFree(cpus[i].props); } } @@ -1931,6 +1932,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryH= otpluggableCpusEntry *hotpl VIR_STEAL_PTR(vcpus[mastervcpu].qom_path, hotplugvcpus[i].qom_path= ); VIR_STEAL_PTR(vcpus[mastervcpu].alias, hotplugvcpus[i].alias); VIR_STEAL_PTR(vcpus[mastervcpu].type, hotplugvcpus[i].type); + VIR_STEAL_PTR(vcpus[mastervcpu].props, hotplugvcpus[i].props); vcpus[mastervcpu].id =3D hotplugvcpus[i].enable_id; /* copy state information to slave vcpus */ diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 88c9702530..de85a3ba0d 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -570,6 +570,9 @@ struct qemuMonitorQueryHotpluggableCpusEntry { char *qom_path; /* full device qom path only present for online cpus */ char *alias; /* device alias, may be NULL for non-hotpluggable entitie= s */ + /* verbatim copy of the JSON data representing the CPU which must be u= sed for hotplug */ + virJSONValuePtr props; + /* topology information -1 if qemu didn't report given parameter */ int node_id; int socket_id; @@ -603,6 +606,9 @@ struct _qemuMonitorCPUInfo { /* name of the qemu type to add in case of hotplug */ char *type; + /* verbatim copy of the returned data from qemu which should be used w= hen plugging */ + virJSONValuePtr props; + /* alias of an hotpluggable entry. Entries with alias can be hot-unplu= gged */ char *alias; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index d38b2f2cbe..da1e89dded 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8378,6 +8378,7 @@ qemuMonitorQueryHotpluggableCpusFree(struct qemuMonit= orQueryHotpluggableCpusEntr VIR_FREE(entry->type); VIR_FREE(entry->qom_path); VIR_FREE(entry->alias); + virJSONValueFree(entry->props); } VIR_FREE(entries); @@ -8426,6 +8427,9 @@ qemuMonitorJSONProcessHotpluggableCpusReply(virJSONVa= luePtr vcpu, return -1; } + if (!(entry->props =3D virJSONValueCopy(props))) + return -1; + entry->node_id =3D -1; entry->socket_id =3D -1; entry->core_id =3D -1; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 20:20:07 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1567086335; cv=none; d=zoho.com; s=zohoarc; b=CRkY0i7qsOpDy0Pji9ZUFlvL7FTJm5dQFouwEMImILlyib/nuA/yuRt4LrM4Gha5VCRgbYqe0Y0RSUZ1milZcqC77u20/DNcbi1fY1qw+dTbODkLubO5XI23DichuhSjVSxjeliWTDa3mEnPmHhu3rPzGvAyho/D6oi2U4th6d8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567086335; 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=0whZYs3u+AaIHq8eSDMqMH4euZGZIyMIBv0BxcxiQ7Q=; b=ddt9HCBAcA0WLj0aP0zUi04Pzl7FRpXjlP6pUy6QIybpe/dbN3xwmLVRJiXi0aHKGD1XCnz+vGhggr6Kgu1BdQOADQ4BU7v2HvqDPJ5AuznGzBccn934SeLpPBD4qfwEsc1aAdA4bv90pNbkZdqblmv4SyEe26LHdRsfN0tjNCo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1567086335904533.0444875740853; Thu, 29 Aug 2019 06:45:35 -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 EB2CD87521C; Thu, 29 Aug 2019 13:45:33 +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 98EDE19C4F; Thu, 29 Aug 2019 13:45:33 +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 5A153180B536; Thu, 29 Aug 2019 13:45:32 +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 x7TDjT2G011512 for ; Thu, 29 Aug 2019 09:45:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 60EF6608C1; Thu, 29 Aug 2019 13:45:29 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8ABF5F7DE; Thu, 29 Aug 2019 13:45:28 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 29 Aug 2019 15:45:17 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/2] qemu: command: Use all vCPU properties when creating args for vCPU hotplug 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.6.2 (mx1.redhat.com [10.5.110.68]); Thu, 29 Aug 2019 13:45:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" As qemu documents we should use everything in the 'props' sub-object of the data returned by query-hotpluggable-cpus. Until now we only used everything we recognized, but that may break in cases when qemu introduces new fields. This change requires a fix to the test data as some fields were reordered. https://bugzilla.redhat.com/show_bug.cgi?id=3D1741658 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 19 +++---------------- .../x86-modern-bulk-monitor.json | 8 ++++---- .../x86-modern-individual-add-monitor.json | 4 ++-- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 373ebd6d1a..1ca1ecd2f0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10609,24 +10609,11 @@ qemuBuildHotpluggableCPUProps(const virDomainVcpu= Def *vcpu) qemuDomainVcpuPrivatePtr vcpupriv =3D QEMU_DOMAIN_VCPU_PRIVATE(vcpu); VIR_AUTOPTR(virJSONValue) ret =3D NULL; - if (virJSONValueObjectCreate(&ret, "s:driver", vcpupriv->type, - "s:id", vcpupriv->alias, NULL) < 0) + if (!(ret =3D virJSONValueCopy(vcpupriv->props))) return NULL; - if (vcpupriv->socket_id !=3D -1 && - virJSONValueObjectAdd(ret, "i:socket-id", vcpupriv->socket_id, NUL= L) < 0) - return NULL; - - if (vcpupriv->core_id !=3D -1 && - virJSONValueObjectAdd(ret, "i:core-id", vcpupriv->core_id, NULL) <= 0) - return NULL; - - if (vcpupriv->thread_id !=3D -1 && - virJSONValueObjectAdd(ret, "i:thread-id", vcpupriv->thread_id, NUL= L) < 0) - return NULL; - - if (vcpupriv->node_id !=3D -1 && - virJSONValueObjectAdd(ret, "i:node-id", vcpupriv->node_id, NULL) <= 0) + if (virJSONValueObjectPrependString(ret, "id", vcpupriv->alias) < 0 || + virJSONValueObjectPrependString(ret, "driver", vcpupriv->type) < 0) return NULL; VIR_RETURN_PTR(ret); diff --git a/tests/qemuhotplugtestcpus/x86-modern-bulk-monitor.json b/tests= /qemuhotplugtestcpus/x86-modern-bulk-monitor.json index 4dcb6a2cf5..b1d02b8d43 100644 --- a/tests/qemuhotplugtestcpus/x86-modern-bulk-monitor.json +++ b/tests/qemuhotplugtestcpus/x86-modern-bulk-monitor.json @@ -141,9 +141,9 @@ "arguments": { "driver": "qemu64-x86_64-cpu", "id": "vcpu5", - "socket-id": 1, "core-id": 0, - "thread-id": 1 + "thread-id": 1, + "socket-id": 1 }, "id": "libvirt-3" } @@ -303,9 +303,9 @@ "arguments": { "driver": "qemu64-x86_64-cpu", "id": "vcpu6", - "socket-id": 1, "core-id": 1, - "thread-id": 0 + "thread-id": 0, + "socket-id": 1 }, "id": "libvirt-6" } diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.js= on b/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json index 294198b270..df05e5e3a9 100644 --- a/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json +++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json @@ -141,9 +141,9 @@ "arguments": { "driver": "qemu64-x86_64-cpu", "id": "vcpu7", - "socket-id": 1, "core-id": 1, - "thread-id": 1 + "thread-id": 1, + "socket-id": 1 }, "id": "libvirt-3" } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list