Signed-off-by: Ilias Stamatis <stamatis.iliass@xxxxxxxxx> --- src/test/test_driver.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 29b388e2d3..3c60d8dd0a 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2851,6 +2851,45 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) goto cleanup +static int +testDomainGetMemoryParameters(virDomainPtr dom, + virTypedParameterPtr params, + int *nparams, + unsigned int flags) +{ + int ret = -1; + virDomainObjPtr vm = NULL; + virDomainDefPtr def = NULL; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG | + VIR_TYPED_PARAM_STRING_OKAY, -1); + + if ((*nparams) == 0) { + *nparams = 3; + return 0; + } + + if (!(vm = testDomObjFromDomain(dom))) + goto cleanup; + + if (!(def = virDomainObjGetOneDef(vm, flags))) + goto cleanup; + + TEST_SET_PARAM(0, VIR_DOMAIN_MEMORY_HARD_LIMIT, VIR_TYPED_PARAM_ULLONG, def->mem.hard_limit); + TEST_SET_PARAM(1, VIR_DOMAIN_MEMORY_SOFT_LIMIT, VIR_TYPED_PARAM_ULLONG, def->mem.soft_limit); + TEST_SET_PARAM(2, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, VIR_TYPED_PARAM_ULLONG, def->mem.swap_hard_limit); + + if (*nparams > 3) + *nparams = 3; + + ret = 0; + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + static int testConnectNumOfDefinedDomains(virConnectPtr conn) { testDriverPtr privconn = conn->privateData; @@ -7283,6 +7322,7 @@ static virHypervisorDriver testHypervisorDriver = { .domainGetVcpuPinInfo = testDomainGetVcpuPinInfo, /* 1.2.18 */ .domainGetMaxVcpus = testDomainGetMaxVcpus, /* 0.7.3 */ .domainGetXMLDesc = testDomainGetXMLDesc, /* 0.1.4 */ + .domainGetMemoryParameters = testDomainGetMemoryParameters, /* 5.6.0 */ .connectListDefinedDomains = testConnectListDefinedDomains, /* 0.1.11 */ .connectNumOfDefinedDomains = testConnectNumOfDefinedDomains, /* 0.1.11 */ .domainCreate = testDomainCreate, /* 0.1.11 */ -- 2.22.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list