From nobody Mon Sep 16 19:01:41 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1541216242067863.8724688077909; Fri, 2 Nov 2018 20:37:22 -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 1151780472; Sat, 3 Nov 2018 03:37:20 +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 AA7EB60BF1; Sat, 3 Nov 2018 03:37:19 +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 4B93A18045C2; Sat, 3 Nov 2018 03:37:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wA33EmI8011714 for ; Fri, 2 Nov 2018 23:14:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 02DF15D76A; Sat, 3 Nov 2018 03:14:48 +0000 (UTC) Received: from cv1.lan (ovpn-124-15.rdu2.redhat.com [10.10.124.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 304105D75D; Sat, 3 Nov 2018 03:14:44 +0000 (UTC) From: Chris Venteicher To: libvir-list@redhat.com Date: Fri, 2 Nov 2018 22:13:38 -0500 Message-Id: <20181103031338.11600-38-cventeic@redhat.com> In-Reply-To: <20181103031338.11600-1-cventeic@redhat.com> References: <20181103031338.11600-1-cventeic@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: walling@linux.ibm.com, Chris Venteicher , david@redhat.com Subject: [libvirt] [PATCH v4 37/37] qemu_monitor: Default props to migratable when expanding cpu model 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: , MIME-Version: 1.0 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.28]); Sat, 03 Nov 2018 03:37:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" QEMU only returns migratable props when expanding model unless explicitly told to also include non-migratable props. Props will be marked migratable when we are certain QEMU returned only migratable props resulting in consistent information and expansion output for s390 that is consistent with x86. After this change, immediately default prop->migratable =3D _YES for all props when we know QEMU only included migratable props in CPU Model. Set model->migratability =3D true when we have set prop->migratable. Signed-off-by: Chris Venteicher --- src/qemu/qemu_monitor.c | 53 ++++++++++++++- src/qemu/qemu_monitor.h | 7 +- .../caps_2.10.0.s390x.xml | 60 ++++++++--------- .../caps_2.11.0.s390x.xml | 58 ++++++++--------- .../caps_2.12.0.s390x.xml | 56 ++++++++-------- .../qemucapabilitiesdata/caps_2.8.0.s390x.xml | 32 +++++----- .../qemucapabilitiesdata/caps_2.9.0.s390x.xml | 34 +++++----- .../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 64 +++++++++---------- 8 files changed, 210 insertions(+), 154 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 12feb034fd..845cb929a6 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3682,12 +3682,31 @@ qemuMonitorGetCPUModelExpansion(qemuMonitorPtr mon, qemuMonitorCPUModelInfoPtr *expansion ) { + int ret =3D -1; + qemuMonitorCPUModelInfoPtr tmp; + VIR_DEBUG("type=3D%d model_name=3D%s migratable=3D%d", type, input->name, migratable); =20 + *expansion =3D NULL; + QEMU_CHECK_MONITOR(mon); =20 - return qemuMonitorJSONGetCPUModelExpansion(mon, type, migratable, inpu= t, expansion); + if ((ret =3D qemuMonitorJSONGetCPUModelExpansion(mon, type, migratable= , input, &tmp)) < 0) + goto cleanup; + + if (migratable) { + /* Only migratable props were included in expanded CPU model */ + *expansion =3D qemuMonitorCPUModelInfoCopyDefaultMigratable(tmp); + } else { + VIR_STEAL_PTR(*expansion, tmp); + } + + ret =3D 0; + + cleanup: + qemuMonitorCPUModelInfoFree(tmp); + return ret; } =20 =20 @@ -3785,6 +3804,38 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUMode= lInfo *orig) } =20 =20 +qemuMonitorCPUModelInfoPtr +qemuMonitorCPUModelInfoCopyDefaultMigratable(const qemuMonitorCPUModelInfo= *orig) +{ + qemuMonitorCPUModelInfoPtr ret =3D NULL; + qemuMonitorCPUModelInfoPtr tmp =3D NULL; + qemuMonitorCPUPropertyPtr prop =3D NULL; + size_t i; + + if (!(tmp =3D qemuMonitorCPUModelInfoCopy(orig))) + goto cleanup; + + for (i =3D 0; i < tmp->nprops; i++) { + prop =3D tmp->props + i; + + /* Default prop thats in cpu model (true) to migratable (_YES) + * unless prop already explicitly set not migratable (_NO) + */ + if (prop->type =3D=3D QEMU_MONITOR_CPU_PROPERTY_BOOLEAN && + prop->value.boolean && + prop->migratable !=3D VIR_TRISTATE_BOOL_NO) + prop->migratable =3D VIR_TRISTATE_BOOL_YES; + } + + tmp->migratability =3D true; /* prop->migratable =3D YES/NO for all CP= U props */ + + VIR_STEAL_PTR(ret, tmp); + + cleanup: + return ret; +} + + /* Squash CPU Model Info property list * removing props of type boolean matching value */ void diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index f6052ab852..9216f45f59 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1025,7 +1025,7 @@ struct _qemuMonitorCPUModelInfo { char *name; size_t nprops; qemuMonitorCPUPropertyPtr props; - bool migratability; + bool migratability; /* true if prop->migratable is YES/NO for all CPU = props */ }; =20 typedef enum { @@ -1048,6 +1048,11 @@ qemuMonitorCPUModelInfoPtr qemuMonitorCPUModelInfoNe= w(const char *name); qemuMonitorCPUModelInfoPtr qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig); =20 +qemuMonitorCPUModelInfoPtr +qemuMonitorCPUModelInfoCopyDefaultMigratable(const qemuMonitorCPUModelInfo= *orig) + ATTRIBUTE_NONNULL(1); + + int qemuMonitorCPUModelInfoBoolPropAdd(qemuMonitorCPUModelInfoPtr model, const char *prop_name, bool prop_value) diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.10.0.s390x.xml index e000aac384..391bee4f06 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml @@ -118,36 +118,36 @@ 306247 s390x - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.11.0.s390x.xml index 4eb8a39d94..d63f56be7d 100644 --- a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml @@ -125,35 +125,35 @@ 345099 s390x - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.12.0.s390x.xml index 79320d5229..ea3bce232e 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml @@ -133,34 +133,34 @@ 374287 s390x - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_2.8.0.s390x.xml index b010f731a5..858bc49918 100644 --- a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml @@ -108,22 +108,22 @@ 244554 s390x - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_2.9.0.s390x.xml index 5a4371ab83..621036c914 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml @@ -112,23 +112,23 @@ 267973 s390x - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_3.0.0.s390x.xml index 3b5f9818a5..7bb42d211c 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml @@ -135,38 +135,38 @@ 387601 s390x - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list