From 3e93d00d56ece9ef05af6c3ca942b0361a10502b Mon Sep 17 00:00:00 2001 From: Ilias Stamatis Date: Tue, 23 Jul 2019 13:37:44 +0200 Subject: [PATCH] test_driver: implement virDomainPinEmulator Signed-off-by: Ilias Stamatis --- src/test/test_driver.c | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 59d11c9242..f701a2447b 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2592,6 +2592,49 @@ static int testDomainSetMaxMemory(virDomainPtr domain, } +static int +testDomainPinEmulator(virDomainPtr dom, + unsigned char *cpumap, + int maplen, + unsigned int flags) +{ + virDomainObjPtr vm = NULL; + virDomainDefPtr def = NULL; + virBitmapPtr pcpumap = NULL; + 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 (!(pcpumap = virBitmapNewData(cpumap, maplen))) + goto cleanup; + + if (virBitmapIsAllClear(pcpumap)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Empty cpu list for pinning")); + goto cleanup; + } + + virBitmapFree(def->cputune.emulatorpin); + def->cputune.emulatorpin = NULL; + + if (!(def->cputune.emulatorpin = virBitmapNewCopy(pcpumap))) + goto cleanup; + + ret = 0; + cleanup: + virBitmapFree(pcpumap); + virDomainObjEndAPI(&vm); + return ret; +} + + static int testDomainGetEmulatorPinInfo(virDomainPtr dom, unsigned char *cpumaps, @@ -8091,6 +8134,7 @@ static virHypervisorDriver testHypervisorDriver = { .domainCoreDump = testDomainCoreDump, /* 0.3.2 */ .domainCoreDumpWithFormat = testDomainCoreDumpWithFormat, /* 1.2.3 */ .domainSetUserPassword = testDomainSetUserPassword, /* 5.6.0 */ + .domainPinEmulator = testDomainPinEmulator, /* 5.6.0 */ .domainGetEmulatorPinInfo = testDomainGetEmulatorPinInfo, /* 5.6.0 */ .domainSetVcpus = testDomainSetVcpus, /* 0.1.4 */ .domainSetVcpusFlags = testDomainSetVcpusFlags, /* 0.8.5 */