From patchwork Sat May 14 20:00:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 67809 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp850892qge; Sat, 14 May 2016 13:05:18 -0700 (PDT) X-Received: by 10.55.201.145 with SMTP id m17mr11672489qkl.85.1463256318053; Sat, 14 May 2016 13:05:18 -0700 (PDT) Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com. [209.132.183.39]) by mx.google.com with ESMTPS id i5si16867961qkc.273.2016.05.14.13.05.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 May 2016 13:05:18 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4EK0pB8044574; Sat, 14 May 2016 16:00:51 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u4EK0EBQ010435 for ; Sat, 14 May 2016 16:00:14 -0400 Received: from colepc.redhat.com (ovpn-116-31.phx2.redhat.com [10.3.116.31]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4EK0C1H004370; Sat, 14 May 2016 16:00:14 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Sat, 14 May 2016 16:00:08 -0400 Message-Id: <4c2c4892374e97c6d3cfc71a5ed0448629fe375e.1463255562.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani Subject: [libvirt] [PATCH 2/4] qemu: Assign device addresses in PostParse 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 This wires up qemuDomainAssignAddresses into the new virDomainDefAssignAddressesCallback, so it's always triggered via virDomainDefPostParse. We are essentially doing this already with open coded calls sprinkled about qemu argv parse output changes slightly since previously it wasn't hitting qemuDomainAssignAddresses. --- src/qemu/qemu_domain.c | 25 ++++++++++++++++++++++ .../qemuargv2xmldata/qemuargv2xml-pseries-disk.xml | 4 +++- tests/qemuxml2argvtest.c | 2 +- tests/qemuxml2xmltest.c | 11 ++-------- 4 files changed, 31 insertions(+), 11 deletions(-) -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b0eb3b6..50505a6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2293,9 +2293,34 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, } +static int +qemuDomainDefAssignAddressesCallback(virDomainDef *def, + virCapsPtr caps ATTRIBUTE_UNUSED, + unsigned int parseFlags ATTRIBUTE_UNUSED, + void *opaque) +{ + virQEMUDriverPtr driver = opaque; + virQEMUCapsPtr qemuCaps = NULL; + int ret = -1; + + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, + def->emulator))) + goto cleanup; + + if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0) + goto cleanup; + + ret = 0; + cleanup: + virObjectUnref(qemuCaps); + return ret; +} + + virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = { .devicesPostParseCallback = qemuDomainDeviceDefPostParse, .domainPostParseCallback = qemuDomainDefPostParse, + .assignAddressesCallback = qemuDomainDefAssignAddressesCallback, .features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG | VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN }; diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml index 8cec27c..ab9195a 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml @@ -29,7 +29,9 @@ - + +
+ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d1cfbec..840efc9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1382,7 +1382,7 @@ mymain(void) QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION); DO_TEST("pseries-vio-user-assigned", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); - DO_TEST_FAILURE("pseries-vio-address-clash", + DO_TEST_PARSE_ERROR("pseries-vio-address-clash", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM); DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI, diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5a43fa9..9eb2625 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -37,13 +37,9 @@ struct testInfo { }; static int -qemuXML2XMLPreFormatCallback(virDomainDefPtr def, const void *opaque) +qemuXML2XMLPreFormatCallback(virDomainDefPtr def ATTRIBUTE_UNUSED, + const void *opaque ATTRIBUTE_UNUSED) { - const struct testInfo *info = opaque; - - if (qemuDomainAssignAddresses(def, info->qemuCaps, NULL)) - return -1; - return 0; } @@ -153,9 +149,6 @@ testCompareStatusXMLToXMLFiles(const void *opaque) goto cleanup; } - if (qemuDomainAssignAddresses(obj->def, data->qemuCaps, NULL)) - goto cleanup; - /* format it back */ if (!(actual = virDomainObjFormat(driver.xmlopt, obj, NULL, VIR_DOMAIN_DEF_FORMAT_SECURE))) {