From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 6688D1FF15C for ; Fri, 17 Oct 2025 13:35:41 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 414E5452; Fri, 17 Oct 2025 13:35:39 +0200 (CEST) To: pve-devel@lists.proxmox.com Date: Fri, 17 Oct 2025 12:25:27 +0100 In-Reply-To: <20251017112539.26471-1-joao.sousa@eurotux.com> References: <20251017112539.26471-1-joao.sousa@eurotux.com> MIME-Version: 1.0 Message-ID: List-Id: Proxmox VE development discussion List-Post: From: Tiago Sousa via pve-devel Precedence: list Cc: Tiago Sousa X-Mailman-Version: 2.1.29 X-BeenThere: pve-devel@lists.proxmox.com List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: Proxmox VE development discussion List-Help: Subject: [pve-devel] [PATCH pve-storage 2/4] storage: add extend queue handling Content-Type: multipart/mixed; boundary="===============4490477664332921035==" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" --===============4490477664332921035== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: X-Original-To: pve-devel@lists.proxmox.com Delivered-To: pve-devel@lists.proxmox.com Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 91433D0F94 for ; Fri, 17 Oct 2025 13:35:36 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7268727D96 for ; Fri, 17 Oct 2025 13:35:06 +0200 (CEST) Received: from eurotux.com (mail.eurotux.com [185.98.249.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 17 Oct 2025 13:35:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by eurotux.com (Postfix) with ESMTP id E325130D17C6; Fri, 17 Oct 2025 12:26:02 +0100 (WEST) Authentication-Results: mail.prd.eurotux.pt (amavisd-new); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=eurotux.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eurotux.com; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from; s= default; t=1760700361; x=1762514762; bh=Bre/zGbQP0mTmX4Nvyw6xPc6 Urs8RQmbpsePKUQC/aw=; b=Z9Rkvs6tdsEaJiqKcSm00/MF/XMw0OUzKihtrY8o WNkcW179jsn/UBI6a8r36A5YJF+tJ3R+HlXEyP75ZAGn5TSsQDt/TX0eLEvkOEiH jp92e5lg+bNu08DMAlYQ5jEAyuuxywaHA0jB3jKOP2chuCI9Jm4G6cwOPzixz31D ZC8eRGqR2HUApHc9XF7PPaLcXOKlkqHipgmxDQztzUXswqKmH12xaUXkGng34XEU Yn+pdLUW2t5Uq73tMa2uhq395v0cxEviCN+O/Kq0HHBoWrCW1BpNrWoe3w/V8opF K0Yd5tC5rcaOx+yhzaiB5r9kQkX8kGTtAC9Brf7SbtoxWw== X-Virus-Scanned: amavisd-new at mail.prd.eurotux.pt Received: from eurotux.com ([127.0.0.1]) by localhost (mail.prd.eurotux.pt [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ToadD5J1_TWR; Fri, 17 Oct 2025 12:26:01 +0100 (WEST) Received: from proxmox.example (184.137.90.149.rev.vodafone.pt [149.90.137.184]) (Authenticated sender: joao.sousa@eurotux.com) by eurotux.com (Postfix) with ESMTPSA id 68B9E30CFB17; Fri, 17 Oct 2025 12:26:01 +0100 (WEST) From: Tiago Sousa To: pve-devel@lists.proxmox.com Subject: [PATCH pve-storage 2/4] storage: add extend queue handling Date: Fri, 17 Oct 2025 12:25:27 +0100 Message-ID: <20251017112539.26471-3-joao.sousa@eurotux.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017112539.26471-1-joao.sousa@eurotux.com> References: <20251017112539.26471-1-joao.sousa@eurotux.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL -0.000 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) SPF_HELO_PASS -0.001 SPF: HELO matches SPF record SPF_PASS -0.001 SPF: sender matches SPF record Signed-off-by: Tiago Sousa --- src/PVE/Storage.pm | 72 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm index 1dde2b7..ebbaf45 100755 --- a/src/PVE/Storage.pm +++ b/src/PVE/Storage.pm @@ -15,7 +15,7 @@ use Socket; use Time::Local qw(timelocal); =20 use PVE::Tools qw(run_command file_read_firstline dir_glob_foreach $IPV6= RE); -use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file); +use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file cfs_regis= ter_file); use PVE::DataCenterConfig; use PVE::Exception qw(raise_param_exc raise); use PVE::JSONSchema; @@ -239,6 +239,76 @@ sub write_config { cfs_write_file('storage.cfg', $cfg); } =20 +cfs_register_file("extend-queue", \&parser_extend_queue, \&writer_extend= _queue); + +sub extend_queue { + return cfs_read_file("extend-queue"); +} + +sub write_extend_queue { + my ($extend_queue) =3D @_; + return cfs_write_file("extend-queue",$extend_queue); +} + +sub lock_extend_queue { + my ($code, $errmsg) =3D @_; + + cfs_lock_file("extend-queue", undef, $code); + my $err =3D $@; + if ($err) { + $errmsg ? die "$errmsg: $err" : die $err; + } +} + +sub parser_extend_queue { + my ($filename, $raw) =3D @_; + + my @queue; + + my $lineno =3D 0; + my @lines =3D split(/\n/, $raw); + my $nextline =3D sub { + while (defined(my $line =3D shift @lines)) { + $lineno++; + return $line if ($line !~ /^\s*#/); + } + }; + + while (@lines) { + my $line =3D $nextline->(); + next if !$line; + print "Current line $line\n"; + + # vmid: nodename + if ($line =3D~ '[1-9][0-9]{2,8}+: [aefz][0-9a-f]{30}') { + print "Extend request is valid\n"; + my ($vmid, $nodename) =3D split(/:\s/, $line, 2); + push @queue, [$vmid, $nodename]; + } + } + return \@queue; +} + +sub writer_extend_queue { + my ($filename, $queue) =3D @_; + + my $out =3D ""; + foreach my $entry (@$queue) { + my ($vmid, $nodename) =3D @$entry; + $out .=3D format_extend_request($vmid, $nodename) . "\n"; + } + + return $out; +} + +sub format_extend_request { + my ($vmid, $node_name) =3D @_; + + my $request =3D $vmid . ': ' . $node_name; + + return $request; +} + sub lock_storage_config { my ($code, $errmsg) =3D @_; =20 --=20 2.47.3 --===============4490477664332921035== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel --===============4490477664332921035==--