From: Tiago Sousa via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Tiago Sousa <joao.sousa@eurotux.com>
Subject: [pve-devel] [PATCH pve-storage 2/4] storage: add extend queue handling
Date: Fri, 17 Oct 2025 12:25:27 +0100 [thread overview]
Message-ID: <mailman.60.1760700938.362.pve-devel@lists.proxmox.com> (raw)
In-Reply-To: <20251017112539.26471-1-joao.sousa@eurotux.com>
[-- Attachment #1: Type: message/rfc822, Size: 6119 bytes --]
From: Tiago Sousa <joao.sousa@eurotux.com>
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>
Signed-off-by: Tiago Sousa <joao.sousa@eurotux.com>
---
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);
use PVE::Tools qw(run_command file_read_firstline dir_glob_foreach $IPV6RE);
-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_register_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);
}
+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) = @_;
+ return cfs_write_file("extend-queue",$extend_queue);
+}
+
+sub lock_extend_queue {
+ my ($code, $errmsg) = @_;
+
+ cfs_lock_file("extend-queue", undef, $code);
+ my $err = $@;
+ if ($err) {
+ $errmsg ? die "$errmsg: $err" : die $err;
+ }
+}
+
+sub parser_extend_queue {
+ my ($filename, $raw) = @_;
+
+ my @queue;
+
+ my $lineno = 0;
+ my @lines = split(/\n/, $raw);
+ my $nextline = sub {
+ while (defined(my $line = shift @lines)) {
+ $lineno++;
+ return $line if ($line !~ /^\s*#/);
+ }
+ };
+
+ while (@lines) {
+ my $line = $nextline->();
+ next if !$line;
+ print "Current line $line\n";
+
+ # vmid: nodename
+ if ($line =~ '[1-9][0-9]{2,8}+: [aefz][0-9a-f]{30}') {
+ print "Extend request is valid\n";
+ my ($vmid, $nodename) = split(/:\s/, $line, 2);
+ push @queue, [$vmid, $nodename];
+ }
+ }
+ return \@queue;
+}
+
+sub writer_extend_queue {
+ my ($filename, $queue) = @_;
+
+ my $out = "";
+ foreach my $entry (@$queue) {
+ my ($vmid, $nodename) = @$entry;
+ $out .= format_extend_request($vmid, $nodename) . "\n";
+ }
+
+ return $out;
+}
+
+sub format_extend_request {
+ my ($vmid, $node_name) = @_;
+
+ my $request = $vmid . ': ' . $node_name;
+
+ return $request;
+}
+
sub lock_storage_config {
my ($code, $errmsg) = @_;
--
2.47.3
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-10-17 11:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20251017112539.26471-1-joao.sousa@eurotux.com>
2025-10-17 11:25 ` [pve-devel] [PATCH pve-storage 1/4] pvestord: setup new pvestord daemon Tiago Sousa via pve-devel
2025-10-17 11:25 ` Tiago Sousa via pve-devel [this message]
2025-10-17 11:25 ` [pve-devel] [PATCH pve-storage 3/4] lvmplugin: add thin volume support for LVM external snapshots Tiago Sousa via pve-devel
2025-10-17 11:25 ` [pve-devel] [PATCH pve-storage 4/4] plugin: lvmplugin: add underlay functions Tiago Sousa via pve-devel
2025-10-17 11:25 ` [pve-devel] [PATCH qemu-server 5/8] qmeventd: add block write threshold event handling Tiago Sousa via pve-devel
2025-10-17 11:25 ` [pve-devel] [PATCH qemu-server 6/8] blockdev: add set write threshold Tiago Sousa via pve-devel
2025-10-17 11:25 ` [pve-devel] [PATCH qemu-server 7/8] blockdev: add query-blockstats qmp command Tiago Sousa via pve-devel
2025-10-17 11:25 ` [pve-devel] [PATCH qemu-server 8/8] blockdev: add underlay resize Tiago Sousa via pve-devel
2025-10-17 11:25 ` [pve-devel] [PATCH pve-cluster 9/9] observe extend queue Tiago Sousa via pve-devel
2025-10-17 11:25 ` [pve-devel] [PATCH pve-manager 10/10] services: add pvestord service Tiago Sousa via pve-devel
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=mailman.60.1760700938.362.pve-devel@lists.proxmox.com \
--to=pve-devel@lists.proxmox.com \
--cc=joao.sousa@eurotux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox