qemu: Report VIR_DOMAIN_MEMORY_PARAM_UNLIMITED properly

For dead domains that have no memtune limits, we return 0 instead of
"unlimited", this patch fixes it to return PARAM_UNLIMITED.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2013-12-04 18:56:02 +01:00
parent 231656bbeb
commit 0c2fdd7b14

View File

@ -8053,29 +8053,30 @@ qemuDomainGetMemoryParameters(virDomainPtr dom,
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
for (i = 0; i < *nparams && i < QEMU_NB_MEM_PARAM; i++) { for (i = 0; i < *nparams && i < QEMU_NB_MEM_PARAM; i++) {
virMemoryParameterPtr param = &params[i]; virMemoryParameterPtr param = &params[i];
unsigned long long value;
switch (i) { switch (i) {
case 0: /* fill memory hard limit here */ case 0: /* fill memory hard limit here */
if (virTypedParameterAssign(param, value = persistentDef->mem.hard_limit;
VIR_DOMAIN_MEMORY_HARD_LIMIT, value = value ? value : VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
VIR_TYPED_PARAM_ULLONG, if (virTypedParameterAssign(param, VIR_DOMAIN_MEMORY_HARD_LIMIT,
persistentDef->mem.hard_limit) < 0) VIR_TYPED_PARAM_ULLONG, value) < 0)
goto cleanup; goto cleanup;
break; break;
case 1: /* fill memory soft limit here */ case 1: /* fill memory soft limit here */
if (virTypedParameterAssign(param, value = persistentDef->mem.soft_limit;
VIR_DOMAIN_MEMORY_SOFT_LIMIT, value = value ? value : VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
VIR_TYPED_PARAM_ULLONG, if (virTypedParameterAssign(param, VIR_DOMAIN_MEMORY_SOFT_LIMIT,
persistentDef->mem.soft_limit) < 0) VIR_TYPED_PARAM_ULLONG, value) < 0)
goto cleanup; goto cleanup;
break; break;
case 2: /* fill swap hard limit here */ case 2: /* fill swap hard limit here */
if (virTypedParameterAssign(param, value = persistentDef->mem.swap_hard_limit;
VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, value = value ? value : VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
VIR_TYPED_PARAM_ULLONG, if (virTypedParameterAssign(param, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT,
persistentDef->mem.swap_hard_limit) < 0) VIR_TYPED_PARAM_ULLONG, value) < 0)
goto cleanup; goto cleanup;
break; break;