vz: implementation of domainSetUserPassword callback

This commit is contained in:
Mikhail Feoktistov 2016-05-27 11:16:34 -04:00 committed by Maxim Nestratov
parent f166d6449c
commit ceb5461f7b
3 changed files with 55 additions and 1 deletions

View File

@ -1264,6 +1264,25 @@ static int vzDomainDetachDevice(virDomainPtr domain, const char *xml)
VIR_DOMAIN_AFFECT_CONFIG | VIR_DOMAIN_AFFECT_LIVE);
}
static int
vzDomainSetUserPassword(virDomainPtr domain,
const char *user,
const char *password,
unsigned int flags)
{
virDomainObjPtr dom = NULL;
int ret = -1;
virCheckFlags(0, -1);
if (!(dom = vzDomObjFromDomain(domain)))
return -1;
ret = prlsdkDomainSetUserPassword(dom, user, password);
virObjectUnlock(dom);
return ret;
}
static unsigned long long
vzDomainGetMaxMemory(virDomainPtr domain)
{
@ -2737,6 +2756,7 @@ static virHypervisorDriver vzHypervisorDriver = {
.domainIsUpdated = vzDomainIsUpdated, /* 1.2.21 */
.domainGetVcpusFlags = vzDomainGetVcpusFlags, /* 1.2.21 */
.domainGetMaxVcpus = vzDomainGetMaxVcpus, /* 1.2.21 */
.domainSetUserPassword = vzDomainSetUserPassword, /* 1.3.6 */
.connectDomainEventRegisterAny = vzConnectDomainEventRegisterAny, /* 1.2.10 */
.connectDomainEventDeregisterAny = vzConnectDomainEventDeregisterAny, /* 1.2.10 */
.nodeGetCPUMap = vzNodeGetCPUMap, /* 1.2.8 */

View File

@ -3534,6 +3534,37 @@ prlsdkSetBootOrderVm(PRL_HANDLE sdkdom, virDomainDefPtr def)
return 0;
}
int
prlsdkDomainSetUserPassword(virDomainObjPtr dom,
const char *user,
const char *password)
{
int ret = -1;
vzDomObjPtr privdom = dom->privateData;
PRL_HANDLE job = PRL_INVALID_HANDLE;
job = PrlVm_BeginEdit(privdom->sdkdom);
if (PRL_FAILED(waitJob(job)))
goto cleanup;
job = PrlVm_SetUserPasswd(privdom->sdkdom,
user,
password,
0);
if (PRL_FAILED(waitJob(job)))
goto cleanup;
job = PrlVm_CommitEx(privdom->sdkdom, 0);
if (PRL_FAILED(waitJob(job)))
goto cleanup;
ret = 0;
cleanup:
return ret;
}
static int
prlsdkDoApplyConfig(vzDriverPtr driver,
PRL_HANDLE sdkdom,

View File

@ -82,7 +82,10 @@ void
prlsdkDomObjFreePrivate(void *p);
/* memsize is in MiB */
int prlsdkSetMemsize(virDomainObjPtr dom, unsigned int memsize);
int
prlsdkDomainSetUserPassword(virDomainObjPtr dom,
const char *user,
const char *password);
virDomainSnapshotObjListPtr prlsdkLoadSnapshots(virDomainObjPtr dom);
int prlsdkCreateSnapshot(virDomainObjPtr dom, const char *description);
int prlsdkDeleteSnapshot(virDomainObjPtr dom, const char *uuid, bool children);