From nobody Fri Oct 18 06:23:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1693924026; cv=none; d=zohomail.com; s=zohoarc; b=DzlCBFWbXH7kwaydoWQTYybKnJ2sSCV0teTflKFi+rPSVom4wP/osPl5CYhoIGimm6/7vDANibtxnhEHMGTOWUGmIuWUhG436E8u3nZe2L8+qzNm++MX6eotrr/oQ1i5SdsK+gmiSotkQRS80/26yoPOJvGbHhPYbEjDZcpHdIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693924026; 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=+v7YhqCXkyR7B42187MOKHWk6YxxqpjVqTNtx07Ck8E=; b=IAmSZICaRKd4xzDGunjsLorjGm1MjWnHOr3pR0t65b+Ob+Q5tEjedExNuv1O+itTixNR1xd4kTTjQsIH0i/Ul2f2ScFqP+KwAOCqrzDkzG3cI7dOhkgLAyz3A6sC/3z6NcGVRusDyjDH/r13f5Vudn+1s2na83k1e6Sh5XP/u8I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1693924026261700.7443783140463; Tue, 5 Sep 2023 07:27:06 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-526-NLvttaixM9awI556wEcjGg-1; Tue, 05 Sep 2023 10:25:59 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4130091BA9E; Tue, 5 Sep 2023 14:25:16 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB64147FC73; Tue, 5 Sep 2023 14:25:15 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C42A61946A47; Tue, 5 Sep 2023 14:25:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B5C2B1946589 for ; Tue, 5 Sep 2023 14:25:12 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A6DFE1121318; Tue, 5 Sep 2023 14:25:12 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CAFE1121314 for ; Tue, 5 Sep 2023 14:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693924025; 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=+v7YhqCXkyR7B42187MOKHWk6YxxqpjVqTNtx07Ck8E=; b=W/5nNk1Jwd9Ij5mjDI8yQ6JgWfVvHVF/SSlwnuRR4X1R70gkqpPHL4SNHg2dYE+3ReAflh Rg/41gSLaChzQoWKcfIE4tXMR3ewoaCBg2QJ18L1FrAAp9oPEUDv+Env9DfnNFhDxBw4rh K3wdkamfV3Z4HPH21ezqAqhFaRCQxuE= X-MC-Unique: NLvttaixM9awI556wEcjGg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 47/51] testutilsqemu: Drop infrastructure for fake-caps testing Date: Tue, 5 Sep 2023 16:24:14 +0200 Message-ID: <0f4d4c987e68adb4712994546aa51ccaf53408e7.1693923601.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693924026851100002 Content-Type: text/plain; charset="utf-8" Remove all the code for adding fake machines into the testing capability cache as we no longer have any machines in it. Signed-off-by: Peter Krempa --- tests/testutilsqemu.c | 144 +++--------------------------------------- 1 file changed, 9 insertions(+), 135 deletions(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index cde633e075..05b28699c8 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -25,17 +25,6 @@ static virCPUDef *cpuPower8; static virCPUDef *cpuPower9; static virCPUDef *cpuPower10; - -static const char *qemu_emulators[VIR_ARCH_LAST] =3D { -}; - -static const char *const *qemu_machines[VIR_ARCH_LAST] =3D { -}; - -static const char *qemu_default_ram_id[VIR_ARCH_LAST] =3D { -}; - - char * virFindFileInPath(const char *file) { @@ -120,44 +109,10 @@ virHostCPUX86GetCPUID(uint32_t leaf, } } -static int -testQemuAddGuest(virCaps *caps, - virArch arch) -{ - int nmachines; - virCapsGuestMachine **machines =3D NULL; - virCapsGuest *guest; - virArch emu_arch =3D arch; - - if (qemu_emulators[emu_arch] =3D=3D NULL) - return 0; - - machines =3D virCapabilitiesAllocMachines(qemu_machines[emu_arch], &nm= achines); - guest =3D virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, - arch, qemu_emulators[emu_arch], - NULL, nmachines, machines); - - if (arch =3D=3D VIR_ARCH_I686 || - arch =3D=3D VIR_ARCH_X86_64) - virCapabilitiesAddGuestFeature(guest, VIR_CAPS_GUEST_FEATURE_TYPE_= CPUSELECTION); - - virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, - NULL, NULL, 0, NULL); - - machines =3D virCapabilitiesAllocMachines(qemu_machines[emu_arch], &nm= achines); - virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, - qemu_emulators[emu_arch], - NULL, nmachines, machines); - - return 0; -} - - virCaps * testQemuCapsInit(void) { virCaps *caps; - size_t i; if (!(caps =3D virCapabilitiesNew(VIR_ARCH_X86_64, false, false))) return NULL; @@ -173,11 +128,6 @@ testQemuCapsInit(void) if (!(caps->host.numa =3D virCapabilitiesHostNUMANewHost())) goto cleanup; - for (i =3D 0; i < VIR_ARCH_LAST; i++) { - if (testQemuAddGuest(caps, i) < 0) - goto cleanup; - } - if (virTestGetDebug()) { g_autofree char *caps_str =3D NULL; @@ -291,46 +241,6 @@ void qemuTestDriverFree(virQEMUDriver *driver) } -static void -qemuTestCapsPopulateFakeMachines(virQEMUCaps *caps, - virArch arch) -{ - size_t i; - - virQEMUCapsSetArch(caps, arch); - - for (i =3D 0; qemu_machines[arch][i] !=3D NULL; i++) { - virQEMUCapsAddMachine(caps, - VIR_DOMAIN_VIRT_QEMU, - qemu_machines[arch][i], - NULL, - "qemu64", - 0, - false, - false, - false, - qemu_default_ram_id[arch], - false, - VIR_TRISTATE_BOOL_YES); - virQEMUCapsSet(caps, QEMU_CAPS_TCG); - - virQEMUCapsAddMachine(caps, - VIR_DOMAIN_VIRT_KVM, - qemu_machines[arch][i], - NULL, - "qemu64", - 0, - false, - false, - false, - qemu_default_ram_id[arch], - false, - VIR_TRISTATE_BOOL_YES); - virQEMUCapsSet(caps, QEMU_CAPS_KVM); - } -} - - static int qemuTestCapsCacheInsertData(virFileCache *cache, const char *binary, @@ -349,53 +259,17 @@ int qemuTestCapsCacheInsert(virFileCache *cache, virQEMUCaps *caps) { - size_t i; - - if (virQEMUCapsGetArch(caps) !=3D VIR_ARCH_NONE) { - /* all tests using real caps or architecture are expected to call: - * - * virFileCacheClear(driver.qemuCapsCache); - * - * before populating the cache; - */ - /* caps->binary is populated only for real capabilities */ - if (virQEMUCapsGetBinary(caps)) { - if (qemuTestCapsCacheInsertData(cache, virQEMUCapsGetBinary(ca= ps), caps) < 0) - return -1; - } else { - virArch arch =3D virQEMUCapsGetArch(caps); - g_autoptr(virQEMUCaps) copyCaps =3D NULL; - virQEMUCaps *effCaps =3D caps; - - if (qemu_emulators[arch]) { - /* if we are dealing with fake caps we need to populate ma= chine types */ - if (!virQEMUCapsHasMachines(caps)) { - copyCaps =3D effCaps =3D virQEMUCapsNewCopy(caps); - qemuTestCapsPopulateFakeMachines(copyCaps, arch); - } - - if (qemuTestCapsCacheInsertData(cache, qemu_emulators[arch= ], effCaps) < 0) - return -1; - } - } - } else { - /* in case when caps are missing or are missing architecture, we p= opulate - * everything */ - for (i =3D 0; i < G_N_ELEMENTS(qemu_emulators); i++) { - g_autoptr(virQEMUCaps) tmp =3D NULL; - - if (qemu_emulators[i] =3D=3D NULL) - continue; - - tmp =3D virQEMUCapsNewCopy(caps); - - qemuTestCapsPopulateFakeMachines(tmp, i); - - if (qemuTestCapsCacheInsertData(cache, qemu_emulators[i], tmp)= < 0) - return -1; - } + /* At this point we support only real capabilities. */ + if (virQEMUCapsGetArch(caps) =3D=3D VIR_ARCH_NONE || + !virQEMUCapsGetBinary(caps)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + "missing 'arch' or 'binary' in qemuCaps to be inser= ted into testing cache"); + return -1; } + if (qemuTestCapsCacheInsertData(cache, virQEMUCapsGetBinary(caps), cap= s) < 0) + return -1; + return 0; } --=20 2.41.0