vz: support virDomainReset

This commit is contained in:
Nikolay Shirokovskiy 2017-01-31 10:44:13 +03:00 committed by Maxim Nestratov
parent 48317abbf7
commit 4ebb75c364
3 changed files with 48 additions and 0 deletions

View File

@ -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 = {

View File

@ -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)
{

View File

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