On Wed, Jan 08, 2025 at 19:42:59 +0000, Daniel P. Berrangé wrote:
Since processing running VMs on OS shutdown can take a while, it is
beneficial to send systemd status messages about the progress.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/hypervisor/domain_driver.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c
index 2f89b8c841..421cc16574 100644
--- a/src/hypervisor/domain_driver.c
+++ b/src/hypervisor/domain_driver.c
@@ -30,6 +30,7 @@
#include "datatypes.h"
#include "driver.h"
#include "virlog.h"
+#include "virsystemd.h"
#define VIR_FROM_THIS VIR_FROM_DOMAIN
@@ -791,6 +792,8 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdownConfig *cfg)
(!transient[i] && cfg->trySave ==
VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_SCOPE_TRANSIENT))
continue;
+ virSystemdNotifyStatus("Suspending '%s' (%zu of %d)",
+ virDomainGetName(domains[i]), i + 1, numDomains);
As discussed in other sub-thread these messages are what I wanted, but
you'll need to make sure that they end up in the system log, otherwise
they won't help much.
Also specifically for suspend I'm not sure if this message makes too
much sense separately as it's just a sub-step of the 'save' operation.
/*
* Pause all VMs to make them stop dirtying pages,
* so save is quicker. We remember if any VMs were
@@ -808,6 +811,9 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdownConfig *cfg)
}
for (i = 0; i < numDomains; i++) {
+ virSystemdNotifyStatus("Saving '%s' (%zu of %d)",
+ virDomainGetName(domains[i]), i + 1, numDomains);
+
if (virDomainManagedSave(domains[i], flags[i]) < 0) {
VIR_WARN("Unable to perform managed save of '%s': %s",
Also these should IMO be delivered using exactly the same mechanism as
the success messages as well (in addition to being a warning perhaps).