Bypassing cache can make save performance more predictable and avoids
trashing the OS cache with data that will not be read again.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
src/hypervisor/domain_driver.c | 7 +++++--
src/hypervisor/domain_driver.h | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c
index 4fecaf7e5c..867ee1ae2a 100644
--- a/src/hypervisor/domain_driver.c
+++ b/src/hypervisor/domain_driver.c
@@ -725,9 +725,9 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdownConfig *cfg)
g_autofree bool *transient = NULL;
VIR_DEBUG("Run autoshutdown uri=%s trySave=%d tryShutdown=%d poweroff=%d"
- "waitShutdownSecs=%d",
+ "waitShutdownSecs=%d saveBypassCache=%d",
cfg->uri, cfg->trySave, cfg->tryShutdown, cfg->poweroff,
- cfg->waitShutdownSecs);
+ cfg->waitShutdownSecs, cfg->saveBypassCache);
/*
* Ideally guests will shutdown in a few seconds, but it would
@@ -784,6 +784,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;
+
virDomainSuspend(domains[i]);
}
diff --git a/src/hypervisor/domain_driver.h b/src/hypervisor/domain_driver.h
index acb7a41b5d..16832f2449 100644
--- a/src/hypervisor/domain_driver.h
+++ b/src/hypervisor/domain_driver.h
@@ -108,6 +108,7 @@ typedef struct _virDomainDriverAutoShutdownConfig {
virDomainDriverAutoShutdownScope tryShutdown;
virDomainDriverAutoShutdownScope poweroff;
int waitShutdownSecs;
+ bool saveBypassCache;
} virDomainDriverAutoShutdownConfig;
void virDomainDriverAutoShutdown(virDomainDriverAutoShutdownConfig *cfg);
--
2.47.1