From nobody Fri May 16 08:40:39 2025 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.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; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496654837948827.952411744442; Mon, 5 Jun 2017 02:27:17 -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 C51A823E6D9; Mon, 5 Jun 2017 09:27:14 +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 F0C5217F20; Mon, 5 Jun 2017 09:27:13 +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 81E8B4BB74; Mon, 5 Jun 2017 09:27:11 +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 v559RARS002006 for ; Mon, 5 Jun 2017 05:27:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 32C238401E; Mon, 5 Jun 2017 09:27:10 +0000 (UTC) Received: from virval.usersys.redhat.com (dhcp129-92.brq.redhat.com [10.34.129.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC7E98199A for ; Mon, 5 Jun 2017 09:27:05 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 99C6E10008A; Mon, 5 Jun 2017 11:27:04 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C51A823E6D9 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C51A823E6D9 From: Jiri Denemark To: libvir-list@redhat.com Date: Mon, 5 Jun 2017 11:26:49 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/15] conf: Make error reporting in virCPUDefIsEqual optional 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.29]); Mon, 05 Jun 2017 09:27:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The function will be used in paths where mismatching CPU defs are not an error. Signed-off-by: Jiri Denemark --- src/conf/cpu_conf.c | 119 ++++++++++++++++++++++++++++++---------------= ---- src/conf/cpu_conf.h | 3 +- src/conf/domain_conf.c | 2 +- 3 files changed, 77 insertions(+), 47 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index a4be5742e..79ed5e646 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -811,7 +811,8 @@ virCPUDefAddFeature(virCPUDefPtr def, =20 bool virCPUDefIsEqual(virCPUDefPtr src, - virCPUDefPtr dst) + virCPUDefPtr dst, + bool reportError) { bool identical =3D false; size_t i; @@ -820,97 +821,123 @@ virCPUDefIsEqual(virCPUDefPtr src, return true; =20 if ((src && !dst) || (!src && dst)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Target CPU does not match source")); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target CPU does not match source")); + } goto cleanup; } =20 if (src->type !=3D dst->type) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU type %s does not match source %s"), - virCPUTypeToString(dst->type), - virCPUTypeToString(src->type)); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU type %s does not match source %s"= ), + virCPUTypeToString(dst->type), + virCPUTypeToString(src->type)); + } goto cleanup; } =20 if (src->mode !=3D dst->mode) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU mode %s does not match source %s"), - virCPUModeTypeToString(dst->mode), - virCPUModeTypeToString(src->mode)); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU mode %s does not match source %s"= ), + virCPUModeTypeToString(dst->mode), + virCPUModeTypeToString(src->mode)); + } goto cleanup; } =20 if (src->arch !=3D dst->arch) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU arch %s does not match source %s"), - virArchToString(dst->arch), - virArchToString(src->arch)); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU arch %s does not match source %s"= ), + virArchToString(dst->arch), + virArchToString(src->arch)); + } goto cleanup; } =20 if (STRNEQ_NULLABLE(src->model, dst->model)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU model %s does not match source %s"), - NULLSTR(dst->model), NULLSTR(src->model)); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU model %s does not match source %s= "), + NULLSTR(dst->model), NULLSTR(src->model)); + } goto cleanup; } =20 if (STRNEQ_NULLABLE(src->vendor, dst->vendor)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU vendor %s does not match source %s"), - NULLSTR(dst->vendor), NULLSTR(src->vendor)); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU vendor %s does not match source %= s"), + NULLSTR(dst->vendor), NULLSTR(src->vendor)); + } goto cleanup; } =20 if (STRNEQ_NULLABLE(src->vendor_id, dst->vendor_id)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU vendor id %s does not match source %s= "), - NULLSTR(dst->vendor_id), NULLSTR(src->vendor_id)); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU vendor id %s does not match sourc= e %s"), + NULLSTR(dst->vendor_id), NULLSTR(src->vendor_id= )); + } goto cleanup; } =20 if (src->sockets !=3D dst->sockets) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU sockets %d does not match source %d"), - dst->sockets, src->sockets); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU sockets %d does not match source = %d"), + dst->sockets, src->sockets); + } goto cleanup; } =20 if (src->cores !=3D dst->cores) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU cores %d does not match source %d"), - dst->cores, src->cores); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU cores %d does not match source %d= "), + dst->cores, src->cores); + } goto cleanup; } =20 if (src->threads !=3D dst->threads) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU threads %d does not match source %d"), - dst->threads, src->threads); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU threads %d does not match source = %d"), + dst->threads, src->threads); + } goto cleanup; } =20 if (src->nfeatures !=3D dst->nfeatures) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU feature count %zu does not match sour= ce %zu"), - dst->nfeatures, src->nfeatures); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU feature count %zu does not match = source %zu"), + dst->nfeatures, src->nfeatures); + } goto cleanup; } =20 for (i =3D 0; i < src->nfeatures; i++) { if (STRNEQ(src->features[i].name, dst->features[i].name)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU feature %s does not match source = %s"), - dst->features[i].name, src->features[i].name); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU feature %s does not match sou= rce %s"), + dst->features[i].name, src->features[i].nam= e); + } goto cleanup; } =20 if (src->features[i].policy !=3D dst->features[i].policy) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Target CPU feature policy %s does not match = source %s"), - virCPUFeaturePolicyTypeToString(dst->features[i= ].policy), - virCPUFeaturePolicyTypeToString(src->features[i= ].policy)); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target CPU feature policy %s does not ma= tch source %s"), + virCPUFeaturePolicyTypeToString(dst->featur= es[i].policy), + virCPUFeaturePolicyTypeToString(src->featur= es[i].policy)); + } goto cleanup; } } @@ -920,8 +947,10 @@ virCPUDefIsEqual(virCPUDefPtr src, (src->cache && dst->cache && (src->cache->level !=3D dst->cache->level || src->cache->mode !=3D dst->cache->mode))) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Target CPU cache does not match source")); + if (reportError) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target CPU cache does not match source")); + } goto cleanup; } =20 diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index 09438b68b..b0d891552 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -189,7 +189,8 @@ virCPUDefParseXML(xmlNodePtr node, =20 bool virCPUDefIsEqual(virCPUDefPtr src, - virCPUDefPtr dst); + virCPUDefPtr dst, + bool reportError); =20 char * virCPUDefFormat(virCPUDefPtr def, diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9cd39edf2..a61d293c9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20090,7 +20090,7 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr = src, goto error; } =20 - if (!virCPUDefIsEqual(src->cpu, dst->cpu)) + if (!virCPUDefIsEqual(src->cpu, dst->cpu, true)) goto error; =20 if (!virSysinfoIsEqual(src->sysinfo, dst->sysinfo)) --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list