From nobody Tue Dec 16 08:56:43 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.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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505744023738860.9364408818393; Mon, 18 Sep 2017 07:13:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ABDEBC00DB86; Mon, 18 Sep 2017 14:13:42 +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 8A2E561B66; Mon, 18 Sep 2017 14:13:42 +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 4E6E3410B3; Mon, 18 Sep 2017 14:13:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8IDZrhA008678 for ; Mon, 18 Sep 2017 09:35:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id CADD518670; Mon, 18 Sep 2017 13:35:53 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9ECAC1866D for ; Mon, 18 Sep 2017 13:35:47 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 7CC531003E3; Mon, 18 Sep 2017 15:35:46 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com ABDEBC00DB86 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Mon, 18 Sep 2017 15:35:42 +0200 Message-Id: <170967e795f68e64641879c67debaf4e36bb5f4a.1505740922.git.jdenemar@redhat.com> 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.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/6] cpu_conf: Simplify formatting of guest CPU attributes 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 18 Sep 2017 14:13:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark --- src/conf/cpu_conf.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 6058d26fa5..02506c020b 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -604,20 +604,20 @@ virCPUDefFormatBufFull(virBufferPtr buf, if (!def) return 0; =20 - /* Format attributes */ - if (def->type =3D=3D VIR_CPU_TYPE_GUEST) { + /* Format attributes for guest CPUs unless they only specify + * topology or cache. */ + if (def->type =3D=3D VIR_CPU_TYPE_GUEST && + (def->mode !=3D VIR_CPU_MODE_CUSTOM || def->model)) { const char *tmp; =20 - if (def->mode !=3D VIR_CPU_MODE_CUSTOM || def->model) { - if (!(tmp =3D virCPUModeTypeToString(def->mode))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected CPU mode %d"), def->mode); - goto cleanup; - } - virBufferAsprintf(&attributeBuf, " mode=3D'%s'", tmp); + if (!(tmp =3D virCPUModeTypeToString(def->mode))) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected CPU mode %d"), def->mode); + goto cleanup; } + virBufferAsprintf(&attributeBuf, " mode=3D'%s'", tmp); =20 - if (def->model && def->mode =3D=3D VIR_CPU_MODE_CUSTOM) { + if (def->mode =3D=3D VIR_CPU_MODE_CUSTOM) { if (!(tmp =3D virCPUMatchTypeToString(def->match))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected CPU match policy %d"), --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list