all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage 2/3] zfs: list zvol: skip different pools during parsing already
Date: Tue, 10 Jan 2023 13:52:42 +0100	[thread overview]
Message-ID: <20230110125243.176153-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20230110125243.176153-1-f.ebner@proxmox.com>

The 'pool' property in the result of zfs_parse_zvol_list() was not
used for anything else.

No functional change is intended.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 PVE/Storage/ZFSPoolPlugin.pm | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index bce360f..b971c7a 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -58,7 +58,7 @@ sub options {
 # static zfs helper methods
 
 sub zfs_parse_zvol_list {
-    my ($text) = @_;
+    my ($text, $pool) = @_;
 
     my $list = ();
 
@@ -73,12 +73,12 @@ sub zfs_parse_zvol_list {
 	my @parts = split /\//, $dataset;
 	next if scalar(@parts) < 2; # we need pool/name
 	my $name = pop @parts;
-	my $pool = join('/', @parts);
+	my $parsed_pool = join('/', @parts);
+	next if $parsed_pool ne $pool;
 
 	next unless $name =~ m!^(vm|base|subvol|basevol)-(\d+)-(\S+)$!;
 	$zvol->{owner} = $2;
 
-	$zvol->{pool} = $pool;
 	$zvol->{name} = $name;
 	if ($type eq 'filesystem') {
 	    if ($refquota eq 'none') {
@@ -380,14 +380,11 @@ sub zfs_list_zvol {
 	'-Hrp',
 	$scfg->{pool},
     );
-    my $zvols = zfs_parse_zvol_list($text);
+    my $zvols = zfs_parse_zvol_list($text, $scfg->{pool});
     return {} if !$zvols;
 
     my $list = {};
     foreach my $zvol (@$zvols) {
-	# The "pool" in $scfg is not the same as ZFS pool, so it's necessary to filter here.
-	next if $scfg->{pool} ne $zvol->{pool};
-
 	my $name = $zvol->{name};
 	my $parent = $zvol->{origin};
 	if($zvol->{origin} && $zvol->{origin} =~ m/^$scfg->{pool}\/(\S+)$/){
-- 
2.30.2





  reply	other threads:[~2023-01-10 12:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 12:52 [pve-devel] [PATCH storage 1/3] zfs: list zvol: return empty hash rather than undef Fiona Ebner
2023-01-10 12:52 ` Fiona Ebner [this message]
2023-01-10 12:52 ` [pve-devel] [PATCH storage 3/3] zfs: list zvol: limit recursion depth to 1 Fiona Ebner
2023-01-10 13:46 ` [pve-devel] applied-series: [PATCH storage 1/3] zfs: list zvol: return empty hash rather than undef Wolfgang Bumiller

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=20230110125243.176153-2-f.ebner@proxmox.com \
    --to=f.ebner@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 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