mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-30 18:50:18 +03:00
remote: always invoke virStateStop for all daemons
Currently the virStateStop method is only wired up to run save for the unprivileged daemons, so there is no functional change. IOW, session exit, or host OS shutdown will trigger VM managed saved for QEMU session daemon, but not the system daemon. This changes the daemon code to always run virStateStop for all daemons. Instead the QEMU driver is responsible for skipping its own logic when running privileged...for now. This means that virStateStop will now be triggered by logind's PrepareForShutdown signal. Reviewed-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
991a20a938
commit
2b792b35a4
@ -968,7 +968,8 @@ qemuStateStop(void)
|
||||
.uri = cfg->uri,
|
||||
};
|
||||
|
||||
virDomainDriverAutoShutdown(&ascfg);
|
||||
if (!qemu_driver->privileged)
|
||||
virDomainDriverAutoShutdown(&ascfg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -628,30 +628,32 @@ static void daemonRunStateInit(void *opaque)
|
||||
virStateShutdownPrepare,
|
||||
virStateShutdownWait);
|
||||
|
||||
/* Tie the non-privileged daemons to the session/shutdown lifecycle */
|
||||
/* Signal for VM shutdown when desktop session is terminated, in
|
||||
* unprivileged daemons */
|
||||
if (!virNetDaemonIsPrivileged(dmn)) {
|
||||
|
||||
if (virGDBusHasSessionBus()) {
|
||||
sessionBus = virGDBusGetSessionBus();
|
||||
if (sessionBus != NULL)
|
||||
g_dbus_connection_add_filter(sessionBus,
|
||||
handleSessionMessageFunc, dmn, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (virGDBusHasSystemBus()) {
|
||||
systemBus = virGDBusGetSystemBus();
|
||||
if (systemBus != NULL)
|
||||
g_dbus_connection_signal_subscribe(systemBus,
|
||||
"org.freedesktop.login1",
|
||||
"org.freedesktop.login1.Manager",
|
||||
"PrepareForShutdown",
|
||||
NULL,
|
||||
NULL,
|
||||
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||
handleSystemMessageFunc,
|
||||
dmn,
|
||||
NULL);
|
||||
}
|
||||
if (virGDBusHasSystemBus()) {
|
||||
/* Signal for VM shutdown when host OS shutdown is requested, in
|
||||
* both privileged and unprivileged daemons */
|
||||
systemBus = virGDBusGetSystemBus();
|
||||
if (systemBus != NULL)
|
||||
g_dbus_connection_signal_subscribe(systemBus,
|
||||
"org.freedesktop.login1",
|
||||
"org.freedesktop.login1.Manager",
|
||||
"PrepareForShutdown",
|
||||
NULL,
|
||||
NULL,
|
||||
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||
handleSystemMessageFunc,
|
||||
dmn,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* Only now accept clients from network */
|
||||
|
Loading…
x
Reference in New Issue
Block a user