On Thu, Jan 07, 2016 at 22:50:06 -0500, Cole Robinson wrote: > In order to make this work, we need to short circuit the normal > virDomainDefPostParse ordering, and manually add stock devices > ourselves, since we need them in the XML before assigning addresses. > > There's a bit of test suite churn due to extra XML output, and validation > happening at different call sites, but it all looks correct to me. > > There's still quite a few manual callers of qemuDomainAssignAddresses > that could be dropped too but it would need additional testing. > --- > src/qemu/qemu_domain.c | 10 +++++++ > src/qemu/qemu_driver.c | 9 ------ > .../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 4 ++- > tests/qemuxml2argvtest.c | 12 ++------ > .../qemuxml2xmlout-channel-virtio-auto.xml | 9 +++--- > .../qemuxml2xmlout-disk-scsi-vscsi.xml | 35 ++++++++++++++++++++++ > .../qemuxml2xmlout-panic-pseries.xml | 30 +++++++++++++++++++ > .../qemuxml2xmlout-pseries-panic-missing.xml | 4 +-- > .../qemuxml2xmlout-pseries-panic-no-address.xml | 4 +-- > tests/qemuxml2xmltest.c | 10 +++++-- > 10 files changed, 97 insertions(+), 30 deletions(-) > create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-vscsi.xml > create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml > > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c > index a981310..e0520ab 100644 > --- a/src/qemu/qemu_domain.c > +++ b/src/qemu/qemu_domain.c > @@ -1249,6 +1249,16 @@ qemuDomainDefPostParse(virDomainDefPtr def, > if (virSecurityManagerVerify(driver->securityManager, def) < 0) > goto cleanup; > > + /* Device defaults are normally set after calling the driver specific > + PostParse routine (this function), but we need them earlier. */ > + if (virDomainDefPostParseDevices(def, caps, driver->xmlopt) < 0) > + goto cleanup; NACK to this, this would create a possibly dangerous situation by encouraging others to call the post parse callback handlers from themeself. If it's necessary to do two passes of post parse stuff, then please add a new callback pointer for it.
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list