Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/domain_conf.c | 6 ++++-- src/conf/domain_conf.h | 1 + src/libxl/libxl_driver.c | 12 ++++++------ src/lxc/lxc_driver.c | 6 +++--- src/openvz/openvz_driver.c | 2 +- src/phyp/phyp_driver.c | 2 +- src/qemu/qemu_driver.c | 8 ++++---- src/uml/uml_driver.c | 4 ++-- src/vbox/vbox_tmpl.c | 4 ++-- src/xen/xend_internal.c | 6 +++--- src/xen/xm_internal.c | 8 ++++++-- tests/qemuhotplugtest.c | 3 ++- 12 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f2a96e9..9a5cfe8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9481,6 +9481,7 @@ virDomainDeviceDefParse(const char *xmlStr, virDomainDefPtr def, virCapsPtr caps, virDomainXMLOptionPtr xmlopt, + bool doPostParse, unsigned int flags) { xmlDocPtr xml; @@ -9604,7 +9605,8 @@ virDomainDeviceDefParse(const char *xmlStr, } /* callback to fill driver specific device aspects */ - if (virDomainDeviceDefPostParse(dev, def, caps, xmlopt) < 0) + if (doPostParse && + virDomainDeviceDefPostParse(dev, def, caps, xmlopt) < 0) goto error; cleanup: @@ -18233,7 +18235,7 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src, if (!(xmlStr = virDomainDeviceDefFormat(src, flags))) return ret; - ret = virDomainDeviceDefParse(xmlStr, def, caps, xmlopt, flags); + ret = virDomainDeviceDefParse(xmlStr, def, caps, xmlopt, true, flags); VIR_FREE(xmlStr); return ret; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0ac3478..1d58bfa 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2311,6 +2311,7 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(const char *xmlStr, virDomainDefPtr def, virCapsPtr caps, virDomainXMLOptionPtr xmlopt, + bool doPostParse, unsigned int flags); char * virDomainDeviceDefFormat(virDomainDeviceDefPtr def, unsigned int flags); diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index e2a6d44..326ade1 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -3172,7 +3172,7 @@ libxlDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) { if (!(dev = virDomainDeviceDefParse(xml, vm->def, cfg->caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE))) + true, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; /* Make a copy for updated domain. */ @@ -3191,7 +3191,7 @@ libxlDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, virDomainDeviceDefFree(dev); if (!(dev = virDomainDeviceDefParse(xml, vm->def, cfg->caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE))) + true, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; if ((ret = libxlDomainAttachDeviceLive(priv, vm, dev)) < 0) @@ -3276,7 +3276,7 @@ libxlDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) { if (!(dev = virDomainDeviceDefParse(xml, vm->def, cfg->caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE))) + true, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; /* Make a copy for updated domain. */ @@ -3295,7 +3295,7 @@ libxlDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, virDomainDeviceDefFree(dev); if (!(dev = virDomainDeviceDefParse(xml, vm->def, cfg->caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE))) + true, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; if ((ret = libxlDomainDetachDeviceLive(priv, vm, dev)) < 0) @@ -3380,7 +3380,7 @@ libxlDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml, if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) { if (!(dev = virDomainDeviceDefParse(xml, vm->def, cfg->caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE))) + true, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; /* Make a copy for updated domain. */ @@ -3399,7 +3399,7 @@ libxlDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml, virDomainDeviceDefFree(dev); if (!(dev = virDomainDeviceDefParse(xml, vm->def, cfg->caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE))) + true, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; if ((ret = libxlDomainUpdateDeviceLive(priv, vm, dev)) < 0) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 4cf0b50..7d672b3 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -4053,7 +4053,7 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom, dev = dev_copy = virDomainDeviceDefParse(xml, vm->def, caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE); + true, VIR_DOMAIN_XML_INACTIVE); if (dev == NULL) goto cleanup; @@ -4179,7 +4179,7 @@ static int lxcDomainUpdateDeviceFlags(virDomainPtr dom, dev = dev_copy = virDomainDeviceDefParse(xml, vm->def, caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE); + true, VIR_DOMAIN_XML_INACTIVE); if (dev == NULL) goto cleanup; @@ -4289,7 +4289,7 @@ static int lxcDomainDetachDeviceFlags(virDomainPtr dom, dev = dev_copy = virDomainDeviceDefParse(xml, vm->def, caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE); + true, VIR_DOMAIN_XML_INACTIVE); if (dev == NULL) goto cleanup; diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 993e037..a92c761 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -2093,7 +2093,7 @@ openvzDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml, goto cleanup; dev = virDomainDeviceDefParse(xml, vmdef, driver->caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE); + true, VIR_DOMAIN_XML_INACTIVE); if (!dev) goto cleanup; diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 32165ed..fa50c2d 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -1674,7 +1674,7 @@ phypDomainAttachDevice(virDomainPtr domain, const char *xml) goto cleanup; dev = virDomainDeviceDefParse(xml, def, phyp_driver->caps, NULL, - VIR_DOMAIN_XML_INACTIVE); + true, VIR_DOMAIN_XML_INACTIVE); if (!dev) { goto cleanup; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1f35c06..dd8d6d2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6894,7 +6894,7 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, dev = dev_copy = virDomainDeviceDefParse(xml, vm->def, caps, driver->xmlopt, - parse_flags); + true, parse_flags); if (dev == NULL) goto endjob; @@ -7037,7 +7037,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, dev = dev_copy = virDomainDeviceDefParse(xml, vm->def, caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE); + true, VIR_DOMAIN_XML_INACTIVE); if (dev == NULL) goto endjob; @@ -7176,7 +7176,7 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, dev = dev_copy = virDomainDeviceDefParse(xml, vm->def, caps, driver->xmlopt, - parse_flags); + true, parse_flags); if (dev == NULL) goto endjob; @@ -15681,7 +15681,7 @@ qemuDomainNormalizeXML(virDomainPtr dom, if (!(dev_def = virDomainDeviceDefParse(xmlIn, vm->def, caps, driver->xmlopt, - flags))) + false, flags))) goto cleanup; if (xmlOut && diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 9ca352f..e5b0fb1 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -2198,7 +2198,7 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml) } dev = virDomainDeviceDefParse(xml, vm->def, driver->caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE); + true, VIR_DOMAIN_XML_INACTIVE); if (dev == NULL) goto cleanup; @@ -2318,7 +2318,7 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml) { } dev = virDomainDeviceDefParse(xml, vm->def, driver->caps, driver->xmlopt, - VIR_DOMAIN_XML_INACTIVE); + true, VIR_DOMAIN_XML_INACTIVE); if (dev == NULL) goto cleanup; diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 66e6cbc..d56512f 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -5381,7 +5381,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom, goto cleanup; dev = virDomainDeviceDefParse(xml, def, data->caps, data->xmlopt, - VIR_DOMAIN_XML_INACTIVE); + true, VIR_DOMAIN_XML_INACTIVE); if (dev == NULL) goto cleanup; @@ -5610,7 +5610,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) { goto cleanup; dev = virDomainDeviceDefParse(xml, def, data->caps, data->xmlopt, - VIR_DOMAIN_XML_INACTIVE); + true, VIR_DOMAIN_XML_INACTIVE); if (dev == NULL) goto cleanup; diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index f698c8d..5ebbb4a 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -2246,7 +2246,7 @@ xenDaemonAttachDeviceFlags(virConnectPtr conn, goto cleanup; if (!(dev = virDomainDeviceDefParse(xml, def, priv->caps, priv->xmlopt, - VIR_DOMAIN_XML_INACTIVE))) + true, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; @@ -2394,7 +2394,7 @@ xenDaemonUpdateDeviceFlags(virConnectPtr conn, goto cleanup; if (!(dev = virDomainDeviceDefParse(xml, def, priv->caps, priv->xmlopt, - VIR_DOMAIN_XML_INACTIVE))) + true, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; @@ -2496,7 +2496,7 @@ xenDaemonDetachDeviceFlags(virConnectPtr conn, goto cleanup; if (!(dev = virDomainDeviceDefParse(xml, def, priv->caps, priv->xmlopt, - VIR_DOMAIN_XML_INACTIVE))) + true, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; if (virDomainXMLDevID(conn, minidef, dev, class, ref, sizeof(ref))) diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c index d20dd91..3e890c5 100644 --- a/src/xen/xm_internal.c +++ b/src/xen/xm_internal.c @@ -1245,9 +1245,11 @@ xenXMDomainAttachDeviceFlags(virConnectPtr conn, goto cleanup; def = entry->def; - if (!(dev = virDomainDeviceDefParse(xml, entry->def, + if (!(dev = virDomainDeviceDefParse(xml, + entry->def, priv->caps, priv->xmlopt, + true, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; @@ -1334,9 +1336,11 @@ xenXMDomainDetachDeviceFlags(virConnectPtr conn, goto cleanup; def = entry->def; - if (!(dev = virDomainDeviceDefParse(xml, entry->def, + if (!(dev = virDomainDeviceDefParse(xml, + entry->def, priv->caps, priv->xmlopt, + true, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 89480af..d7a49c7 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -245,7 +245,8 @@ testQemuHotplug(const void *data) } if (!(dev = virDomainDeviceDefParse(device_xml, vm->def, - caps, driver.xmlopt, 0))) + caps, driver.xmlopt, + true, 0))) goto cleanup; /* Now is the best time to feed the spoofed monitor with predefined -- 1.8.1.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list