diff options
author | Mark Somerville <mark@qpok.net> | 2023-04-06 13:45:31 +0100 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2023-06-08 13:30:56 +0300 |
commit | 07e7102b8eb822d9c035c329382d8a3d9cf9bfd6 (patch) | |
tree | 7254af2fb327e18e3a3510a24da1540be6252baa /qga | |
parent | 8e84a20705cae1fc1cd268de06e46eaa17bf6b06 (diff) |
qga: Fix suspend on Linux guests without systemd
Allow the Linux guest agent to attempt each of the suspend methods
(systemctl, pm-* and writing to /sys) in turn.
Prior to this guests without systemd failed to suspend due to
`guest_suspend` returning early regardless of the return value of
`systemd_supports_mode`.
Signed-off-by: Mark Somerville <mark@qpok.net>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
(cherry picked from commit 86dcb6ab9b603450eb6d896cdc95286de2c7d561)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'qga')
-rw-r--r-- | qga/commands-posix.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 32493d6383..182eba4a38 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -1925,10 +1925,10 @@ static void guest_suspend(SuspendMode mode, Error **errp) if (systemd_supports_mode(mode, &local_err)) { mode_supported = true; systemd_suspend(mode, &local_err); - } - if (!local_err) { - return; + if (!local_err) { + return; + } } error_free(local_err); @@ -1937,10 +1937,10 @@ static void guest_suspend(SuspendMode mode, Error **errp) if (pmutils_supports_mode(mode, &local_err)) { mode_supported = true; pmutils_suspend(mode, &local_err); - } - if (!local_err) { - return; + if (!local_err) { + return; + } } error_free(local_err); |