提交 b251d6ad 编写于 作者: C Cole Robinson

conf: Drop unnecessary caps parsing logic

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
Acked-by: NMichal Privoznik <mprivozn@redhat.com>
Signed-off-by: NCole Robinson <crobinso@redhat.com>
上级 f14f0836
......@@ -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;
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册