]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: add config parameter to control auto-save bypass cache
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 19 Dec 2024 19:21:31 +0000 (19:21 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 20 Mar 2025 14:55:17 +0000 (14:55 +0000)
When doing managed save of VMs, triggered by OS shutdown, it may
be desirable to control cache usage.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/libvirtd_qemu.aug
src/qemu/qemu.conf.in
src/qemu/qemu_conf.c
src/qemu/qemu_conf.h
src/qemu/qemu_driver.c
src/qemu/test_libvirtd_qemu.aug.in

index 7f47bbd1f13d79295a0dbde7244ef1dcd54f173e..2871c5b1285dd33dc0d528a71acf8ab26d8541d2 100644 (file)
@@ -107,6 +107,7 @@ module Libvirtd_qemu =
                  | str_entry "auto_shutdown_try_shutdown"
                  | str_entry "auto_shutdown_poweroff"
                  | int_entry "auto_shutdown_wait"
+                 | bool_entry "auto_save_bypass_cache"
 
    let process_entry = str_entry "hugetlbfs_mount"
                  | str_entry "bridge_helper"
index fbb6fbf009dc6f5814382528967e874bee895c16..e4859f9b5937f2a882de3ecaf4addbafc6f7c00a 100644 (file)
 # is currently 30 secs)
 #auto_shutdown_wait = 30
 
+# When a domain is configured to be auto-saved on shutdown, enabling
+# this flag has the same effect as using the VIR_DOMAIN_SAVE_BYPASS_CACHE
+# flag with the virDomainManagedSave API.  That is, the system will
+# avoid using the file system cache when writing any managed state
+# file, but may cause slower operation.
+#
+#auto_save_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 6fbc42bf1fe426a3ff6ca54a7f9b9b3af53c78ec..a9dde2bcabbdf34845e3a2d73e11b7c849a111ff 100644 (file)
@@ -766,6 +766,9 @@ virQEMUDriverConfigLoadSaveEntry(virQEMUDriverConfig *cfg,
     if (virConfGetValueUInt(conf, "auto_shutdown_wait",
                             &cfg->autoShutdownWait) < 0)
         return -1;
+    if (virConfGetValueBool(conf, "auto_save_bypass_cache",
+                            &cfg->autoSaveBypassCache) < 0)
+        return -1;
 
     return 0;
 }
index d0c7fe8ccb240f90b6441e124f485747b6b48d37..6171b3f5df0dac6264bd4fdcd079a04bb129a9e0 100644 (file)
@@ -216,6 +216,7 @@ struct _virQEMUDriverConfig {
     virDomainDriverAutoShutdownScope autoShutdownTryShutdown;
     virDomainDriverAutoShutdownScope autoShutdownPoweroff;
     unsigned int autoShutdownWait;
+    bool autoSaveBypassCache;
 
     char *lockManagerName;
 
index afb97ac1bf305d2721935e2bd8b84df334a6844c..a567d69b7cd1f947db4580eb45a94ee4f02af9d0 100644 (file)
@@ -970,6 +970,7 @@ qemuStateStop(void)
         .tryShutdown = cfg->autoShutdownTryShutdown,
         .poweroff = cfg->autoShutdownPoweroff,
         .waitShutdownSecs = cfg->autoShutdownWait,
+        .saveBypassCache = cfg->autoSaveBypassCache,
     };
 
     virDomainDriverAutoShutdown(&ascfg);
index 57604d5db2b8b16fbdffb6eb7d5e862a1ca3f9b3..b242cb5be175cefc29241701f5a5c9d563484936 100644 (file)
@@ -84,6 +84,7 @@ module Test_libvirtd_qemu =
 { "auto_shutdown_try_shutdown" = "all" }
 { "auto_shutdown_poweroff" = "all" }
 { "auto_shutdown_wait" = "30" }
+{ "auto_save_bypass_cache" = "0" }
 { "hugetlbfs_mount" = "/dev/hugepages" }
 { "bridge_helper" = "qemu-bridge-helper" }
 { "set_process_name" = "1" }