fix: use /pool/dataset for space stats; default shared=1 for iSCSI
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=<pool> 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 <noreply@anthropic.com>
This commit is contained in:
parent
9c85fdb6e9
commit
835648fd69
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue