To allow the test suite to creat the XML option object,
move the virDomainXMLOptionNew call into a libxlCreateXMLConf
method.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/libxl/libxl_conf.c | 7 +++++++
src/libxl/libxl_conf.h | 2 ++
src/libxl/libxl_domain.c | 4 ++--
src/libxl/libxl_driver.c | 4 +---
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index f9e3a1b..967759c 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1336,3 +1336,10 @@ libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
return 0;
}
+
+virDomainXMLOptionPtr libxlCreateXMLConf(void)
+{
+ return virDomainXMLOptionNew(&libxlDomainDefParserConfig,
+ &libxlDomainXMLPrivateDataCallbacks,
+ NULL);
+}
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 2dcd0b8..7a9a7d5 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -158,6 +158,8 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports,
int
libxlMakePCI(virDomainHostdevDefPtr hostdev, libxl_device_pci *pcidev);
+virDomainXMLOptionPtr libxlCreateXMLConf(void);
+
int
libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
virDomainDefPtr def,
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index e00a3fb..00ff14f 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -1100,6 +1100,8 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
#endif
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
+ libxl_domain_config_init(&d_config);
+
if (libxlDomainObjPrivateInitCtx(vm) < 0)
return ret;
@@ -1149,8 +1151,6 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
VIR_FREE(managed_save_path);
}
- libxl_domain_config_init(&d_config);
-
if (libxlBuildDomainConfig(driver->reservedVNCPorts, vm->def,
priv->ctx, &d_config) < 0)
goto endjob;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index df7d510..515d5c9 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -353,9 +353,7 @@ libxlStateInitialize(bool privileged,
goto error;
}
- if (!(libxl_driver->xmlopt =
virDomainXMLOptionNew(&libxlDomainDefParserConfig,
-
&libxlDomainXMLPrivateDataCallbacks,
- NULL)))
+ if (!(libxl_driver->xmlopt = libxlCreateXMLConf()))
goto error;
/* Load running domains first. */
--
1.9.3