[PATCH 13/14] test: Add <metadata> support into the test driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/test/test_driver.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c225618..23f7b2e 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2585,6 +2585,72 @@ cleanup:
     return ret;
 }

+static char *testDomainGetMetadata(virDomainPtr dom,
+                                   int type,
+                                   const char *uri,
+                                   unsigned int flags)
+{
+    testConnPtr privconn = dom->conn->privateData;
+    virDomainObjPtr privdom;
+    char *ret = NULL;
+
+    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+                  VIR_DOMAIN_AFFECT_CONFIG, NULL);
+
+    testDriverLock(privconn);
+    privdom = virDomainObjListFindByName(privconn->domains,
+                                         dom->name);
+    testDriverUnlock(privconn);
+
+    if (privdom == NULL) {
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        goto cleanup;
+    }
+
+    ret = virDomainObjGetMetadata(privdom, type, uri, privconn->caps,
+                                  privconn->xmlopt, flags);
+
+cleanup:
+    if (privdom)
+        virObjectUnlock(privdom);
+    return ret;
+}
+
+static int testDomainSetMetadata(virDomainPtr dom,
+                                 int type,
+                                 const char *metadata,
+                                 const char *key,
+                                 const char *uri,
+                                 unsigned int flags)
+{
+    testConnPtr privconn = dom->conn->privateData;
+    virDomainObjPtr privdom;
+    int ret = -1;
+
+    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+                  VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+    testDriverLock(privconn);
+    privdom = virDomainObjListFindByName(privconn->domains,
+                                         dom->name);
+    testDriverUnlock(privconn);
+
+    if (privdom == NULL) {
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        goto cleanup;
+    }
+
+    ret = virDomainObjSetMetadata(privdom, type, metadata, key, uri,
+                                  privconn->caps, privconn->xmlopt,
+                                  NULL, flags);
+
+cleanup:
+    if (privdom)
+        virObjectUnlock(privdom);
+    return ret;
+}
+
+
 static int testNodeGetCellsFreeMemory(virConnectPtr conn,
                                       unsigned long long *freemems,
                                       int startCell, int maxCells) {
@@ -5872,6 +5938,8 @@ static virDriver testDriver = {
     .connectIsAlive = testConnectIsAlive, /* 0.9.8 */
     .nodeGetCPUMap = testNodeGetCPUMap, /* 1.0.0 */
     .domainScreenshot = testDomainScreenshot, /* 1.0.5 */
+    .domainGetMetadata = testDomainGetMetadata, /* 1.1.3 */
+    .domainSetMetadata = testDomainSetMetadata, /* 1.1.3 */
 };

 static virNetworkDriver testNetworkDriver = {
-- 
1.8.3.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]