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 8CE6D1FF13C for ; Thu, 25 Jun 2026 18:42:10 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D66CCBC5; Thu, 25 Jun 2026 18:41:50 +0200 (CEST) From: "Max R. Carrara" 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 Message-ID: <20260625164110.706694-10-m.carrara@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260625164110.706694-1-m.carrara@proxmox.com> References: <20260625164110.706694-1-m.carrara@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1782405684729 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.320 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_ASCII_DIVIDERS 0.8 Email that uses ascii formatting dividers and possible spam tricks KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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: CXQQP6NZYKKNJEOJPQ2TUFRVGZKGD66I X-Message-ID-Hash: CXQQP6NZYKKNJEOJPQ2TUFRVGZKGD66I X-MailFrom: m.carrara@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: Finish modernizing the LIO module through `use v5.36;` and giving every non-anonymous subroutine its respective signature. Signed-off-by: Max R. Carrara --- 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(?[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}\/(?[\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