When auto-dumping a domain on crash events, let the user configure
whether to have the VIR_DUMP_DIRECT flag effects.
* src/qemu/qemu.conf (auto_dump_direct): Document new variable.
* src/qemu/libvirtd_qemu.aug (vnc_entry): Let augeas parse it.
* src/qemu/qemu_conf.h (qemud_driver): Store new preference.
* src/qemu/qemu_conf.c (qemudLoadDriverConfig): Parse it.
* src/qemu/qemu_driver.c (processWatchdogEvent): Honor it.
---
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 8 ++++++++
src/qemu/qemu_conf.c | 6 +++++-
src/qemu/qemu_conf.h | 3 ++-
src/qemu/qemu_driver.c | 4 ++--
5 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index 66858ae..dea6770 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -41,6 +41,7 @@ module Libvirtd_qemu =
| str_entry "save_image_format"
| str_entry "dump_image_format"
| str_entry "auto_dump_path"
+ | bool_entry "auto_dump_direct"
| str_entry "hugetlbfs_mount"
| bool_entry "relaxed_acs_check"
| bool_entry "vnc_allow_host_audio"
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 934f99b..2a0664d 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -208,6 +208,14 @@
#
# auto_dump_path = "/var/lib/libvirt/qemu/dump"
+# When a domain is configured to be auto-dumped, enabling this flag
+# has the same effect as using the VIR_DUMP_DIRECT flag with the
+# virDomainCoreDump API. That is, the system uses O_DIRECT if possible,
+# which puts less pressure on the file system cache but may cause
+# slower operation.
+#
+# auto_dump_direct = 0
+
# If provided by the host and a hugetlbfs mount point is configured,
# a guest may request huge page backing. When this mount point is
# unspecified here, determination of a host mount point in /proc/mounts
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 3d8aba4..cf6cb6b 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1,7 +1,7 @@
/*
* qemu_conf.c: QEMU configuration management
*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
+ * Copyright (C) 2006-2011 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -378,6 +378,10 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
}
}
+ p = virConfGetValue (conf, "auto_dump_direct");
+ CHECK_TYPE ("auto_dump_direct", VIR_CONF_LONG);
+ if (p) driver->autoDumpDirect = true;
+
p = virConfGetValue (conf, "hugetlbfs_mount");
CHECK_TYPE ("hugetlbfs_mount", VIR_CONF_STRING);
if (p && p->str) {
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index fa4c607..bc025af 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -1,7 +1,7 @@
/*
* qemu_conf.h: QEMU configuration management
*
- * Copyright (C) 2006-2007, 2009-2010 Red Hat, Inc.
+ * Copyright (C) 2006-2007, 2009-2011 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -119,6 +119,7 @@ struct qemud_driver {
char *dumpImageFormat;
char *autoDumpPath;
+ bool autoDumpDirect;
pciDeviceList *activePciHostdevs;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e414e5f..d7cd069 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2863,9 +2863,9 @@ static void processWatchdogEvent(void *data, void *opaque)
goto endjob;
}
- /* XXX wire up qemu.conf to support whether to do direct dumps */
ret = doCoreDump(driver, wdEvent->vm, dumpfile,
- getCompressionType(driver), false);
+ getCompressionType(driver),
+ driver->autoDumpDirect);
if (ret < 0)
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("Dump failed"));
--
1.7.4.4