Skip to content

Commit

Permalink
qga: Fix suspend on Linux guests without systemd
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Konstantin Kostiuk <[email protected]>
Signed-off-by: Konstantin Kostiuk <[email protected]>
(cherry picked from commit 86dcb6ab9b603450eb6d896cdc95286de2c7d561)
Signed-off-by: Michael Tokarev <[email protected]>
  • Loading branch information
Mark Somerville authored and Michael Tokarev committed Jun 8, 2023
1 parent 8e84a20 commit 07e7102
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions qga/commands-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 07e7102

Please sign in to comment.