Use virTristateSwitchFromBool to fill in the default if user didn't
request it explicitly.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 150824f2e1..bb2a3ea82f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6625,15 +6625,13 @@ qemuAppendDomainMemoryMachineParams(virBuffer *buf,
const virDomainDef *def,
virQEMUCaps *qemuCaps)
{
+ virTristateSwitch dump = def->mem.dump_core;
size_t i;
- if (def->mem.dump_core) {
- virBufferAsprintf(buf, ",dump-guest-core=%s",
- virTristateSwitchTypeToString(def->mem.dump_core));
- } else {
- virBufferAsprintf(buf, ",dump-guest-core=%s",
- cfg->dumpGuestCore ? "on" : "off");
- }
+ if (dump == VIR_TRISTATE_SWITCH_ABSENT)
+ dump = virTristateSwitchFromBool(cfg->dumpGuestCore);
+
+ virBufferAsprintf(buf, ",dump-guest-core=%s",
virTristateSwitchTypeToString(dump));
if (def->mem.nosharepages)
virBufferAddLit(buf, ",mem-merge=off");
--
2.37.3