From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 5D03C1FF161
	for <inbox@lore.proxmox.com>; Wed, 18 Dec 2024 14:39:47 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id D4A5B16D2D;
	Wed, 18 Dec 2024 14:39:45 +0100 (CET)
Message-ID: <4124810b-bf9a-4bd5-892c-e6bfaa37bf29@proxmox.com>
Date: Wed, 18 Dec 2024 14:39:12 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
References: <20241217154814.82121-1-f.ebner@proxmox.com>
 <20241217154814.82121-2-f.ebner@proxmox.com>
Content-Language: en-US
In-Reply-To: <20241217154814.82121-2-f.ebner@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.052 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_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [iscsidirectplugin.pm, storage.pm, plugin.pm]
Subject: Re: [pve-devel] [PATCH v2 storage 01/10] iscsi direct plugin: fix
 return value for path() method in non-array context
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Am 17.12.24 um 16:48 schrieb Fiona Ebner:
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> 
> New in v2.
> 
>  src/PVE/Storage/ISCSIDirectPlugin.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PVE/Storage/ISCSIDirectPlugin.pm b/src/PVE/Storage/ISCSIDirectPlugin.pm
> index eb329d4..6f02eee 100644
> --- a/src/PVE/Storage/ISCSIDirectPlugin.pm
> +++ b/src/PVE/Storage/ISCSIDirectPlugin.pm
> @@ -100,7 +100,7 @@ sub path {
>  
>      my $path = "iscsi://$portal/$target/$lun";
>  
> -    return ($path, $vmid, $vtype);
> +    return wantarray ? ($path, $vmid, $vtype) : $path;
>  }
>  
>  sub create_base {

Actually, not sure if this is considered required by the plugin API (and
thus whether to call it a "fix"). The call in Storage.pm is

>     my ($path, $owner, $vtype) = $plugin->path($scfg, $volname, $storeid, $snapname);
>     return wantarray ? ($path, $owner, $vtype) : $path;

However, there are calls

> my $file = $class->path($scfg, $volname, $storeid)

in the (import/export calls) of the base implementation in Plugin.pm
which can get inherited by other plugins. Either we require the
wantarray detection in the API (technically also requires a APIAGE/VER
bump) or we change these calls not to expect the detection.

IMHO, it seems nicer to have the detection, as it's very easy to end up
with a broken call in scalar context.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel