When auto-starting a domain on libvirtd startup, let the user
configure whether to have the VIR_DOMAIN_START_DIRECT flag effect.
* src/qemu/qemu.conf (auto_start_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 (qemuAutostartDomain): Honor it.
---
Might be worth combining with 9/8.
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 8 ++++++++
src/qemu/qemu_conf.c | 4 ++++
src/qemu/qemu_conf.h | 2 ++
src/qemu/qemu_driver.c | 4 ++--
5 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index dea6770..a78cd10 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -42,6 +42,7 @@ module Libvirtd_qemu =
| str_entry "dump_image_format"
| str_entry "auto_dump_path"
| bool_entry "auto_dump_direct"
+ | bool_entry "auto_start_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 2a0664d..48ae781 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -216,6 +216,14 @@
#
# auto_dump_direct = 0
+# When a domain is configured to be auto-started, enabling this flag
+# has the same effect as using the VIR_DOMAIN_START_DIRECT flag with the
+# virDomainCreateWithFlags 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_start_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 cf6cb6b..144dbda 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -382,6 +382,10 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
CHECK_TYPE ("auto_dump_direct", VIR_CONF_LONG);
if (p) driver->autoDumpDirect = true;
+ p = virConfGetValue (conf, "auto_start_direct");
+ CHECK_TYPE ("auto_start_direct", VIR_CONF_LONG);
+ if (p) driver->autoStartDirect = 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 bc025af..afc3ef4 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -121,6 +121,8 @@ struct qemud_driver {
char *autoDumpPath;
bool autoDumpDirect;
+ bool autoStartDirect;
+
pciDeviceList *activePciHostdevs;
virBitmapPtr reservedVNCPorts;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 27b971f..64fe3b9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -150,11 +150,11 @@ qemuAutostartDomain(void *payload, const void *name
ATTRIBUTE_UNUSED, void *opaq
vm->def->name,
err ? err->message : _("unknown error"));
} else {
- /* XXX need to wire direct autostart into qemu.conf */
if (vm->autostart &&
!virDomainObjIsActive(vm) &&
qemuDomainObjStart(data->conn, data->driver, vm,
- false, false, false) < 0) {
+ false, false,
+ data->driver->autoStartDirect) < 0) {
err = virGetLastError();
VIR_ERROR(_("Failed to autostart VM '%s': %s"),
vm->def->name,
--
1.7.4.4