提交 a1c04c27 编写于 作者: E Erik Skultety

test_driver: Fix testDomainSetMemoryFlags' behaviour on config change

When commit 6ac402c4 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: NErik Skultety <eskultet@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Acked-by: NPeter Krempa <pkrempa@redhat.com>
上级 96e31a62
......@@ -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"));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册