From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id BD3E51FF0AF for ; Fri, 06 Nov 2026 16:48:34 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B7C8B21821; Fri, 06 Nov 2026 16:47:02 +0100 (CET) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Subject: [PATCH pve-storage-plugin-examples v4 17/17] sshfs: Update SSHFS plugin Date: Fri, 6 Nov 2026 16:45:53 +0100 Message-ID: <20261106154554.2182986-18-m.carrara@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261106154554.2182986-1-m.carrara@proxmox.com> References: <20261106154554.2182986-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: 1793979990596 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.319 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_MED -2.3 Sender listed at https://www.dnswl.org/, medium 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: 4QBVSPORC75UIGFFGVZYJZU42TA2QTPH X-Message-ID-Hash: 4QBVSPORC75UIGFFGVZYJZU42TA2QTPH 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 CC: Alfonso Kuen , Thomas Ellmenreich , Jakob Klocker 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 16. 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 | 26 ++++++++++++++----- 1 file changed, 20 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..0a1ee33 100644 --- a/plugin-sshfs/src/PVE/Storage/Custom/SSHFSPlugin.pm +++ b/plugin-sshfs/src/PVE/Storage/Custom/SSHFSPlugin.pm @@ -20,11 +20,11 @@ use PVE::Tools qw( use base qw(PVE::Storage::Plugin); # Plugin Definition sub api { - return 11; + return 16; } sub type { return 'sshfs'; } @@ -37,10 +37,11 @@ sub plugindata { rootdir => 1, vztmpl => 1, iso => 1, backup => 1, snippets => 1, + import => 1, }, { images => 1, rootdir => 1, }, @@ -51,26 +52,39 @@ sub plugindata { qcow2 => 1, vmdk => 1, }, 'qcow2', ], + 'advanced-properties' => { + preallocation => 1, + }, + 'hidden-properties' => { + bwlimit => 1, + 'content-dirs' => 1, + 'create-base-path' => 1, + 'create-subdirs' => 1, + format => 1, + }, 'sensitive-properties' => { 'sshfs-private-key' => 1, }, }; } sub properties { return { 'remote-path' => { 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', }, }; } sub options { @@ -246,14 +260,14 @@ sub on_add_hook($class, $storeid, $scfg, %sensitive) { die "error while adding SSHFS storage '${storeid}': $@\n" if $@; 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 { warn "removing private key for SSHFS storage '${storeid}'"; warn "the storage might not be mountable without a private key!"; @@ -303,11 +317,11 @@ 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)) { if ($scfg->{'create-base-path'} // 1) { make_path($mountpoint); -- 2.47.3