提交 d678379d 编写于 作者: K Konstantin Neumoin 提交者: Maxim Nestratov

vz: support virDomainSetVcpus

Acked-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: NKonstantin Neumoin <kneumoin@virtuozzo.com>
上级 8e09663f
......@@ -3905,6 +3905,47 @@ vzDomainReset(virDomainPtr domain, unsigned int flags)
return ret;
}
static int vzDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
unsigned int flags)
{
virDomainObjPtr dom = NULL;
int ret = -1;
bool job = false;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
VIR_DOMAIN_AFFECT_CONFIG, -1);
if (!(dom = vzDomObjFromDomainRef(domain)))
goto cleanup;
if (vzCheckConfigUpdateFlags(dom, &flags) < 0)
goto cleanup;
if (virDomainSetVcpusFlagsEnsureACL(domain->conn, dom->def, flags) < 0)
goto cleanup;
if (vzDomainObjBeginJob(dom) < 0)
goto cleanup;
job = true;
if (vzEnsureDomainExists(dom) < 0)
goto cleanup;
ret = prlsdkSetCpuCount(dom, nvcpus);
cleanup:
if (job)
vzDomainObjEndJob(dom);
virDomainObjEndAPI(&dom);
return ret;
}
static int vzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
{
return vzDomainSetVcpusFlags(dom, nvcpus,
VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG);
}
static virHypervisorDriver vzHypervisorDriver = {
.name = "vz",
.connectOpen = vzConnectOpen, /* 0.10.0 */
......@@ -3954,6 +3995,8 @@ static virHypervisorDriver vzHypervisorDriver = {
.domainDetachDeviceFlags = vzDomainDetachDeviceFlags, /* 1.2.15 */
.domainIsActive = vzDomainIsActive, /* 1.2.10 */
.domainIsUpdated = vzDomainIsUpdated, /* 1.2.21 */
.domainSetVcpus = vzDomainSetVcpus, /* 3.3.0 */
.domainSetVcpusFlags = vzDomainSetVcpusFlags, /* 3.3.0 */
.domainGetVcpusFlags = vzDomainGetVcpusFlags, /* 1.2.21 */
.domainGetMaxVcpus = vzDomainGetMaxVcpus, /* 1.2.21 */
.domainSetUserPassword = vzDomainSetUserPassword, /* 2.0.0 */
......
......@@ -4902,3 +4902,26 @@ int prlsdkMigrate(virDomainObjPtr dom, virURIPtr uri,
cleanup:
return ret;
}
int prlsdkSetCpuCount(virDomainObjPtr dom, unsigned int count)
{
vzDomObjPtr privdom = dom->privateData;
PRL_HANDLE job;
PRL_RESULT pret;
job = PrlVm_BeginEdit(privdom->sdkdom);
if (PRL_FAILED(waitDomainJob(job, dom)))
goto error;
pret = PrlVmCfg_SetCpuCount(privdom->sdkdom, count);
prlsdkCheckRetGoto(pret, error);
job = PrlVm_CommitEx(privdom->sdkdom, 0);
if (PRL_FAILED(waitDomainJob(job, dom)))
goto error;
return 0;
error:
return -1;
}
......@@ -71,6 +71,7 @@ int
prlsdkGetMemoryStats(PRL_HANDLE sdkstas, virDomainMemoryStatPtr stats, unsigned int nr_stats);
/* memsize is in MiB */
int prlsdkSetMemsize(virDomainObjPtr dom, unsigned int memsize);
int prlsdkSetCpuCount(virDomainObjPtr dom, unsigned int count);
int
prlsdkDomainSetUserPassword(virDomainObjPtr dom,
const char *user,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册