Since this is the test driver, we can pretend that the native hypervisor
representation is the same as libvirt's domain XML.
Signed-off-by: Ilias Stamatis <stamatis.iliass(a)gmail.com>
---
src/test/test_driver.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 1aa79ce898..ec1d3cacbc 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1563,6 +1563,39 @@ static int testConnectNumOfDomains(virConnectPtr conn)
return count;
}
+
+# define TEST_CONFIG_FORMAT_ARGV "test-test"
+
+
+static char *testConnectDomainXMLToNative(virConnectPtr conn,
+ const char *format,
+ const char *dxml,
+ unsigned int flags)
+{
+ char *ret = NULL;
+ virDomainDefPtr def = NULL;
+ testDriverPtr privconn = conn->privateData;
+
+ virCheckFlags(0, NULL);
+
+ if (STRNEQ(format, TEST_CONFIG_FORMAT_ARGV)) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Unsupported config format '%s'"), format);
+ return NULL;
+ }
+
+ if ((def = virDomainDefParseString(dxml, privconn->caps, privconn->xmlopt,
NULL,
+ VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
+ goto cleanup;
+
+ ret = virDomainDefFormat(def, privconn->caps, 0);
+
+ cleanup:
+ virDomainDefFree(def);
+ return ret;
+}
+
+
static int testDomainIsActive(virDomainPtr dom)
{
virDomainObjPtr obj;
@@ -6998,6 +7031,7 @@ static virHypervisorDriver testHypervisorDriver = {
.connectGetType = testConnectGetType, /* 2.3.0 */
.connectListDomains = testConnectListDomains, /* 0.1.1 */
.connectNumOfDomains = testConnectNumOfDomains, /* 0.1.1 */
+ .connectDomainXMLToNative = testConnectDomainXMLToNative, /* 5.5.0 */
.connectListAllDomains = testConnectListAllDomains, /* 0.9.13 */
.domainCreateXML = testDomainCreateXML, /* 0.1.4 */
.domainLookupByID = testDomainLookupByID, /* 0.1.1 */
--
2.21.0
Show replies by date
Since this is the test driver, we can pretend that the native hypervisor
representation is the same as libvirt's domain XML.
Signed-off-by: Ilias Stamatis <stamatis.iliass(a)gmail.com>
---
src/test/test_driver.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index ec1d3cacbc..6bf25d0c4a 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1596,6 +1596,35 @@ static char *testConnectDomainXMLToNative(virConnectPtr conn,
}
+static char *testConnectDomainXMLFromNative(virConnectPtr conn,
+ const char *format,
+ const char *config,
+ unsigned int flags)
+{
+ char *ret = NULL;
+ virDomainDefPtr def = NULL;
+ testDriverPtr privconn = conn->privateData;
+
+ virCheckFlags(0, NULL);
+
+ if (STRNEQ(format, TEST_CONFIG_FORMAT_ARGV)) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Unsupported config format '%s'"), format);
+ return NULL;
+ }
+
+ if ((def = virDomainDefParseString(config, privconn->caps, privconn->xmlopt,
NULL,
+ VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
+ goto cleanup;
+
+ ret = virDomainDefFormat(def, privconn->caps, 0);
+
+ cleanup:
+ virDomainDefFree(def);
+ return ret;
+}
+
+
static int testDomainIsActive(virDomainPtr dom)
{
virDomainObjPtr obj;
@@ -7032,6 +7061,7 @@ static virHypervisorDriver testHypervisorDriver = {
.connectListDomains = testConnectListDomains, /* 0.1.1 */
.connectNumOfDomains = testConnectNumOfDomains, /* 0.1.1 */
.connectDomainXMLToNative = testConnectDomainXMLToNative, /* 5.5.0 */
+ .connectDomainXMLFromNative = testConnectDomainXMLFromNative, /* 5.5.0 */
.connectListAllDomains = testConnectListAllDomains, /* 0.9.13 */
.domainCreateXML = testDomainCreateXML, /* 0.1.4 */
.domainLookupByID = testDomainLookupByID, /* 0.1.1 */
--
2.21.0