]> xenbits.xensource.com Git - libvirt.git/commitdiff
save: support bypass-cache flag in qemu.conf
authorEric Blake <eblake@redhat.com>
Tue, 19 Jul 2011 21:54:48 +0000 (15:54 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 21 Jul 2011 22:24:09 +0000 (16:24 -0600)
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.

src/qemu/libvirtd_qemu.aug
src/qemu/qemu.conf
src/qemu/qemu_conf.c
src/qemu/qemu_conf.h
src/qemu/qemu_driver.c

index 66858aebe196a2cf3bed5a4cfad75dc3a0a94971..d018ac259d01ddbf1bd51aef1b36ff77b4b7f5b1 100644 (file)
@@ -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"
index 934f99b1554ce57ab391fbb502817ed112e648c2..145062c6e21764737c2a2dd9df3babee557164b4 100644 (file)
 #
 # 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
index 4a17a55563802cbdaa4da2d3955f361ea702ec03..6efca6baedb542ae977dbc2e6c744555f341cad1 100644 (file)
@@ -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) {
index fa4c607d4a15775e3ddd4a400b67d372d45c7c92..0a60d324cfdbdf98eb5775c1b9977550c05b5799 100644 (file)
@@ -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;
 
index c32de3b47b5f22dac69be50f95b47330c5854790..140196733704619116c74de68c9a6d7b6a8b3fcc 100644 (file)
@@ -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 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,
@@ -2952,9 +2952,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"));