freenas-proxmox/perl5/PVE/Storage
Kevin Scott Adams c166501873
feat: auto-detect and correct ZFS blocksize for TrueNAS SCALE/CORE (#241)
* feat: auto-detect and correct ZFS blocksize for TrueNAS SCALE/CORE (#241)

SCALE requires >= 16k volblocksize; CORE works with 8k. Without correction,
creating a disk on SCALE with blocksize=8k triggers a ZFS warning and wastes
space on SCALE's minimum-4k-block pool layout.

Three changes:
- freenas_get_recommended_blocksize: fixes freenas_api_connect → freenas_api_check
  so product_name is actually populated before the SCALE check (was always returning
  8192 before this fix)
- freenas_parse_blocksize: new helper to compare "8k"/"16k"/integer blocksize strings
- alloc_image (both 8.x and 8.4.x patches): always detect recommended blocksize for
  freenas provider; if configured < recommended, override for this call AND persist
  the correction back to storage.cfg via lock_storage_config
- on_add_hook (8.4.x patch only): detect at storage creation time and correct $scfg
  before write_config saves it — no extra write needed

Tested on pve01-hq (PVE 8.4.19) against Tank02 (SCALE 24.10.2.1):
- Disk created with blocksize=8k → task log shows correction message, storage.cfg
  updated to 16384, no volblocksize warning from TrueNAS
- Disk created with blocksize=16384 → no-op, clean TASK OK

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci: add validate-patches step for ZFSPlugin PVE 8.4.x patch

ZFSPlugin-8.4.14_1.pm.patch has been in the build since v2.3.0 but was
never dry-run validated in CI. Now that we have the 8.4 orig committed
(ZFSPlugin-8.4.14_1.pm.orig from libpve-storage-perl 8.3.8), wire it up.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: replace explicit return undef with bare return (perlcritic)

Subroutines::ProhibitExplicitReturnUndef violation in
freenas_get_recommended_blocksize. Bare return in list context returns
an empty list rather than a list containing undef, which is the
correct Perl idiom.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 11:49:05 -04:00
..
LunCmd feat: auto-detect and correct ZFS blocksize for TrueNAS SCALE/CORE (#241) 2026-05-22 11:49:05 -04:00
.gitignore Update the FreeNAS-API related files to the latest Proxmox VE 2019-05-11 11:13:54 -04:00
ZFSPlugin-5.0-30.pm.patch Fix 'Parameter verification failed' when editing 2018-10-28 21:37:06 -04:00
ZFSPlugin-5.0-33_1.pm.hotfix.patch Fix ZFS error: Unrecognized command "list_extent" 2018-12-15 09:50:44 -05:00
ZFSPlugin-5.0-33_1.pm.patch Fix ZFS error: Unrecognized command "list_extent" 2018-12-15 09:50:44 -05:00
ZFSPlugin-5.0-34_1.pm.patch Update Proxmox VE patches to 5.3-6 2018-12-24 07:36:33 -05:00
ZFSPlugin-5.0-38_1.pm.patch Update to latest Proxmox VE update 2019-02-26 21:28:15 -05:00
ZFSPlugin-5.0-42_1.pm.patch Update the FreeNAS-API related files to the latest Proxmox VE 2019-05-11 11:13:54 -04:00
ZFSPlugin-5.0-44_1.pm.patch Patches created for latest 5.4 branch of Proxmox VE 2019-08-05 18:02:01 -04:00
ZFSPlugin-6.0-6_1.pm.patch Updated patches for the latest Proxmox VE updates and added donation 2019-08-07 22:57:22 -04:00
ZFSPlugin-6.0-8_1.pm.patch Update patch sets 2019-10-13 13:03:43 -04:00
ZFSPlugin-6.0-9_1.pm.patch Update patch sets 2019-10-13 13:03:43 -04:00
ZFSPlugin-7.1-1_1.pm.patch Update patches and some fixes. 2022-04-03 09:18:31 -04:00
ZFSPlugin-8.1.3_1.pm.patch Update for Proxmox 8 and Bearer Token 2024-01-06 13:43:35 -05:00
ZFSPlugin.pm.patch Update for Proxmox 8 and Bearer Token 2024-01-06 13:43:35 -05:00