all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dmitry Petrov via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Dmitry Petrov <dpetrov67@gmail.com>
Subject: [pve-devel] [PATCH pve-storage 1/2] rbd plugin: do not use cache in list_images()
Date: Thu,  6 Feb 2025 10:02:36 -0500	[thread overview]
Message-ID: <mailman.94.1738855048.293.pve-devel@lists.proxmox.com> (raw)
In-Reply-To: <20250206150237.2046776-1-dpetrov67@gmail.com>

[-- Attachment #1: Type: message/rfc822, Size: 6848 bytes --]

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>

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



[-- 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

       reply	other threads:[~2025-02-06 15:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250206150237.2046776-1-dpetrov67@gmail.com>
2025-02-06 15:02 ` Dmitry Petrov via pve-devel [this message]
2025-02-06 15:02 ` [pve-devel] [PATCH pve-storage 2/2] iscsidirect " Dmitry Petrov 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.94.1738855048.293.pve-devel@lists.proxmox.com \
    --to=pve-devel@lists.proxmox.com \
    --cc=dpetrov67@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal