diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 0547de5863ca7d0ab177994e34a0b9ded504b13f..6aade90c46c3c280e09fb857b141da1916adfeec 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 d4d4d6d0bd09e3e820be2c2de15b76a0a1f387a0..f89d3e69b8e3dd6bb04f7ee90d2c6e3c1ce7f27c 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 65a3e68adac103ec1455935c5663dcca03eac581..7e34cbfd9b9493b048dbaf361b8abfa1ea5a438c 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,