From 835648fd69251a91f42792d4af1b1dc2c043c906 Mon Sep 17 00:00:00 2001 From: Kevin Adams Date: Sat, 23 May 2026 22:17:18 -0400 Subject: [PATCH] fix: use /pool/dataset for space stats; default shared=1 for iSCSI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TrueNAS CORE 13.0 /pool API does not expose top-level size/free/allocated fields (they are nested in topology.data[].stats). Switch status() to query /pool/dataset?id= which has available.parsed + used.parsed on both CORE and SCALE. Add shared=1 as the default in the UI panel — iSCSI is a network block device accessible from all cluster nodes, so it should be shared storage by default. Verified on pve01-hq against Tank01 (CORE 13.0-U6.7): TrueNAS01-Tank01 active 1804599296 165936464 1638662832 9.20% Co-Authored-By: Claude Sonnet 4.6 --- perl5/PVE/Storage/Custom/TrueNAS.pm | 18 ++++++++++-------- ui/truenas-storage.js | 7 +++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/perl5/PVE/Storage/Custom/TrueNAS.pm b/perl5/PVE/Storage/Custom/TrueNAS.pm index ae15871..3c95f04 100644 --- a/perl5/PVE/Storage/Custom/TrueNAS.pm +++ b/perl5/PVE/Storage/Custom/TrueNAS.pm @@ -350,16 +350,18 @@ sub _iscsi_ensure_session { sub status { my ($class, $storeid, $scfg, $cache) = @_; - # truenas_pool may be a full dataset path (e.g. tank/proxmox/vdisks). - # The /pool API matches on the top-level pool name only. + # Query the root dataset for space stats — works on both CORE and SCALE. + # TrueNAS CORE 13.0 /pool does not expose top-level size/free/allocated; + # those fields are nested inside topology. /pool/dataset has available.parsed + # and used.parsed at the root dataset level on all versions. my $pool_name = (split m{/}, $scfg->{truenas_pool})[0]; - my $pools = _api($scfg, 'GET', '/pool') // []; - my ($pool) = grep { $_->{name} eq $pool_name } @$pools; - die "Pool '$pool_name' not found on $scfg->{truenas_host}\n" unless $pool; + my $datasets = _api($scfg, 'GET', "/pool/dataset?id=$pool_name") // []; + my ($ds) = grep { $_->{name} eq $pool_name } @$datasets; + die "Pool dataset '$pool_name' not found on $scfg->{truenas_host}\n" unless $ds; - my $total = $pool->{size} // 0; - my $free = $pool->{free} // 0; - my $used = $pool->{allocated} // ($total - $free); + my $free = $ds->{available}{parsed} // 0; + my $used = $ds->{used}{parsed} // 0; + my $total = $free + $used; return ($total, $free, $used, 1); } diff --git a/ui/truenas-storage.js b/ui/truenas-storage.js index adea92b..eb7c833 100644 --- a/ui/truenas-storage.js +++ b/ui/truenas-storage.js @@ -102,6 +102,13 @@ Ext.define('PVE.storage.TrueNASInputPanel', { // Column 2 — connection options (right side) // Note: Nodes selector and Enable checkbox are prepended by StorageBase me.column2 = [ + { + xtype: 'proxmoxcheckbox', + fieldLabel: gettext('Shared'), + name: 'shared', + checked: true, + uncheckedValue: 0, + }, { xtype: 'proxmoxcheckbox', fieldLabel: gettext('Use SSL'),