public inbox for pve-devel@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/2] zfs: list zvol: list single pool only for remote ZFS
Date: Mon,  7 Nov 2022 12:00:35 +0100	[thread overview]
Message-ID: <20221107110035.93972-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20221107110035.93972-1-f.ebner@proxmox.com>

The remote ZFS plugin doesn't use a cache (would need a separate cache
for each target host), so this can speed up the operation.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 PVE/Storage/ZFSPlugin.pm     | 2 +-
 PVE/Storage/ZFSPoolPlugin.pm | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm
index 1379bcf..cd5a3b6 100644
--- a/PVE/Storage/ZFSPlugin.pm
+++ b/PVE/Storage/ZFSPlugin.pm
@@ -422,7 +422,7 @@ sub deactivate_volume {
 sub list_images {
     my ($class, $storeid, $scfg, $vmid, $vollist, $cache) = @_;
 
-    my $zfs_list = $class->zfs_list_zvol($scfg);
+    my $zfs_list = $class->zfs_list_zvol($scfg, 1);
     return $class->zfs_list_images($storeid, $scfg, $vmid, $vollist, $zfs_list);
 }
 
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 0fa18ce..2f75fba 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -379,9 +379,11 @@ sub zfs_delete_zvol {
 }
 
 sub zfs_list_zvol {
-    my ($class, $scfg) = @_;
+    my ($class, $scfg, $single_pool) = @_;
 
-    my $text = $class->zfs_request($scfg, 10, 'list', '-o', 'name,volsize,origin,type,refquota', '-t', 'volume,filesystem', '-Hrp');
+    my @param = ('-o', 'name,volsize,origin,type,refquota', '-t', 'volume,filesystem', '-Hrp');
+    push @param, $scfg->{pool} if $single_pool;
+    my $text = $class->zfs_request($scfg, 10, 'list', @param);
     my $zvols = zfs_parse_zvol_list($text);
     return undef if !$zvols;
 
-- 
2.30.2





  reply	other threads:[~2022-11-07 11:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 11:00 [pve-devel] [PATCH storage 1/2] zfs: only use cache when listing images locally Fiona Ebner
2022-11-07 11:00 ` Fiona Ebner [this message]
2022-11-16 11:18 ` Fabian Grünbichler
2022-11-16 13:30   ` Fiona Ebner
2022-11-28 12:19     ` Fiona Ebner
2022-11-29  9:50       ` Fabian Grünbichler

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=20221107110035.93972-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal