mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
test_driver: implement virDomainGetEmulatorPinInfo
Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
This commit is contained in:
parent
b2f6a5c688
commit
6328da0428
@ -2592,6 +2592,52 @@ static int testDomainSetMaxMemory(virDomainPtr domain,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
testDomainGetEmulatorPinInfo(virDomainPtr dom,
|
||||
unsigned char *cpumaps,
|
||||
int maplen,
|
||||
unsigned int flags)
|
||||
{
|
||||
virDomainObjPtr vm = NULL;
|
||||
virDomainDefPtr def = NULL;
|
||||
virBitmapPtr cpumask = NULL;
|
||||
virBitmapPtr bitmap = NULL;
|
||||
int hostcpus;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_AFFECT_CONFIG, -1);
|
||||
|
||||
if (!(vm = testDomObjFromDomain(dom)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(def = virDomainObjGetOneDef(vm, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if ((hostcpus = virHostCPUGetCount()) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (def->cputune.emulatorpin) {
|
||||
cpumask = def->cputune.emulatorpin;
|
||||
} else if (def->cpumask) {
|
||||
cpumask = def->cpumask;
|
||||
} else {
|
||||
if (!(bitmap = virBitmapNew(hostcpus)))
|
||||
goto cleanup;
|
||||
virBitmapSetAll(bitmap);
|
||||
cpumask = bitmap;
|
||||
}
|
||||
|
||||
virBitmapToDataBuf(cpumask, cpumaps, maplen);
|
||||
|
||||
ret = 1;
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
virBitmapFree(bitmap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
{
|
||||
@ -8045,6 +8091,7 @@ static virHypervisorDriver testHypervisorDriver = {
|
||||
.domainCoreDump = testDomainCoreDump, /* 0.3.2 */
|
||||
.domainCoreDumpWithFormat = testDomainCoreDumpWithFormat, /* 1.2.3 */
|
||||
.domainSetUserPassword = testDomainSetUserPassword, /* 5.6.0 */
|
||||
.domainGetEmulatorPinInfo = testDomainGetEmulatorPinInfo, /* 5.6.0 */
|
||||
.domainSetVcpus = testDomainSetVcpus, /* 0.1.4 */
|
||||
.domainSetVcpusFlags = testDomainSetVcpusFlags, /* 0.8.5 */
|
||||
.domainGetVcpusFlags = testDomainGetVcpusFlags, /* 0.8.5 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user