From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id A40DD1FF0AF for ; Fri, 06 Nov 2026 15:48:42 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 8724121631; Fri, 06 Nov 2026 15:48:38 +0100 (CET) Message-ID: Date: Fri, 6 Nov 2026 15:48:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH manager 07/19] vzdump: stop all running backup jobs of the node To: Thomas Lamprecht , pve-devel@lists.proxmox.com References: <20261101225849.884587-1-t.lamprecht@proxmox.com> <20261101225849.884587-8-t.lamprecht@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20261101225849.884587-8-t.lamprecht@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793976513683 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.292 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: O3C5FRM5G6QMM5NE3YWHE6KKGGBAGW5N X-Message-ID-Hash: O3C5FRM5G6QMM5NE3YWHE6KKGGBAGW5N X-MailFrom: f.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Am 01.11.26 um 11:59 PM schrieb Thomas Lamprecht: > @@ -1566,26 +1561,26 @@ sub verify_vzdump_parameters { > } > > sub stop_running_backups { > - my ($self) = @_; > + my $nodename = PVE::INotify::nodename(); > > - my $upid = PVE::Tools::file_read_firstline($pidfile); > - return if !$upid; > + my $running = []; > + for my $worker (PVE::RPCEnvironment::get()->active_workers()->@*) { > + my $task = PVE::Tools::upid_decode($worker->{upid}, 1) or next; Nit: could use PVE::UPID > + next if $task->{type} ne 'vzdump' || $task->{node} ne $nodename; > + next if !PVE::ProcFSTools::check_process_running($task->{pid}, $task->{pstart}); > > - my $task = PVE::Tools::upid_decode($upid); > + # the whole process group, like stopping the task does > + kill(15, -$task->{pid}); > + push $running->@*, $task; > + } > > - if ( > - PVE::ProcFSTools::check_process_running($task->{pid}, $task->{pstart}) > - && PVE::ProcFSTools::read_proc_starttime($task->{pid}) == $task->{pstart} > - ) { > - kill(15, $task->{pid}); > - # wait max 15 seconds to shut down (else, do nothing for now) > - my $i; > - for ($i = 15; $i > 0; $i--) { > - last if !PVE::ProcFSTools::check_process_running(($task->{pid}, $task->{pstart})); > - sleep(1); > - } > - die "stopping backup process $task->{pid} failed\n" if $i == 0; > + for (1 .. 15) { > + $running = [grep { PVE::ProcFSTools::check_process_running($_->{pid}, $_->{pstart}) } > + $running->@*]; > + return if !scalar($running->@*); > + sleep(1); > } > + die "stopping backup process " . join(', ', map { $_->{pid} } $running->@*) . " failed\n"; Nit: could say "process(es)" or conditionally use singular/plural > } > > sub get_included_guests {