From: Daniel P. Berrangé Date: Thu, 19 Dec 2024 19:18:04 +0000 (+0000) Subject: hypervisor: support bypassing cache for managed save X-Git-Tag: v11.2.0-rc1~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b11c76e5142dc6fe32d702de846b60f7e0f2923f;p=thirdparty%2Flibvirt.git hypervisor: support bypassing cache for managed save 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é --- 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);