From b11c76e5142dc6fe32d702de846b60f7e0f2923f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 19 Dec 2024 19:18:04 +0000 Subject: [PATCH] hypervisor: support bypassing cache for managed save MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Daniel P. Berrangé --- 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 940a44c4c9..9cad2e5da1 100644 --- a/src/hypervisor/domain_driver.c +++ b/src/hypervisor/domain_driver.c @@ -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]); } diff --git a/src/hypervisor/domain_driver.h b/src/hypervisor/domain_driver.h index 6e535ca444..fae316ee2d 100644 --- a/src/hypervisor/domain_driver.h +++ b/src/hypervisor/domain_driver.h @@ -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); -- 2.47.2