From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id D7AA01FF0E1 for ; Mon, 27 Jul 2026 16:36:15 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 20D172153E; Mon, 27 Jul 2026 16:35:43 +0200 (CEST) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Subject: [PATCH pve-storage-plugin-examples v3 17/17] sshfs: Update SSHFS plugin Date: Mon, 27 Jul 2026 16:34:41 +0200 Message-ID: <20260727143445.513900-18-m.carrara@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260727143445.513900-1-m.carrara@proxmox.com> References: <20260727143445.513900-1-m.carrara@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1785162886258 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: OLQ7T62EKIYEYEUZHY6KESZ5W5CEZNYG X-Message-ID-Hash: OLQ7T62EKIYEYEUZHY6KESZ5W5CEZNYG X-MailFrom: m.carrara@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Change the API version from 11 to 15. Support the `import` volume type, since it's already in ::Plugin for directory-based storage plugins. Add `title` keys for the custom 'remote-path' and 'sshfs-private-key' properties. Add the "multiline" `format` to 'sshfs-private-key' as well. Mark common advanced and hidden properties in the 'advanced-properties' and 'hidden-properties' hashes in `plugindata()` respectively. Use `on_update_hook_full()` instead of `on_update_hook()`. Adapt the signature of `activate_storage()`, adding `$hints` as new parameter. Mark the `$cache` and `$hints` parameters as optional, by assigning `undef` to them by default. Signed-off-by: Max R. Carrara --- .../src/PVE/Storage/Custom/SSHFSPlugin.pm | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/plugin-sshfs/src/PVE/Storage/Custom/SSHFSPlugin.pm b/plugin-sshfs/src/PVE/Storage/Custom/SSHFSPlugin.pm index 2d1612b..24884f6 100644 --- a/plugin-sshfs/src/PVE/Storage/Custom/SSHFSPlugin.pm +++ b/plugin-sshfs/src/PVE/Storage/Custom/SSHFSPlugin.pm @@ -22,7 +22,7 @@ use base qw(PVE::Storage::Plugin); # Plugin Definition sub api { - return 11; + return 15; } sub type { @@ -39,6 +39,7 @@ sub plugindata { iso => 1, backup => 1, snippets => 1, + import => 1, }, { images => 1, @@ -53,6 +54,17 @@ sub plugindata { }, 'qcow2', ], + 'advanced-properties' => { + 'content-dirs' => 1, + preallocation => 1, + }, + 'hidden-properties' => { + bwlimit => 1, + 'content-dirs' => 1, + 'create-base-path' => 1, + 'create-subdirs' => 1, + format => 1, + }, 'sensitive-properties' => { 'sshfs-private-key' => 1, }, @@ -65,10 +77,13 @@ sub properties { description => "Path on the remote filesystem used for SSHFS. Must be absolute.", type => 'string', format => 'pve-storage-path', + title => 'Remote Path', }, 'sshfs-private-key' => { description => "The private key to use for SSHFS.", type => 'string', + format => 'multiline', + title => 'Private Key', }, }; } @@ -248,10 +263,10 @@ sub on_add_hook($class, $storeid, $scfg, %sensitive) { return undef; } -sub on_update_hook($class, $storeid, $scfg, %sensitive) { - if (exists($sensitive{'sshfs-private-key'})) { - if (defined($sensitive{'sshfs-private-key'})) { - eval { sshfs_set_private_key($storeid, $sensitive{'sshfs-private-key'}) }; +sub on_update_hook_full($class, $storeid, $scfg, $update, $delete, $sensitive) { + if (exists($sensitive->{'sshfs-private-key'})) { + if (defined($sensitive->{'sshfs-private-key'})) { + eval { sshfs_set_private_key($storeid, $sensitive->{'sshfs-private-key'}) }; die $@ if $@; } else { @@ -305,7 +320,7 @@ sub check_connection($class, $storeid, $scfg) { return 1; } -sub activate_storage($class, $storeid, $scfg, $cache) { +sub activate_storage($class, $storeid, $scfg, $cache = undef, $hints = undef) { my $mountpoint = $scfg->{path}; if (!sshfs_is_mounted($scfg)) { -- 2.47.3