From a1c04c27bda799bb634e640f67b06f19551389e7 Mon Sep 17 00:00:00 2001 From: Erik Skultety Date: Thu, 25 Jul 2019 09:29:36 +0200 Subject: [PATCH] test_driver: Fix testDomainSetMemoryFlags' behaviour on config change MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When commit 6ac402c456a added the API whenever VIR_DOMAIN_MEM_MAXIMUM was passed the code always checked whether the domain was active and therefore failed with an error even though only a config change was requested. Fix the issue by replacing virDomainObjGetOneDef with virDomainObjGetOneDefState which tells us what definition we're performing the change on. Signed-off-by: Erik Skultety Reviewed-by: Ján Tomko Acked-by: Peter Krempa --- src/test/test_driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 56f6b78ecc..da044027bf 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2524,6 +2524,7 @@ static int testDomainSetMemoryFlags(virDomainPtr domain, virDomainObjPtr vm; virDomainDefPtr def; int ret = -1; + bool live = false; virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG | @@ -2532,11 +2533,11 @@ static int testDomainSetMemoryFlags(virDomainPtr domain, if (!(vm = testDomObjFromDomain(domain))) return -1; - if (!(def = virDomainObjGetOneDef(vm, flags))) + if (!(def = virDomainObjGetOneDefState(vm, flags, &live))) goto cleanup; if (flags & VIR_DOMAIN_MEM_MAXIMUM) { - if (virDomainObjIsActive(vm)) { + if (live) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot resize the maximum memory on an " "active domain")); -- 2.39.5