all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] vm start: switch to new cleanup_transient_unit systemd helper
Date: Tue, 20 Jun 2023 17:00:50 +0200	[thread overview]
Message-ID: <20230620150050.184347-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20230620150050.184347-1-f.ebner@proxmox.com>

which also runs a reset-failed command for the unit first, to ensure
it is also cleaned up properly if in a failed state (e.g. after being
OOM-killed). Previuosly, users in that situation would only see the
less than ideal error message 'timeout waiting on systemd'.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

Dependency bump for libpve-common-perl needed.

 PVE/QemuServer.pm            | 7 +------
 test/MigrationTest/Shared.pm | 2 +-
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 940cdacd..34d9b0b1 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5871,12 +5871,7 @@ sub vm_start_nolock {
 
     PVE::Storage::activate_volumes($storecfg, $vollist);
 
-    eval {
-	run_command(['/bin/systemctl', 'stop', "$vmid.scope"], outfunc => sub{}, errfunc => sub{});
-    };
-    # Issues with the above 'stop' not being fully completed are extremely rare, a very low
-    # timeout should be more than enough here...
-    PVE::Systemd::wait_for_unit_removed("$vmid.scope", 20);
+    PVE::Systemd::cleanup_transient_unit("$vmid.scope", 20);
 
     my $cpuunits = PVE::CGroup::clamp_cpu_shares($conf->{cpuunits});
 
diff --git a/test/MigrationTest/Shared.pm b/test/MigrationTest/Shared.pm
index aa7203d1..44624f7f 100644
--- a/test/MigrationTest/Shared.pm
+++ b/test/MigrationTest/Shared.pm
@@ -191,7 +191,7 @@ $storage_plugin_module->mock(
 
 our $systemd_module = Test::MockModule->new("PVE::Systemd");
 $systemd_module->mock(
-    wait_for_unit_removed => sub {
+    cleanup_transient_unit => sub {
 	return;
     },
     enter_systemd_scope => sub {
-- 
2.39.2





  reply	other threads:[~2023-06-20 15:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 15:00 [pve-devel] [PATCH common] systemd: add helper to cleanup transient unit Fiona Ebner
2023-06-20 15:00 ` Fiona Ebner [this message]
2023-06-22 12:56 ` Thomas Lamprecht

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=20230620150050.184347-2-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal