From patchwork Tue Jul 24 21:23:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 142827 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp55898ljj; Tue, 24 Jul 2018 14:24:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdIY+lHWFzl01xi/aUnk2TszoYv5Vj5QFjvuhdOlVCwfCHjJh9C6XRRxFa5YRSN+aa89MDa X-Received: by 2002:a37:184b:: with SMTP id j72-v6mr17030497qkh.94.1532467454559; Tue, 24 Jul 2018 14:24:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532467454; cv=none; d=google.com; s=arc-20160816; b=S2JPgTjsCWUmLoX87dlwLCIASz3KJDKh82dYeqSvcFvgq69Ga8rL+w9bo/yskxb8yA G1lp4+NgjfPNgJFoR8d4pUv87GEgt0DF1AXmDKIfb9erBQXRAsaWmwIQWiPrtVUXZmik D3xmNKMjBAJTKSCQM852D8hyRjfzGBcdDVuDq97PuiwrxHopF53H9mm1kwBf6kuH7K2N wSYECUtwc8koKzQFY9CVgkCgqqCkrIMfLlHyL6y5Orl7rBctP0Pe9bIOcc8aqJ7KFAKx 0ph3J//M9vCYtUqTdacK1FkU9oW5DlocamzK2M9WvHFD24gfoCUkz0m+zKSCxlFqZboe OUDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:references :in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=IyNxElLalotf1uvEYKp7gC41L0jcYpxEtx1cK4Oc8ic=; b=DDHHzN2gzXyi3689NCZjknNHB/CswL7mI5dcZ+QVFkdTTE+n5vyzTBlJe4aAcbj3Bd bLfKGqPRu+jwOQ3Axd2KBRv3kHywWOxfd1BaOO+1HF6uImlG3D1JDdMDvEyVnuUpt8E3 st5CHKbSlUx6koGu8mUYlcd4PgJz+S4n5bCG0aJpU/nPtKBjoKYH+/OmD0DRTEZAQ4wd ZWofd2AbFfHGB5PGSNZJlsC+vEr8tLNXL/pnUovyd5NavsGdmDdGxhA/U8rejdQMwZV9 FVrfXxcYd5oiZrobKglAy1X1KvIOuR6RFREUQMz2WrJf69rOKAlX5SMOHkYwlNUNZyJQ lovw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id t13-v6si5455028qto.159.2018.07.24.14.24.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 14:24:14 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 97488300271A; Tue, 24 Jul 2018 21:24:11 +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 3DCB760910; Tue, 24 Jul 2018 21:24:11 +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 C614B4A464; Tue, 24 Jul 2018 21:24:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6OLNqKT018728 for ; Tue, 24 Jul 2018 17:23:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id D50722026E0E; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.bos.redhat.com (wlan-196-187.bos.redhat.com [10.16.196.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id B95462026D68; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 24 Jul 2018 17:23:45 -0400 Message-Id: <2622a099eb9fc903cddc3c99e18876b671338f58.1532467269.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/7] conf: Drop unneccessary caps parsing logic 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 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.46]); Tue, 24 Jul 2018 21:24:13 +0000 (UTC) The comment says: /* If the logic here seems fairly arbitrary, that's because it is :) * This is duplicating how the code worked before * CapabilitiesDomainDataLookup was added. We can simplify this, * but it would take a bit of work because the test suite fails * in numerous minor ways. */ Nowadays the test suite changes appear quite simple, just extending test capabilities data a bit so that we aren't trying to define invalid arch/os/virtType/machine combos Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 15 ++------------- tests/testutils.c | 13 ++++++++++++- tests/testutilsqemu.c | 18 ++++++++++++++++++ tests/vircapstest.c | 2 -- 4 files changed, 32 insertions(+), 16 deletions(-) -- 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5a90429cd6..b7f6a22e20 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19178,20 +19178,9 @@ virDomainDefParseCaps(virDomainDefPtr def, goto cleanup; } - if ((!def->os.arch || !def->os.machine) && - !(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) { - /* If the logic here seems fairly arbitrary, that's because it is :) - * This is duplicating how the code worked before - * CapabilitiesDomainDataLookup was added. We can simplify this, - * but it would take a bit of work because the test suite fails - * in numerous minor ways. */ - bool use_virttype = ((def->os.arch == VIR_ARCH_NONE) || - !def->os.machine); - + if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) { if (!(capsdata = virCapabilitiesDomainDataLookup(caps, - def->os.type, - def->os.arch, - use_virttype ? def->virtType : VIR_DOMAIN_VIRT_NONE, + def->os.type, def->os.arch, def->virtType, NULL, NULL))) goto cleanup; diff --git a/tests/testutils.c b/tests/testutils.c index 423f4bfdff..ab938c12fc 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -1196,7 +1196,12 @@ virCapsPtr virTestGenericCapsInit(void) if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_TEST, NULL, NULL, 0, NULL)) goto error; - + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, + NULL, NULL, 0, NULL)) + goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_X86_64, "/usr/bin/acme-virt", NULL, @@ -1205,6 +1210,12 @@ virCapsPtr virTestGenericCapsInit(void) if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_TEST, NULL, NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, + NULL, NULL, 0, NULL)) + goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; if (virTestGetDebug() > 1) { diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index dc7e90b952..cc2f8a7b64 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -219,6 +219,9 @@ static int testQemuAddPPC64Guest(virCapsPtr caps) if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; return 0; @@ -246,6 +249,9 @@ static int testQemuAddPPC64LEGuest(virCapsPtr caps) if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; return 0; @@ -276,6 +282,9 @@ static int testQemuAddPPCGuest(virCapsPtr caps) if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; return 0; @@ -307,6 +316,9 @@ static int testQemuAddS390Guest(virCapsPtr caps) if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; return 0; @@ -338,6 +350,9 @@ static int testQemuAddArmGuest(virCapsPtr caps) if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; return 0; @@ -367,6 +382,9 @@ static int testQemuAddAARCH64Guest(virCapsPtr caps) if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) goto error; + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + NULL, NULL, 0, NULL)) + goto error; return 0; diff --git a/tests/vircapstest.c b/tests/vircapstest.c index 1df3fa091f..19e3c79302 100644 --- a/tests/vircapstest.c +++ b/tests/vircapstest.c @@ -195,8 +195,6 @@ test_virCapsDomainDataLookupQEMU(const void *data ATTRIBUTE_UNUSED) CAPS_EXPECT_ERR(VIR_DOMAIN_OSTYPE_LINUX, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, NULL, NULL); CAPS_EXPECT_ERR(-1, VIR_ARCH_PPC64LE, VIR_DOMAIN_VIRT_NONE, NULL, "pc"); CAPS_EXPECT_ERR(-1, VIR_ARCH_MIPS, VIR_DOMAIN_VIRT_NONE, NULL, NULL); - CAPS_EXPECT_ERR(-1, VIR_ARCH_AARCH64, VIR_DOMAIN_VIRT_KVM, - "/usr/bin/qemu-system-aarch64", NULL); CAPS_EXPECT_ERR(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_NONE, "/usr/bin/qemu-system-aarch64", "pc"); CAPS_EXPECT_ERR(-1, VIR_ARCH_NONE, VIR_DOMAIN_VIRT_VMWARE, NULL, "pc");