Signed-off-by: Ilias Stamatis <stamatis.iliass@xxxxxxxxx> --- 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 235d70f793..5411a97a5b 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2501,6 +2501,49 @@ static int testDomainSetMemory(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, @@ -7790,6 +7833,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 */ -- 2.22.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list