[PATCHv2 14/16] save: support bypass-cache flag in qemu.conf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When auto-dumping a domain on crash events, or autostarting a domain
with managed save state, let the user configure whether to imply
the bypass cache flag.

* src/qemu/qemu.conf (auto_dump_bypass_cache, auto_start_bypass_cache):
Document new variables.
* src/qemu/libvirtd_qemu.aug (vnc_entry): Let augeas parse them.
* src/qemu/qemu_conf.h (qemud_driver): Store new preferences.
* src/qemu/qemu_conf.c (qemudLoadDriverConfig): Parse them.
* src/qemu/qemu_driver.c (processWatchdogEvent, qemuAutostartDomain):
Honor them.
---

v2: merge 9 and 16 of v1, rename direct to bypass_cache

 src/qemu/libvirtd_qemu.aug |    2 ++
 src/qemu/qemu.conf         |   16 ++++++++++++++++
 src/qemu/qemu_conf.c       |   10 +++++++++-
 src/qemu/qemu_conf.h       |    5 ++++-
 src/qemu/qemu_driver.c     |    8 ++++----
 5 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index 66858ae..d018ac2 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -41,6 +41,8 @@ module Libvirtd_qemu =
                  | str_entry "save_image_format"
                  | str_entry "dump_image_format"
                  | str_entry "auto_dump_path"
+                 | bool_entry "auto_dump_bypass_cache"
+                 | bool_entry "auto_start_bypass_cache"
                  | 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..145062c 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -208,6 +208,22 @@
 #
 # 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_BYPASS_CACHE flag with the
+# virDomainCoreDump API.  That is, the system will avoid using the
+# file system cache while writing the dump file, but may cause
+# slower operation.
+#
+# auto_dump_bypass_cache = 0
+
+# When a domain is configured to be auto-started, enabling this flag
+# has the same effect as using the VIR_DOMAIN_START_BYPASS_CACHE flag
+# with the virDomainCreateWithFlags API.  That is, the system will
+# avoid using the file system cache when restoring any managed state
+# file, but may cause slower operation.
+#
+# auto_start_bypass_cache = 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 4a17a55..6efca6b 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,14 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
         }
     }

+    p = virConfGetValue (conf, "auto_dump_bypass_cache");
+    CHECK_TYPE ("auto_dump_bypass_cache", VIR_CONF_LONG);
+    if (p) driver->autoDumpBypassCache = true;
+
+    p = virConfGetValue (conf, "auto_start_bypass_cache");
+    CHECK_TYPE ("auto_start_bypass_cache", VIR_CONF_LONG);
+    if (p) driver->autoStartBypassCache = 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..0a60d32 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,9 @@ struct qemud_driver {
     char *dumpImageFormat;

     char *autoDumpPath;
+    bool autoDumpBypassCache;
+
+    bool autoStartBypassCache;

     pciDeviceList *activePciHostdevs;

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f6166c2..73d2938 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -149,11 +149,11 @@ qemuAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaq
                   vm->def->name,
                   err ? err->message : _("unknown error"));
     } else {
-        /* XXX need to wire bypass-cache autostart into qemu.conf */
         if (vm->autostart &&
             !virDomainObjIsActive(vm) &&
             qemuDomainObjStart(data->conn, data->driver, vm,
-                               false, false, false) < 0) {
+                               false, false,
+                               data->driver->autoStartBypassCache) < 0) {
             err = virGetLastError();
             VIR_ERROR(_("Failed to autostart VM '%s': %s"),
                       vm->def->name,
@@ -2872,9 +2872,9 @@ static void processWatchdogEvent(void *data, void *opaque)
                 goto endjob;
             }

-            /* XXX wire up qemu.conf to support bypass-cache dumps */
             ret = doCoreDump(driver, wdEvent->vm, dumpfile,
-                             getCompressionType(driver), false);
+                             getCompressionType(driver),
+                             driver->autoDumpBypassCache);
             if (ret < 0)
                 qemuReportError(VIR_ERR_OPERATION_FAILED,
                                 "%s", _("Dump failed"));
-- 
1.7.4.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]