[PATCH v2 2/9] test: Allow specifying object transient state in driver XML

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

 



Similar to the runstate commit, allow a boolean <test:transient/>
element for setting domain persistence at driver startup.
---
 src/test/test_driver.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index fdfb13a..a181a9b 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -158,6 +158,7 @@ typedef struct _testDomainNamespaceDef testDomainNamespaceDef;
 typedef testDomainNamespaceDef *testDomainNamespaceDefPtr;
 struct _testDomainNamespaceDef {
     int runstate;
+    bool transient;
 };
 
 static void
@@ -188,6 +189,13 @@ testDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED,
     if (VIR_ALLOC(nsdata) < 0)
         return -1;
 
+    tmp = virXPathBoolean("boolean(./test:transient)", ctxt);
+    if (tmp == -1) {
+        virReportError(VIR_ERR_XML_ERROR, "%s", _("invalid transient"));
+        goto error;
+    }
+    nsdata->transient = tmp;
+
     tmp = virXPathUInt("string(./test:runstate)", ctxt, &tmpuint);
     if (tmp == 0) {
         if (tmpuint >= VIR_DOMAIN_LAST) {
@@ -921,7 +929,7 @@ testParseDomains(testConnPtr privconn,
         }
 
         nsdata = def->namespaceData;
-        obj->persistent = 1;
+        obj->persistent = !nsdata->transient;
 
         if (nsdata->runstate != VIR_DOMAIN_SHUTOFF) {
             if (testDomainStartState(privconn, obj,
-- 
1.8.3.1

--
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]