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 [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 5B4FE1FF16B
	for <inbox@lore.proxmox.com>; Thu,  6 Feb 2025 16:17:32 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 3228B2AFDA;
	Thu,  6 Feb 2025 16:17:29 +0100 (CET)
To: pve-devel@lists.proxmox.com
Date: Thu,  6 Feb 2025 10:02:36 -0500
In-Reply-To: <20250206150237.2046776-1-dpetrov67@gmail.com>
References: <20250206150237.2046776-1-dpetrov67@gmail.com>
X-Mailman-Approved-At: Thu, 06 Feb 2025 16:17:27 +0100
MIME-Version: 1.0
Message-ID: <mailman.94.1738855048.293.pve-devel@lists.proxmox.com>
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Post: <mailto:pve-devel@lists.proxmox.com>
From: Dmitry Petrov via pve-devel <pve-devel@lists.proxmox.com>
Precedence: list
Cc: Dmitry Petrov <dpetrov67@gmail.com>
X-Mailman-Version: 2.1.29
X-BeenThere: pve-devel@lists.proxmox.com
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
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/>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
Subject: [pve-devel] [PATCH pve-storage 1/2] rbd plugin: do not use cache in
 list_images()
Content-Type: multipart/mixed; boundary="===============7400867378622517238=="
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

--===============7400867378622517238==
Content-Type: message/rfc822
Content-Disposition: inline

Return-Path: <dpetrov67@gmail.com>
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 DFB5BCB002
	for <pve-devel@lists.proxmox.com>; Thu,  6 Feb 2025 16:02:50 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id C8DBB2A724
	for <pve-devel@lists.proxmox.com>; Thu,  6 Feb 2025 16:02:50 +0100 (CET)
Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(No client certificate requested)
	by firstgate.proxmox.com (Proxmox) with ESMTPS
	for <pve-devel@lists.proxmox.com>; Thu,  6 Feb 2025 16:02:50 +0100 (CET)
Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-3d07df73412so1830315ab.1
        for <pve-devel@lists.proxmox.com>; Thu, 06 Feb 2025 07:02:50 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1738854162; x=1739458962; darn=lists.proxmox.com;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to;
        bh=UUrhuLCZOHuj0+rV5mDao5o2QtmGmH+7zjDSIQ1W1Vw=;
        b=f+qTbariGo+8gOUp3fsrZnlHy9mZvqgvgZKTcwH801KOdu0Om3aJWdbfOWZvURaWto
         bVT7dkGHPXcK5GFkA6dMOOBPLXcxMG0WYG/S36Zy0W78r+0frE6wpu/qPVA5jEC9vmGH
         AJVcRYiwmJioaX5cTODf8Of5ceiMF9vnwlIE+QqFsa8Siz2wO9ll0FAnvfhdNFniCtHj
         ll2rtt9g2jtIY0eyJxQK1n3zSpFyFajnMRcLzw1KXrYZzO4dJbGbO2TbRPXgTgovXjQ3
         VeI+kNrlAfd9yIfH/YIx3S7CCZFg7THTHb21mimYGXUnjH4vbsUQX0eFnsGZNzMWxCyq
         KLew==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1738854162; x=1739458962;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to;
        bh=UUrhuLCZOHuj0+rV5mDao5o2QtmGmH+7zjDSIQ1W1Vw=;
        b=uBBgibcZLhKegbE+r2aDdQdOIeeIE6A7UEGjMI73x2gd7B+kgXVPOD24kmvhLg1dRn
         FgffN1Mq0504h4aCLttN7quFbmZjPzHwHtOLqYlHiBwWdI3J9m2MDK978GogBHcX5JIv
         eL8zmMN9n8YwaHT3B4jgHdXtgzra43g5t5zLEOtuv8GykCM0mDKNpeT12c3gLb5aKWpz
         HmgFgQYVkngwMXqNBmdVMwexWmlJozjJAnxUC/fwnbkdVPrZPQPj1ugr2/phBetPEFGY
         zbrO4KN93hQbGTYkI6zISe0hXeLwOdOL8rQFXml4mDqACsZttPVgcnoK9WduzrgvGLcM
         Wpvg==
X-Gm-Message-State: AOJu0YwT4cH4s2mY8UBk/fvzyP39goypFMe0YsK4HcewBWqyZttIJIxF
	HcZkv44sYnpt1PJjgweSWIBVkZeYbgmphRmahkawIuokDL3DPj30oN3H8w==
X-Gm-Gg: ASbGncsbtcvasjj7HtNq6B6GdFa9M/rJQW7f5/WvhZtv2l0UkZxYkicUBmkNC+QgN9D
	SGQUEcHeU+sGwfg3+Oo+OgkKs3lTG6yuwohHLoibjBlO68iWqjd5ygGL92/rFEhHqlZThQJsVkv
	PR3fLs2BRXzMx0V6bX1/HiuLV/5q1hiQuVBdFS0ZUINo+Tz6cx+wjQzjrRkkgK7wnhBKJDIQwPp
	H/9cALsqHr05WRk4AuWk3hxNXvf66udqZV6iUFP1jG9B4WsKzsN+w2CuyhZzL+OQMKGV7z4cZOb
	y2V9XIphT8ITLPjZQNmqWeMqccpVWu4Mag==
X-Google-Smtp-Source: AGHT+IF4sECmyZbv8y5DeE8HQQZK887kHDPuLh0u4fAfEKQjjA4EY81YiayBtS6j7/1bUph/mQFxfg==
X-Received: by 2002:a05:6e02:1522:b0:3cf:fe21:af8 with SMTP id e9e14a558f8ab-3d04f3fdba9mr63437865ab.4.1738854162158;
        Thu, 06 Feb 2025 07:02:42 -0800 (PST)
Received: from pve1.nch.local (nat.nchcapital.com. [38.108.226.80])
        by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d05e8c8995sm2897605ab.43.2025.02.06.07.02.41
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 06 Feb 2025 07:02:41 -0800 (PST)
From: Dmitry Petrov <dpetrov67@gmail.com>
To: pve-devel@lists.proxmox.com
Cc: Dmitry Petrov <dpetrov67@gmail.com>
Subject: [PATCH pve-storage 1/2] rbd plugin: do not use cache in list_images()
Date: Thu,  6 Feb 2025 10:02:36 -0500
Message-Id: <20250206150237.2046776-2-dpetrov67@gmail.com>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250206150237.2046776-1-dpetrov67@gmail.com>
References: <20250206150237.2046776-1-dpetrov67@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
	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
	FREEMAIL_ENVFROM_END_DIGIT   0.25 Envelope-from freemail username ends in digit
	FREEMAIL_FROM           0.001 Sender email is commonly abused enduser mail provider
	RCVD_IN_DNSWL_NONE     -0.0001 Sender listed at https://www.dnswl.org/, no trust
	SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
	SPF_PASS               -0.001 SPF: sender matches SPF record
X-Mailman-Approved-At: Thu, 06 Feb 2025 16:17:27 +0100

A static cache key 'rbd' was used to cache pool/storeid-specific
information. This was causing issues in case of multiple RBD pools.

Drop $cache usage instead of fixing the issue as there is no caller
using it and the same pool/storeid multiple times.

Remove $pool from rbd_ls() and get_rbd_path($scfg) from list_images().

Signed-off-by: Dmitry Petrov <dpetrov67@gmail.com>
---
 src/PVE/Storage/RBDPlugin.pm | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm
index ef4faa6..42eefc6 100644
--- a/src/PVE/Storage/RBDPlugin.pm
+++ b/src/PVE/Storage/RBDPlugin.pm
@@ -209,9 +209,6 @@ sub run_rbd_command {
 sub rbd_ls {
     my ($scfg, $storeid) = @_;
 
-    my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
-    $pool .= "/$scfg->{namespace}" if defined($scfg->{namespace});
-
     my $raw = '';
     my $parser = sub { $raw .= shift };
 
@@ -237,7 +234,7 @@ sub rbd_ls {
 	my ($owner) = $image =~ m/^(?:vm|base)-(\d+)-/;
 	next if !defined($owner);
 
-	$list->{$pool}->{$image} = {
+	$list->{$image} = {
 	    name => $image,
 	    size => $el->{size},
 	    parent => $get_parent_image_name->($el->{parent}),
@@ -672,9 +669,7 @@ sub free_image {
 sub list_images {
     my ($class, $storeid, $scfg, $vmid, $vollist, $cache) = @_;
 
-    $cache->{rbd} = rbd_ls($scfg, $storeid) if !$cache->{rbd};
-
-    my $dat = $cache->{rbd}->{get_rbd_path($scfg)};
+    my $dat = rbd_ls($scfg, $storeid);
     return [] if !$dat; # nothing found
 
     my $res = [];
-- 
2.39.5



--===============7400867378622517238==
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

--===============7400867378622517238==--