mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-26 14:03:49 +03:00
vz: support virDomainSetVcpus
Acked-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
This commit is contained in:
parent
8e09663f7f
commit
d678379df1
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user