---
 src/vz/vz_driver.c | 32 ++++++++++++++++++++++++++++++++
 src/vz/vz_sdk.c    | 15 +++++++++++++++
 src/vz/vz_sdk.h    |  1 +
 3 files changed, 48 insertions(+)

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 0547de5..6aade90 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -3903,6 +3903,37 @@ vzDomainAbortJob(virDomainPtr domain)
     return ret;
 }
 
+static int
+vzDomainReset(virDomainPtr domain, unsigned int flags)
+{
+    virDomainObjPtr dom = NULL;
+    int ret = -1;
+    bool job = false;
+
+    virCheckFlags(0, -1);
+
+    if (!(dom = vzDomObjFromDomainRef(domain)))
+        return -1;
+
+    if (virDomainResetEnsureACL(domain->conn, dom->def) < 0)
+        goto cleanup;
+
+    if (vzDomainObjBeginJob(dom) < 0)
+        goto cleanup;
+    job = true;
+
+    if (vzEnsureDomainExists(dom) < 0)
+        goto cleanup;
+
+    ret = prlsdkReset(dom);
+
+ cleanup:
+    if (job)
+        vzDomainObjEndJob(dom);
+    virDomainObjEndAPI(&dom);
+    return ret;
+}
+
 static virHypervisorDriver vzHypervisorDriver = {
     .name = "vz",
     .connectOpen = vzConnectOpen,            /* 0.10.0 */
@@ -4000,6 +4031,7 @@ static virHypervisorDriver vzHypervisorDriver = {
     .domainGetJobStats = vzDomainGetJobStats, /* 2.2.0 */
     .connectGetAllDomainStats = vzConnectGetAllDomainStats, /* 3.1.0 */
     .domainAbortJob = vzDomainAbortJob, /* 3.1.0 */
+    .domainReset = vzDomainReset, /* 3.1.0 */
 };
 
 static virConnectDriver vzConnectDriver = {
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index d4d4d6d..f89d3e6 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -2463,6 +2463,21 @@ int prlsdkRestart(virDomainObjPtr dom)
     return 0;
 }
 
+int prlsdkReset(virDomainObjPtr dom)
+{
+    PRL_HANDLE job = PRL_INVALID_HANDLE;
+    vzDomObjPtr privdom = dom->privateData;
+    PRL_RESULT pret;
+
+    job = PrlVm_Reset(privdom->sdkdom);
+    if (PRL_FAILED(pret = waitDomainJob(job, dom))) {
+        prlsdkConvertError(pret);
+        return -1;
+    }
+
+    return 0;
+}
+
 static void
 prlsdkConvertError(PRL_RESULT pret)
 {
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index 65a3e68..7e34cbf 100644
--- a/src/vz/vz_sdk.h
+++ b/src/vz/vz_sdk.h
@@ -45,6 +45,7 @@ int prlsdkPause(virDomainObjPtr dom);
 int prlsdkResume(virDomainObjPtr dom);
 int prlsdkSuspend(virDomainObjPtr dom);
 int prlsdkRestart(virDomainObjPtr dom);
+int prlsdkReset(virDomainObjPtr dom);
 
 int
 prlsdkApplyConfig(vzDriverPtr driver,
-- 
1.8.3.1

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

Reply via email to