From: "Max R. Carrara" <m.carrara@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-storage 9/9] luncmd: lio: use v5.36 and use subroutine signatures
Date: Thu, 25 Jun 2026 18:41:01 +0200 [thread overview]
Message-ID: <20260625164110.706694-10-m.carrara@proxmox.com> (raw)
In-Reply-To: <20260625164110.706694-1-m.carrara@proxmox.com>
Finish modernizing the LIO module through `use v5.36;` and giving
every non-anonymous subroutine its respective signature.
Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
---
src/PVE/Storage/LunCmd/LIO.pm | 56 ++++++++++-------------------------
1 file changed, 16 insertions(+), 40 deletions(-)
diff --git a/src/PVE/Storage/LunCmd/LIO.pm b/src/PVE/Storage/LunCmd/LIO.pm
index 534a0508..62125e9e 100644
--- a/src/PVE/Storage/LunCmd/LIO.pm
+++ b/src/PVE/Storage/LunCmd/LIO.pm
@@ -19,8 +19,8 @@ package PVE::Storage::LunCmd::LIO;
# Author: udo.rader@bestsolution.at
# -----------------------------------------------------------------
-use strict;
-use warnings;
+use v5.36;
+
use PVE::Tools qw(run_command);
use JSON;
@@ -39,9 +39,7 @@ my @ssh_cmd = ('/usr/bin/ssh', @ssh_opts);
my $id_rsa_path = '/etc/pve/priv/zfs';
my $targetcli = '/usr/bin/targetcli';
-my sub run_remote_command {
- my ($scfg, $cmd, %param) = @_;
-
+my sub run_remote_command($scfg, $cmd, %param) {
my $out_log = '';
my $err_log = '';
my $merged_log = '';
@@ -90,9 +88,7 @@ my sub run_remote_command {
};
}
-my sub fetch_remote_config {
- my ($scfg, $timeout) = @_;
-
+my sub fetch_remote_config($scfg, $timeout) {
for my $file (@CONFIG_FILES) {
my $fetch_res = run_remote_command(
$scfg, ['cat', $file], timeout => $timeout,
@@ -112,9 +108,7 @@ my sub fetch_remote_config {
die "No configuration found. Install targetcli on $scfg->{portal}\n";
}
-my sub parse_remote_config {
- my ($scfg, $remote_config_json) = @_;
-
+my sub parse_remote_config($scfg, $remote_config_json) {
my $tpg = $scfg->{lio_tpg} || die "Target Portal Group not set, aborting!\n";
$tpg =~ m/^tpg(?<tpg_tag>[0-9]+)$/;
@@ -166,17 +160,14 @@ my sub parse_remote_config {
return $parsed_config;
}
-my sub get_backstore_prefix {
- my ($scfg) = @_;
+my sub get_backstore_prefix($scfg) {
my $pool = $scfg->{pool};
$pool =~ s/\//-/g;
return $pool . '-';
}
# extracts the ZFS volume name from a device path
-my sub extract_volname {
- my ($scfg, $config, $lunpath) = @_;
-
+my sub extract_volname($scfg, $config, $lunpath) {
my $base = get_base($scfg);
$lunpath =~ m/^$base\/$scfg->{pool}\/(?<volname>[\w\-\.]+)$/;
@@ -203,9 +194,7 @@ my sub extract_volname {
}
# retrieves the LUN index for a particular object
-my sub list_view {
- my ($scfg, $config, $timeout, $method, @params) = @_;
-
+my sub list_view($scfg, $config, $timeout, $method, @params) {
my $object = shift @params;
my $volname = extract_volname($scfg, $config, $object);
return if !defined($volname); # nothing to search for..
@@ -223,9 +212,7 @@ my sub list_view {
}
# determines if the given object exists on the portal
-my sub list_lun {
- my ($scfg, $config, $timeout, $method, @params) = @_;
-
+my sub list_lun($scfg, $config, $timeout, $method, @params) {
my $object = shift @params;
my $volname = extract_volname($scfg, $config, $object);
@@ -242,9 +229,7 @@ my sub list_lun {
}
# adds a new LUN to the target
-my sub create_lun {
- my ($scfg, $config, $timeout, $method, @params) = @_;
-
+my sub create_lun($scfg, $config, $timeout, $method, @params) {
my $device = $params[0];
if (list_lun($scfg, $config, $timeout, $method, @params)) {
@@ -316,8 +301,7 @@ my sub create_lun {
return $register_res->{'merged-log'};
}
-my sub delete_lun {
- my ($scfg, $config, $timeout, $method, @params) = @_;
+my sub delete_lun($scfg, $config, $timeout, $method, @params) {
my $tpg = $scfg->{lio_tpg} || die "Target Portal Group not set, aborting!\n";
my $path = $params[0];
@@ -368,22 +352,17 @@ my sub delete_lun {
die "Failed to delete LUN '$path'";
}
-my sub import_lun {
- my ($scfg, $config, $timeout, $method, @params) = @_;
-
+my sub import_lun($scfg, $config, $timeout, $method, @params) {
return create_lun($scfg, $config, $timeout, $method, @params);
}
# needed for example when the underlying ZFS volume has been resized
-my sub modify_lun {
- my ($scfg, $config, $timeout, $method, @params) = @_;
+my sub modify_lun($scfg, $config, $timeout, $method, @params) {
# Nothing to do on volume modification for LIO
return;
}
-my sub add_view {
- my ($scfg, $config, $timeout, $method, @params) = @_;
-
+my sub add_view($scfg, $config, $timeout, $method, @params) {
return '';
}
@@ -397,9 +376,7 @@ my %lun_cmd_map = (
list_lu => sub { list_lun(@_) },
);
-sub run_lun_command {
- my ($scfg, $timeout, $method, @params) = @_;
-
+sub run_lun_command($scfg, $timeout, $method, @params) {
die "unknown command '$method'" unless exists $lun_cmd_map{$method};
my $remote_config_json = fetch_remote_config($scfg, $timeout);
@@ -410,8 +387,7 @@ sub run_lun_command {
return $msg;
}
-sub get_base {
- my ($scfg) = @_;
+sub get_base($scfg) {
return $scfg->{'zfs-base-path'} || '/dev';
}
--
2.47.3
prev parent reply other threads:[~2026-06-25 16:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 16:40 [PATCH storage 0/9] Fix ZFS-over-iSCSI plugin w/ LIO Provider Issues Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 1/9] luncmd: lio: fix various errors by removing caching mechanism Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 2/9] luncmd: lio: fix LUN ops failing when passing nonstandard LUN path Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 3/9] luncmd: lio: remove rest of old parsing logic Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 4/9] luncmd: lio: modernize helpers Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 5/9] luncmd: lio: modernize & clean up `list_view()` and `list_lun()` subs Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 6/9] luncmd: lio: modernize sub `create_lun()` Max R. Carrara
2026-06-25 16:40 ` [PATCH pve-storage 7/9] luncmd: lio: modernize sub `delete_lun()` Max R. Carrara
2026-06-25 16:41 ` [PATCH pve-storage 8/9] luncmd: lio: modernize remaining LUN command subroutines Max R. Carrara
2026-06-25 16:41 ` Max R. Carrara [this message]
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=20260625164110.706694-10-m.carrara@proxmox.com \
--to=m.carrara@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox