From nobody Mon Feb 9 01:00:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572960616; cv=none; d=zoho.com; s=zohoarc; b=HBGjLpImBV4fj2T9meqYjS7AekM5id0UhAA3sufFOuZHIl1wbK3KNHzYy+a068inthJUOM6d3nfibdB84avSLiPghrv1Gn8nscgiaLp9epGyakHOL7NTn5EkWF4wBensB5Ylbs//qcjCPnNdsH+6EYBhqIvtIgWVe4c51Rdb+n4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572960616; h=Content-Type:Content-Transfer-Encoding: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=N+HrNcg8uP4boznLofEFF51LCZDCVtnl+MCBPNowut0=; b=n+whpReqk80XnZNAwIetk/XrQfp9Ivw7rGO2eRtwd5ZwNPi/O5k4iQMoJ3tV23QgarTOadjI8LVPfPruekOfqUuMVRALBdF/qt56xPNgZ8zxpEGK/EhUkAEpU3diDDvYLOqNGvyo44ErwSs2lOCHPbEDXznzW5xceSiMPJij0+4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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 1572960616121937.4546072688612; Tue, 5 Nov 2019 05:30:16 -0800 (PST) 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-227-dG_JaoUYMUqpxcf575HT1w-1; Tue, 05 Nov 2019 08:28:40 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C6561005509; Tue, 5 Nov 2019 13:28:35 +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 714E4608B6; Tue, 5 Nov 2019 13:28:35 +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 3079A4E576; Tue, 5 Nov 2019 13:28:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xA5DS0M5003970 for ; Tue, 5 Nov 2019 08:28:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5A9421001B35; Tue, 5 Nov 2019 13:28:00 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2EED71001B32 for ; Tue, 5 Nov 2019 13:27:57 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 8DB8A105B2B; Tue, 5 Nov 2019 14:27:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572960615; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=N+HrNcg8uP4boznLofEFF51LCZDCVtnl+MCBPNowut0=; b=FLrMAyUM2pXQKwBE/3Tk2WnTv+MY6RjD4KEEo6/6r9z2kTe71PZ2T6D8wws76XJhbfJMAw J38kDAhlAynuaMqX8+yrcAT5H5bFJaQh9rYjnqiCfskeMl1TAHPcywyXuCegqP9NmbqbaG u3c8sGgucH5oHrqUw2dTGVj9o6x4qS8= From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 5 Nov 2019 14:27:12 +0100 Message-Id: <181580c010833c3b57a5e74899300bc263025f61.1572958254.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 14/52] qemu: Use virDomainCapsCPUUsable in qemuMonitorCPUDefInfo 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.13 X-MC-Unique: dG_JaoUYMUqpxcf575HT1w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" While virDomainCapsCPUModel structure contains 'usable' field with virDomainCapsCPUUsable type, the lower level structure specific to QEMU driver used virTriStateBool for the same thing and we had to translate between them. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 3: - new patch src/qemu/qemu_capabilities.c | 11 +++-------- src/qemu/qemu_monitor.h | 2 +- src/qemu/qemu_monitor_json.c | 4 ++-- tests/qemumonitorjsontest.c | 4 ++-- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5136fe9202..2a93488520 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2486,14 +2486,9 @@ virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon, goto cleanup; =20 for (i =3D 0; i < defs->ncpus; i++) { - virDomainCapsCPUUsable usable =3D VIR_DOMCAPS_CPU_USABLE_UNKNOWN; - - if (defs->cpus[i].usable =3D=3D VIR_TRISTATE_BOOL_YES) - usable =3D VIR_DOMCAPS_CPU_USABLE_YES; - else if (defs->cpus[i].usable =3D=3D VIR_TRISTATE_BOOL_NO) - usable =3D VIR_DOMCAPS_CPU_USABLE_NO; - - if (virDomainCapsCPUModelsAddSteal(models, &defs->cpus[i].name, us= able, + if (virDomainCapsCPUModelsAddSteal(models, + &defs->cpus[i].name, + defs->cpus[i].usable, &defs->cpus[i].blockers) < 0) goto cleanup; } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 629379802c..0eed8b3f9e 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1107,7 +1107,7 @@ typedef struct _qemuMonitorCPUDefInfo qemuMonitorCPUD= efInfo; typedef qemuMonitorCPUDefInfo *qemuMonitorCPUDefInfoPtr; =20 struct _qemuMonitorCPUDefInfo { - virTristateBool usable; + virDomainCapsCPUUsable usable; char *name; char **blockers; /* NULL-terminated string list */ }; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a6cf70c70a..54963233e6 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5638,11 +5638,11 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon, len =3D virJSONValueArraySize(blockers); =20 if (len =3D=3D 0) { - cpu->usable =3D VIR_TRISTATE_BOOL_YES; + cpu->usable =3D VIR_DOMCAPS_CPU_USABLE_YES; continue; } =20 - cpu->usable =3D VIR_TRISTATE_BOOL_NO; + cpu->usable =3D VIR_DOMCAPS_CPU_USABLE_NO; if (VIR_ALLOC_N(cpu->blockers, len + 1) < 0) return -1; =20 diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 81680d97f8..16a1d40a56 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -478,11 +478,11 @@ testQemuMonitorJSONGetCPUDefinitions(const void *opaq= ue) } while (0) =20 #define CHECK(i, wantname) \ - CHECK_FULL(i, wantname, VIR_TRISTATE_BOOL_ABSENT) + CHECK_FULL(i, wantname, VIR_DOMCAPS_CPU_USABLE_UNKNOWN) =20 #define CHECK_USABLE(i, wantname, usable) \ CHECK_FULL(i, wantname, \ - usable ? VIR_TRISTATE_BOOL_YES : VIR_TRISTATE_BOOL_NO) + usable ? VIR_DOMCAPS_CPU_USABLE_YES : VIR_DOMCAPS_CPU_USABL= E_NO) =20 CHECK(0, "qemu64"); CHECK_USABLE(1, "Opteron_G4", false); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list