]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hypervisor: support bypassing cache for managed save
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 19 Dec 2024 19:18:04 +0000 (19:18 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 20 Mar 2025 14:55:17 +0000 (14:55 +0000)
Bypassing cache can make save performance more predictable and avoids
trashing the OS cache with data that will not be read again.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/hypervisor/domain_driver.c
src/hypervisor/domain_driver.h

index 940a44c4c9869377ebcc986a8a84e47df2bdde90..9cad2e5da1a4ae42da2cad761a96c29912f9747c 100644 (file)
@@ -731,12 +731,12 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdownConfig *cfg)
     virDomainPtr *domains = NULL;
     g_autofree bool *transient = NULL;
 
-    VIR_DEBUG("Run autoshutdown uri=%s trySave=%s tryShutdown=%s poweroff=%s waitShutdownSecs=%u",
+    VIR_DEBUG("Run autoshutdown uri=%s trySave=%s tryShutdown=%s poweroff=%s waitShutdownSecs=%u saveBypassCache=%d",
               cfg->uri,
               virDomainDriverAutoShutdownScopeTypeToString(cfg->trySave),
               virDomainDriverAutoShutdownScopeTypeToString(cfg->tryShutdown),
               virDomainDriverAutoShutdownScopeTypeToString(cfg->poweroff),
-              cfg->waitShutdownSecs);
+              cfg->waitShutdownSecs, cfg->saveBypassCache);
 
     /*
      * Ideally guests will shutdown in a few seconds, but it would
@@ -806,6 +806,9 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdownConfig *cfg)
                 if (state == VIR_DOMAIN_PAUSED)
                     flags[i] = VIR_DOMAIN_SAVE_PAUSED;
             }
+            if (cfg->saveBypassCache)
+                flags[i] |= VIR_DOMAIN_SAVE_BYPASS_CACHE;
+
             if (flags[i] & VIR_DOMAIN_SAVE_RUNNING)
                 virDomainSuspend(domains[i]);
         }
index 6e535ca4444149f136e2bdec47b84a7851605167..fae316ee2d71565366cff7cefe94a799c82efe29 100644 (file)
@@ -112,6 +112,7 @@ typedef struct _virDomainDriverAutoShutdownConfig {
                                     * before moving onto next action.
                                     * If 0 a default is used (currently 30 secs)
                                     */
+    bool saveBypassCache;
 } virDomainDriverAutoShutdownConfig;
 
 void virDomainDriverAutoShutdown(virDomainDriverAutoShutdownConfig *cfg);