Re: [PATCH 2/2] test_driver: implement virDomainPMWakeup

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

 





On 8/13/19 1:20 PM, Ilias Stamatis wrote:
Signed-off-by: Ilias Stamatis <stamatis.iliass@xxxxxxxxx>
---

(My virObjectEventStateQueue rant in patch 1/2 applies here as well)

Reviewed-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>


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

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index d21a69c7ed..b2a9baf361 100755
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -4168,6 +4168,42 @@ testDomainPMSuspendForDuration(virDomainPtr dom,
  }


+static int
+testDomainPMWakeup(virDomainPtr dom,
+                   unsigned int flags)
+{
+    virDomainObjPtr vm;
+    virObjectEventPtr event = NULL;
+    testDriverPtr privconn = dom->conn->privateData;
+    int ret = -1;
+
+    virCheckFlags(0, -1);
+
+    if (!(vm = testDomObjFromDomain(dom)))
+        goto cleanup;
+
+    if (virDomainObjCheckActive(vm) < 0)
+        goto cleanup;
+
+    if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PMSUSPENDED) {
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("Unable to wake up: guest is not in suspended state"));
+        goto cleanup;
+    }
+
+    virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_WAKEUP);
+
+    event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED,
+                                              VIR_DOMAIN_EVENT_STARTED_WAKEUP);
+
+    ret = 0;
+ cleanup:
+    virDomainObjEndAPI(&vm);
+    virObjectEventStateQueue(privconn->eventState, event);
+    return ret;
+}
+
+
  #define TEST_TOTAL_CPUTIME 48772617035LL

  static int
@@ -9494,6 +9530,7 @@ static virHypervisorDriver testHypervisorDriver = {
      .domainGetMetadata = testDomainGetMetadata, /* 1.1.3 */
      .domainSetMetadata = testDomainSetMetadata, /* 1.1.3 */
      .domainPMSuspendForDuration = testDomainPMSuspendForDuration, /* 5.7.0 */
+    .domainPMWakeup = testDomainPMWakeup, /* 5.7.0 */
      .domainGetCPUStats = testDomainGetCPUStats, /* 5.6.0 */
      .domainSendProcessSignal = testDomainSendProcessSignal, /* 5.5.0 */
      .connectGetCPUModelNames = testConnectGetCPUModelNames, /* 1.1.3 */
--
2.22.0

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

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