mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
parallels: cpumask support
Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
This commit is contained in:
parent
616003d6bd
commit
a4e0f2343f
@ -777,7 +777,6 @@ parallelsDomainGetVcpus(virDomainPtr domain,
|
|||||||
int maplen)
|
int maplen)
|
||||||
{
|
{
|
||||||
parallelsConnPtr privconn = domain->conn->privateData;
|
parallelsConnPtr privconn = domain->conn->privateData;
|
||||||
parallelsDomObjPtr privdomdata = NULL;
|
|
||||||
virDomainObjPtr privdom = NULL;
|
virDomainObjPtr privdom = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
int v, maxcpu, hostcpus;
|
int v, maxcpu, hostcpus;
|
||||||
@ -799,7 +798,6 @@ parallelsDomainGetVcpus(virDomainPtr domain,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
privdomdata = privdom->privateData;
|
|
||||||
if ((hostcpus = nodeGetCPUCount()) < 0)
|
if ((hostcpus = nodeGetCPUCount()) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -820,7 +818,7 @@ parallelsDomainGetVcpus(virDomainPtr domain,
|
|||||||
int tmpmapLen = 0;
|
int tmpmapLen = 0;
|
||||||
|
|
||||||
memset(cpumaps, 0, maplen * maxinfo);
|
memset(cpumaps, 0, maplen * maxinfo);
|
||||||
virBitmapToData(privdomdata->cpumask, &tmpmap, &tmpmapLen);
|
virBitmapToData(privdom->def->cpumask, &tmpmap, &tmpmapLen);
|
||||||
if (tmpmapLen > maplen)
|
if (tmpmapLen > maplen)
|
||||||
tmpmapLen = maplen;
|
tmpmapLen = maplen;
|
||||||
|
|
||||||
|
@ -412,7 +412,6 @@ prlsdkDomObjFreePrivate(void *p)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
PrlHandle_Free(pdom->sdkdom);
|
PrlHandle_Free(pdom->sdkdom);
|
||||||
virBitmapFree(pdom->cpumask);
|
|
||||||
VIR_FREE(pdom->uuid);
|
VIR_FREE(pdom->uuid);
|
||||||
VIR_FREE(pdom->home);
|
VIR_FREE(pdom->home);
|
||||||
VIR_FREE(p);
|
VIR_FREE(p);
|
||||||
@ -1053,8 +1052,7 @@ prlsdkConvertDomainState(VIRTUAL_MACHINE_STATE domainState,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
prlsdkConvertCpuInfo(PRL_HANDLE sdkdom,
|
prlsdkConvertCpuInfo(PRL_HANDLE sdkdom,
|
||||||
virDomainDefPtr def,
|
virDomainDefPtr def)
|
||||||
parallelsDomObjPtr pdom)
|
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
PRL_UINT32 buflen = 0;
|
PRL_UINT32 buflen = 0;
|
||||||
@ -1085,11 +1083,11 @@ prlsdkConvertCpuInfo(PRL_HANDLE sdkdom,
|
|||||||
pret = PrlVmCfg_GetCpuMask(sdkdom, buf, &buflen);
|
pret = PrlVmCfg_GetCpuMask(sdkdom, buf, &buflen);
|
||||||
|
|
||||||
if (strlen(buf) == 0) {
|
if (strlen(buf) == 0) {
|
||||||
if (!(pdom->cpumask = virBitmapNew(hostcpus)))
|
if (!(def->cpumask = virBitmapNew(hostcpus)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
virBitmapSetAll(pdom->cpumask);
|
virBitmapSetAll(def->cpumask);
|
||||||
} else {
|
} else {
|
||||||
if (virBitmapParse(buf, 0, &pdom->cpumask, hostcpus) < 0)
|
if (virBitmapParse(buf, 0, &def->cpumask, hostcpus) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1217,7 +1215,7 @@ prlsdkLoadDomain(parallelsConnPtr privconn,
|
|||||||
convert to Kbytes */
|
convert to Kbytes */
|
||||||
def->mem.cur_balloon = def->mem.max_balloon;
|
def->mem.cur_balloon = def->mem.max_balloon;
|
||||||
|
|
||||||
if (prlsdkConvertCpuInfo(sdkdom, def, pdom) < 0)
|
if (prlsdkConvertCpuInfo(sdkdom, def) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (prlsdkConvertCpuMode(sdkdom, def) < 0)
|
if (prlsdkConvertCpuMode(sdkdom, def) < 0)
|
||||||
@ -1807,13 +1805,6 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->cpumask != NULL) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("changing cpu mask is not supported "
|
|
||||||
"by parallels driver"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (def->cputune.shares ||
|
if (def->cputune.shares ||
|
||||||
def->cputune.sharesSpecified ||
|
def->cputune.sharesSpecified ||
|
||||||
def->cputune.period ||
|
def->cputune.period ||
|
||||||
@ -2842,6 +2833,7 @@ prlsdkDoApplyConfig(PRL_HANDLE sdkdom,
|
|||||||
size_t i;
|
size_t i;
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
|
char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
|
||||||
bool needBoot = true;
|
bool needBoot = true;
|
||||||
|
char *mask = NULL;
|
||||||
|
|
||||||
if (prlsdkCheckUnsupportedParams(sdkdom, def) < 0)
|
if (prlsdkCheckUnsupportedParams(sdkdom, def) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -2869,6 +2861,13 @@ prlsdkDoApplyConfig(PRL_HANDLE sdkdom,
|
|||||||
pret = PrlVmCfg_SetCpuCount(sdkdom, def->vcpus);
|
pret = PrlVmCfg_SetCpuCount(sdkdom, def->vcpus);
|
||||||
prlsdkCheckRetGoto(pret, error);
|
prlsdkCheckRetGoto(pret, error);
|
||||||
|
|
||||||
|
if (!(mask = virBitmapFormat(def->cpumask)))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
pret = PrlVmCfg_SetCpuMask(sdkdom, mask);
|
||||||
|
prlsdkCheckRetGoto(pret, error);
|
||||||
|
VIR_FREE(mask);
|
||||||
|
|
||||||
if (prlsdkClearDevices(sdkdom) < 0)
|
if (prlsdkClearDevices(sdkdom) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -2912,7 +2911,9 @@ prlsdkDoApplyConfig(PRL_HANDLE sdkdom,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
return -1;
|
VIR_FREE(mask);
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -69,7 +69,6 @@ struct parallelsDomObj {
|
|||||||
int id;
|
int id;
|
||||||
char *uuid;
|
char *uuid;
|
||||||
char *home;
|
char *home;
|
||||||
virBitmapPtr cpumask;
|
|
||||||
PRL_HANDLE sdkdom;
|
PRL_HANDLE sdkdom;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user