qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Kostiuk <kkostiuk@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Subject: [PULL 6/6] qga: Fix suspend on Linux guests without systemd
Date: Thu,  4 May 2023 12:56:57 +0300	[thread overview]
Message-ID: <20230504095657.239048-7-kkostiuk@redhat.com> (raw)
In-Reply-To: <20230504095657.239048-1-kkostiuk@redhat.com>

From: Mark Somerville <mark@qpok.net>

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>
---
 qga/commands-posix.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 97754930c1..def857d773 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -1922,10 +1922,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);
@@ -1934,10 +1934,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);
-- 
2.25.1



  parent reply	other threads:[~2023-05-04  9:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04  9:56 [PULL 0/6] Misc QGA patches Konstantin Kostiuk
2023-05-04  9:56 ` [PULL 1/6] qga/linux: add usb support to guest-get-fsinfo Konstantin Kostiuk
2023-05-04  9:56 ` [PULL 2/6] qga: Refactor guest-exec capture-output to take enum Konstantin Kostiuk
2023-05-04  9:56 ` [PULL 3/6] qga: Add `merged` variant to GuestExecCaptureOutputMode Konstantin Kostiuk
2023-05-04  9:56 ` [PULL 4/6] qga: test: Add tests for `merged` flag Konstantin Kostiuk
2023-05-04  9:56 ` [PULL 5/6] qga/commands-win32.c: Drop the check for _WIN32_WINNT >= 0x0601 Konstantin Kostiuk
2023-05-04  9:56 ` Konstantin Kostiuk [this message]
2023-05-04 11:10 ` [PULL 0/6] Misc QGA patches Richard Henderson
2023-05-04 11:22   ` Konstantin Kostiuk
2023-05-04 14:41 ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230504095657.239048-7-kkostiuk@redhat.com \
    --to=kkostiuk@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).