1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-30 18:50:18 +03:00

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 <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2024-12-19 19:18:04 +00:00
parent faa7a082a1
commit b11c76e514
2 changed files with 6 additions and 2 deletions

View 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]);
}

View 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);