[PATCH v2 1/2] test_driver: make testDomainGetTime read time from vm-private data

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

 



Until now, testDomainGetTime would always return the same fixed values
everytime it was called. By using domain-private data we can make this
API return the values previously set with testDomainSetTime, or use the
same old fixed values in case testDomainSetTime hasn't been called at all.

Signed-off-by: Ilias Stamatis <stamatis.iliass@xxxxxxxxx>
Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
 src/test/test_driver.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 6bca4e277f..3e2cd3a9a4 100755
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -392,6 +392,10 @@ struct _testDomainObjPrivate {
     testDriverPtr driver;

     bool frozen[2]; /* used by file system related calls */
+
+    /* used by get/set time APIs */
+    long long seconds;
+    unsigned int nseconds;
 };


@@ -406,6 +410,9 @@ testDomainObjPrivateAlloc(void *opaque)
     priv->driver = opaque;
     priv->frozen[0] = priv->frozen[1] = false;

+    priv->seconds = 627319920;
+    priv->nseconds = 0;
+
     return priv;
 }

@@ -2104,6 +2111,7 @@ testDomainGetTime(virDomainPtr dom,
                   unsigned int flags)
 {
     virDomainObjPtr vm = NULL;
+    testDomainObjPrivatePtr priv;
     int ret = -1;

     virCheckFlags(0, -1);
@@ -2117,8 +2125,9 @@ testDomainGetTime(virDomainPtr dom,
         goto cleanup;
     }

-    *seconds = 627319920;
-    *nseconds = 0;
+    priv = vm->privateData;
+    *seconds = priv->seconds;
+    *nseconds = priv->nseconds;

     ret = 0;
  cleanup:
--
2.22.0

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

  Powered by Linux