This way both Domain and Device PostParse functions can act based on the
flags.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/bhyve/bhyve_domain.c | 2 ++
src/conf/domain_conf.c | 15 ++++++++++-----
src/conf/domain_conf.h | 2 ++
src/libxl/libxl_domain.c | 2 ++
src/lxc/lxc_domain.c | 2 ++
src/openvz/openvz_driver.c | 2 ++
src/phyp/phyp_driver.c | 2 ++
src/qemu/qemu_domain.c | 2 ++
src/uml/uml_driver.c | 2 ++
src/vbox/vbox_common.c | 2 ++
src/vmware/vmware_driver.c | 2 ++
src/vmx/vmx.c | 2 ++
src/vz/vz_driver.c | 2 ++
src/xen/xen_driver.c | 2 ++
src/xenapi/xenapi_driver.c | 2 ++
15 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c
index 890963e03f42..db8fae4ad072 100644
--- a/src/bhyve/bhyve_domain.c
+++ b/src/bhyve/bhyve_domain.c
@@ -60,6 +60,7 @@ virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks = {
static int
bhyveDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
/* Add an implicit PCI root controller */
@@ -78,6 +79,7 @@ static int
bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (virDomainDeviceDefCheckUnsupportedMemoryDevice(dev) < 0)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9d4784611b1e..105a10925763 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4000,6 +4000,7 @@ static int
virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev,
const virDomainDef *def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
virDomainXMLOptionPtr xmlopt)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR) {
@@ -4133,18 +4134,19 @@ static int
virDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def,
virCapsPtr caps,
+ unsigned int flags,
virDomainXMLOptionPtr xmlopt)
{
int ret;
if (xmlopt->config.devicesPostParseCallback) {
- ret = xmlopt->config.devicesPostParseCallback(dev, def, caps,
+ ret = xmlopt->config.devicesPostParseCallback(dev, def, caps, flags,
xmlopt->config.priv);
if (ret < 0)
return ret;
}
- if ((ret = virDomainDeviceDefPostParseInternal(dev, def, caps, xmlopt)) < 0)
+ if ((ret = virDomainDeviceDefPostParseInternal(dev, def, caps, flags, xmlopt)) <
0)
return ret;
return 0;
@@ -4155,6 +4157,7 @@ struct virDomainDefPostParseDeviceIteratorData {
virDomainDefPtr def;
virCapsPtr caps;
virDomainXMLOptionPtr xmlopt;
+ unsigned int parseFlags;
};
@@ -4165,7 +4168,8 @@ virDomainDefPostParseDeviceIterator(virDomainDefPtr def
ATTRIBUTE_UNUSED,
void *opaque)
{
struct virDomainDefPostParseDeviceIteratorData *data = opaque;
- return virDomainDeviceDefPostParse(dev, data->def, data->caps,
data->xmlopt);
+ return virDomainDeviceDefPostParse(dev, data->def, data->caps,
+ data->parseFlags, data->xmlopt);
}
@@ -4180,11 +4184,12 @@ virDomainDefPostParse(virDomainDefPtr def,
.def = def,
.caps = caps,
.xmlopt = xmlopt,
+ .parseFlags = parseFlags,
};
/* call the domain config callback */
if (xmlopt->config.domainPostParseCallback) {
- ret = xmlopt->config.domainPostParseCallback(def, caps,
+ ret = xmlopt->config.domainPostParseCallback(def, caps, parseFlags,
xmlopt->config.priv);
if (ret < 0)
return ret;
@@ -12622,7 +12627,7 @@ virDomainDeviceDefParse(const char *xmlStr,
}
/* callback to fill driver specific device aspects */
- if (virDomainDeviceDefPostParse(dev, def, caps, xmlopt) < 0)
+ if (virDomainDeviceDefPostParse(dev, def, caps, flags, xmlopt) < 0)
goto error;
cleanup:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ae6d54697897..7c6552a50bc4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2439,12 +2439,14 @@ typedef virDomainXMLOption *virDomainXMLOptionPtr;
* overall domain defaults. */
typedef int (*virDomainDefPostParseCallback)(virDomainDefPtr def,
virCapsPtr caps,
+ unsigned int parseFlags,
void *opaque);
/* Called once per device, for adjusting per-device settings while
* leaving the overall domain otherwise unchanged. */
typedef int (*virDomainDeviceDefPostParseCallback)(virDomainDeviceDefPtr dev,
const virDomainDef *def,
virCapsPtr caps,
+ unsigned int parseFlags,
void *opaque);
typedef struct _virDomainDefParserConfig virDomainDefParserConfig;
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 5b01db8198e2..cf5c9f6ee19e 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -285,6 +285,7 @@ static int
libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
@@ -370,6 +371,7 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
static int
libxlDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
/* Xen PV domains always have a PV console, so add one to the domain config
diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
index e3da9f053608..c3f7a564b36b 100644
--- a/src/lxc/lxc_domain.c
+++ b/src/lxc/lxc_domain.c
@@ -241,6 +241,7 @@ virDomainXMLPrivateDataCallbacks virLXCDriverPrivateDataCallbacks = {
static int
virLXCDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
/* check for emulator and create a default one if needed */
@@ -260,6 +261,7 @@ static int
virLXCDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 3a4a3428bdf9..c14834be47f2 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -89,6 +89,7 @@ struct openvz_driver ovz_driver;
static int
openvzDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
/* fill the init path */
@@ -109,6 +110,7 @@ static int
openvzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index cf674a02049c..760e1324365d 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1096,6 +1096,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
static int
phypDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
/* memory hotplug tunables are not supported by this driver */
@@ -1110,6 +1111,7 @@ static int
phypDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
const virDomainDef *def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
return 0;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a539278058fa..1cd0260c7bbe 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1029,6 +1029,7 @@ virDomainXMLNamespace virQEMUDriverDomainXMLNamespace = {
static int
qemuDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque)
{
virQEMUDriverPtr driver = opaque;
@@ -1255,6 +1256,7 @@ static int
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque)
{
virQEMUDriverPtr driver = opaque;
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index fc0ca670a9fd..bccdc69ada95 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -409,6 +409,7 @@ static int
umlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
@@ -436,6 +437,7 @@ umlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
static int
umlDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
/* memory hotplug tunables are not supported by this driver */
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index cf4de2db7405..110990f6b95f 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -252,6 +252,7 @@ static char *vboxGenerateMediumName(PRUint32 storageBus,
static int
vboxDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
/* memory hotplug tunables are not supported by this driver */
@@ -265,6 +266,7 @@ static int
vboxDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
const virDomainDef *def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
return 0;
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index cf6af430eebb..fa66c21249d7 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -85,6 +85,7 @@ vmwareDataFreeFunc(void *data)
static int
vmwareDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
/* memory hotplug tunables are not supported by this driver */
@@ -98,6 +99,7 @@ static int
vmwareDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
const virDomainDef *def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
return 0;
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 568b2c7b332e..d1cdad32ea24 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -527,6 +527,7 @@ VIR_ENUM_IMPL(virVMXControllerModelSCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
static int
virVMXDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
/* memory hotplug tunables are not supported by this driver */
@@ -540,6 +541,7 @@ static int
virVMXDomainDevicesDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
const virDomainDef *def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
return 0;
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 4348213e4fe0..f73f8eff057e 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -175,6 +175,7 @@ vzConnectGetCapabilities(virConnectPtr conn)
static int
vzDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
/* memory hotplug tunables are not supported by this driver */
@@ -188,6 +189,7 @@ static int
vzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
int ret = -1;
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 95f0e4209379..198390eda1d6 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -322,6 +322,7 @@ static int
xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
@@ -369,6 +370,7 @@ xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
static int
xenDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (!def->memballoon) {
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index e4e99360f1f0..44a00c583153 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -47,6 +47,7 @@ static int
xenapiDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
@@ -75,6 +76,7 @@ xenapiDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
static int
xenapiDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED,
+ unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
/* memory hotplug tunables are not supported by this driver */
--
2.7.0