Commit Graph

282 Commits

Author SHA1 Message Date
Kevin Adams b41fefb72b docs: add PVE version compatibility warnings across all user touchpoints
Users on unsupported PVE versions now get clear guidance at every
layer — README, install time, and GitHub release notes — rather than
silently failing or getting confusing patch errors.

- README: replace bare compatibility table with a full matrix and
  prominent callout blocks for PVE 7 (last v2.x), PVE 8 (EOL
  2026-08-31), PVE 9+ (use v3.0), and PVE ≤6 (unsupported)
- postinst: add check_pve_version() that exits on PVE < 7, warns
  loudly on PVE 7 (stay on v2.x, do not upgrade to v3.0), notes
  the PVE 8 EOL date, and warns on PVE 9+ (v2.x not supported)
- build.yml release template: add a version compatibility table so
  every GitHub release prominently states who should and should not
  install it

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 18:33:13 -04:00
Kevin Adams ea1d0e2248 fix: version-aware pvemanagerlib patch selection for PVE 8.4.x (#223)
PVE 8.4 reformatted pvemanagerlib.js (tabs→spaces, structural changes),
making the existing 8.0.5-era patch fail on all 8.4.x nodes.

- Add pvemanagerlib-8.4.14_1.js.patch covering PVE 8.4.x (all hunks
  verified on 8.4.14 and 8.4.19)
- Update postinst to detect pve-manager major.minor (e.g. "8.4") and
  try a minor-version-specific patch before falling back to the major
  patch — 8.3.x nodes keep using 8.patch, 8.4.x nodes use 8.4.patch
- Update build.yml to bundle 8.4.patch alongside the existing 8.patch

Tested live on pve01-hq (8.4.19) and pve03-hq (8.3.2) — correct patch
selected in each case, pvemanagerlib patched successfully on 8.4.19.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 18:10:11 -04:00
Kevin Adams 332b6a8257 docs: add PVE 8.4/9.0/9.1 research brief and ADR-008 version support matrix
Reviewed PVE 8.4, 9.0, and 9.1 release notes for storage subsystem changes
relevant to the plugin and Phase 3 design.

Key findings:
- iSCSI hostname portal support (PVE 8.4+) — gap in current plugin (#233)
- Snapshot-as-Volume-Chains (PVE 9.0 tech preview) — Phase 3 opportunity (#234)
- GlusterFS dropped in PVE 9 — confirms need for proper custom plugin
- pvemanagerlib.js still broken on PVE 8.4.x (#223, blocked)

ADR-008 records the PVE version support matrix:
- v2.x: PVE 7 (best-effort), PVE 8 (supported), PVE 9 (not supported)
- v3.0: PVE 8+ (core), PVE 9.0+ (snapshots)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 13:05:08 -04:00
Kevin Adams 4833cfbcca docs: finalize ADR statuses to Accepted; add ADR README and KSA scaffold
All seven ADRs were in draft/proposed/decided states — promote all to
Accepted now that the decisions are implemented and stable.

Add .claude/cos/adrs/README.md documenting the ADR lifecycle process.

Add KSA Workspace Standards section to CLAUDE.md (sourced from scaffold
at claude-scaffold/CLAUDE.md) so future sessions inherit workspace-wide
rules without needing a separate file load.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 11:07:49 -04:00
Kevin Scott Adams 9876e85d74
Merge pull request #232 from TheGrandWazoo/ci/upgrade-actions-node24
ci: upgrade GitHub Actions to Node 24 runtimes (closes #231)
2026-05-19 11:03:27 -04:00
Kevin Adams 89acaf4145 ci: upgrade GitHub Actions to Node 24 runtimes (closes #231)
GitHub is removing Node.js 20 from Actions runners on Sep 16, 2026
and forcing Node 24 as default from Jun 2, 2026. Upgrade all
first-party actions to latest major versions that ship with node24:

  actions/checkout@v4        → v6
  actions/upload-artifact@v4 → v7
  actions/download-artifact@v4 → v8

Note: setup-python@v5 warning is inside cloudsmith-io/action@master
and is not directly addressable here.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 10:06:20 -04:00
Kevin Scott Adams 4edd50b300
Fix dangling extent on failed LUN creation (issue #214)
Fix dangling extent on failed LUN creation (issue #214)
2026-05-18 17:14:12 -04:00
Kevin Scott Adams b44c989638
Fix global state bugs: per-host product_name, dev_prefix, api_version, runaway counter
Fix global state bugs: per-host product_name, dev_prefix, api_version, runaway counter
2026-05-18 17:13:58 -04:00
Kevin Scott Adams 8a5fb01080
Fix regex operator precedence bug in API method guard
Fix regex operator precedence bug in API method guard
2026-05-18 17:13:48 -04:00
Kevin Adams f18003651f Fix perlcritic: move \$VERSION after use strict/warnings
RequireUseStrict and RequireUseWarnings require that strict and warnings
are the first statements after the package declaration. Move our \$VERSION
to after the two use pragmas.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 00:16:34 -04:00
Kevin Adams 7fa3ff9c91 Add \$VERSION to FreeNAS.pm; use it as authoritative version in CI
our \$VERSION = '2.3.0' is now the single source of truth for the release
series. The build.yml extracts it with a perl one-liner (no module load,
no stubs needed) and uses it as BASE_VERSION for alpha/beta channel builds.

Git tags remain the release trigger: pushing an exact vX.Y.Z tag publishes
to the stable Cloudsmith channel. A mismatch warning fires if the tag
version and \$VERSION disagree, catching forgotten version bumps.

The v2.3.0-pre anchor tag approach is superseded by this; the anchor tag
can stay in history as a breadcrumb but \$VERSION is now what drives builds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 00:13:28 -04:00
Kevin Adams ccdc7a43f6 Fix version numbering: anchor tags set series without triggering release
Two changes:
1. BASE_VERSION now strips pre-release suffixes from the nearest ancestor tag
   (e.g. v2.3.0-pre → 2.3.0), so anchor tags like v2.3.0-pre make feature
   branch builds say 2.3.0-alpha+<sha> without "pre" leaking into the version.

2. Stable release detection changed from glob (refs/tags/v*) to an exact
   semver regex (^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$). Tags with a suffix
   (v2.3.0-pre, v2.3.0-rc1) build and validate but do not publish to Cloudsmith
   stable — they fall through to the 'none' channel.

This lets us place a v2.3.0-pre anchor tag to version the development series
correctly, then later push v2.3.0 as the actual stable release.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:59:26 -04:00
Kevin Adams af737128d2 Fix dangling extent on failed LUN creation (issue #214)
Two problems in run_create_lu:
1. If freenas_iscsi_create_extent returned undef, the next line accessed
   $extent->{'id'} unconditionally, causing a crash rather than a clean error.
2. If freenas_iscsi_create_target_to_extent failed after a successful extent
   creation, the code just died with "Unable to create lun", leaving the
   newly created extent orphaned on TrueNAS with no target association.
   Subsequent delete_lu calls could not find or clean up this extent because
   it was never in the LUN list, requiring manual TrueNAS cleanup.

Fix: check extent creation result before dereferencing; on target-to-extent
failure, call freenas_iscsi_remove_extent to roll back the extent before
dying. The rollback is best-effort (failure is logged but not re-thrown)
so a secondary API error does not mask the primary failure message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:23:20 -04:00
Kevin Adams 7a9d0072a2 Fix global state bugs: per-host product_name, dev_prefix, api_version, runaway counter
All of these were module-level scalars that the last freenas_api_check call
would overwrite. With two TrueNAS hosts in a Proxmox config (e.g., one CORE
and one SCALE), the second host's API check would clobber the first host's
product_name, dev_prefix, and api_version, causing wrong API paths and wrong
pool-name slash-vs-dash conversion on subsequent calls to the first host.

Changes:
- $freenas_server_list->{$host} now stores a hashref {client, product_name,
  api_version, dev_prefix, runaway_count} instead of a bare REST::Client
- freenas_api_connect: recursion counter is now per-host (runaway_count);
  $apiping made local so v1->v2 detection for one host does not affect others
- freenas_api_check: fixed broken init-guard (was testing $freenas_rest_connection->{$host}
  which always evaluates undef on a REST::Client object); saves detected
  product_name/api_version/dev_prefix back into the per-host hash after detection
- freenas_api_call: restores all module-level pointers (product_name, dev_prefix,
  api_methods, api_variables) from per-host storage on every call, so the
  correct host context is active regardless of which host was accessed last

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:23:11 -04:00
Kevin Adams 4c38b5732e Fix regex operator precedence bug in freenas_api_call method guard
'! $method =~ /pattern/' is parsed as '(! $method) =~ /pattern/' due to
precedence, so the regex ran against "" and always returned false. The
guard never fired and any method string passed through to the API call.

Changed to '$method !~ /^(?:GET|DELETE|POST)$/' which correctly tests the
method string. Also replaced atomic group (?>...) with non-capturing (?:...)
since there is no backtracking concern here.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:57:08 -04:00
Kevin Adams 43a8efd125 Fix TrueNAS 25.04 compatibility: handle 404 on v1.0 API endpoint
TrueNAS 25.04 removed the v1.0 REST API entirely. Previously it redirected
(302) to v2.0; now it returns 404. The plugin treated 404 as a fatal
connection failure, preventing any operation on 25.04 hosts.

Fix: extend the v1.0→v2.0 upgrade condition in freenas_api_connect to also
trigger on HTTP 404, but only while probing the v1.0 endpoint (guarded by
`$apiping =~ /v1\.0/`). A 404 on the v2.0 endpoint still fails cleanly.

Also add a syslog warn when Bearer Token auth is attempted over plain HTTP:
TrueNAS 25.04+ revokes API keys sent without SSL, causing auth failures that
are otherwise invisible in the plugin log. The warning points admins to the
"Use SSL" storage config option.

Closes #205

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:51:32 -04:00
Kevin Adams 13217640ab Harden: replace stringy eval with explicit dispatch hash
freenas_iscsi_create_extent and freenas_iscsi_create_target_to_extent
both used `eval $value` to expand template variable names like '$name'
into their runtime values. Replace with a local %vars hash and an
`exists` lookup — same behavior, no stringy eval, no perlcritic warning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:21:56 -04:00
Kevin Adams ac58bf75de Fix DEBIAN control.j2: use binary-only format for dpkg-deb
dpkg-deb --build reads a binary control file and rejects the two-stanza
source+binary format. Rewrote control.j2 as a single binary-only stanza.
Removed the source stanza (Source, Standards-Version, Build-Depends fields)
which are only meaningful in source packages built with dpkg-buildpackage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 15:16:20 -04:00
Kevin Adams 0606ffb1a4 Fix shellcheck SC2034: remove unused REST_CLIENT_PATH variable in postrm
REST_CLIENT_PATH was defined but never referenced. REST/Client.pm is owned
by librest-client-perl and is intentionally not removed by our postrm
(documented in the comment above remove_plugin_files). Remove the dead variable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 15:10:45 -04:00
Kevin Adams 2430048a3d Fix perlcritic: replace 'return undef' with 'return'
ProhibitExplicitReturnUndef (severity 5): returning undef explicitly is
wrong because it forces scalar context on callers. 'return;' returns
undef in scalar context and an empty list in list context, which is the
correct idiom. Fixed all 7 occurrences in FreeNAS.pm.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 15:08:54 -04:00
Kevin Adams 84cc862bed Fix CI: install Perl deps and stub PVE::SafeSyslog for syntax check
perl -c requires all modules to be loadable at compile time. PVE::SafeSyslog
only exists on Proxmox VE hosts, so the syntax check always failed on
GitHub Actions runners. Fix:
- Install real Perl deps via apt (libwww-perl, libio-socket-ssl-perl,
  librest-client-perl, libjson-perl)
- Create a minimal stub for PVE::SafeSyslog so perl -c can load FreeNAS.pm
- Pass -I/tmp/pve-stub to perl -c so the stub is found

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 15:05:52 -04:00
Kevin Adams ce84a857c4 Fix YAML syntax: quote step names containing colons
Unquoted YAML plain scalars cannot contain ': ' (colon-space) because
the parser interprets it as a nested key-value mapping. The two step
names 'Dry-run patch: ZFSPlugin (PVE 8)' and 'Dry-run patch: apidoc.js
(PVE 8)' triggered this, causing GitHub Actions to reject the workflow
file before any jobs ran.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 15:02:08 -04:00
Kevin Adams ba238eb7d6 Fix CI workflow file issues causing no-jobs-run failure
Two bugs that prevented any jobs from running:

1. action.yml contained only YAML comments (no 'on:' or 'jobs:' keys),
   making it an invalid workflow file. GitHub rejected it at parse time.
   Fixed by giving it a minimal valid structure with workflow_dispatch
   trigger only, so it never fires automatically.

2. build.yml perlcritic step referenced perl5/PVE/Storage/Custom/FreeNAS.pm
   which is not committed to the repository, causing a step failure.
   Removed — only FreeNAS.pm (LunCmd) is linted for now.

3. build.yml publish job used 'if: |' block scalar for a multi-line
   expression, which GitHub Actions rejects in expression position.
   Changed to a single inline expression string.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 14:52:17 -04:00
Kevin Adams 636cd06ff6 Phase 1 project revival + PR fixes (#207, #209, #213)
Project infrastructure:
- Replace MIT license with AGPL-3.0 (KSA Technologies, LLC)
- Full README rewrite with badges, compatibility table, token auth docs
- Add CHANGELOG, CONTRIBUTING, DONORS, SECURITY docs
- Add GitHub issue/PR templates, update FUNDING.yml and stale.yml
- Replace external packer repo dispatch with self-contained CI (build.yml)
- Add packaging/DEBIAN/ with postinst/postrm/triggers (no git clone at install)
- Add .perlcriticrc for static analysis
- Add .claude/cos/ ADRs, plans, and runbooks

Bug fixes from community PRs:
- Fix bearer token check in freenas_api_connect: defined() && value instead of
  defined() alone, so truenas_token_auth=0 no longer activates Bearer Token auth (#207)
- Fix LUN 0 falsy bug in ZFSPlugin patch: !$guid -> !defined $guid in both
  zfs_get_lun_number and zfs_get_wwid_number, fixing VMs on LUN 0 for PVE 9 (#209)
- Fix syslog typo "wtih" -> "with" in run_list_extent (#213)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 14:22:04 -04:00
Kevin Scott Adams ebc461a519 Updated README.md
- Updated README.md to announce the Bearer Token Authentication feature.
2024-01-07 09:43:56 -05:00
Kevin Scott Adams 817433a393 Clean up code.
- Indent and whitespace cleanup.
2024-01-06 17:34:17 -05:00
Kevin Scott Adams 29b110f5e2
Merge pull request #173 from TheGrandWazoo/develop
Develop
2024-01-06 14:26:17 -05:00
Kevin Scott Adams c35329f77d
Merge pull request #172 from TheGrandWazoo/feature_bearer_token
Feature bearer token
2024-01-06 14:17:00 -05:00
Kevin Scott Adams b9dd1d6f89 Update for Proxmox 8 and Bearer Token
- Patch updates for Proxmox VE 8
- Update to select Basic or Bearer authentication.
2024-01-06 13:43:35 -05:00
Kevin Scott Adams 466d819a89
Merge pull request #160 from TheGrandWazoo/master
Merge to feature_bearer_token
2023-08-19 10:53:01 -04:00
Kevin Scott Adams ea3637d29a
Update README.md
- Update README.md to be more structured and selective from a visitors view.
- Update the Roadmap section.
- Update the Donators list.
- Update the New Install Instructions section to allow the visitor to select the GPG location they want to use.
- Update the Activity section.
- Fix spelling errors.
2023-08-19 10:46:39 -04:00
Kevin Scott Adams b6e34be5e5
Update README.md for typo
- Fixed testing repo name in install section.
2023-08-16 09:05:06 -04:00
Kevin Scott Adams ca48a9e517
Update README.md for new repos
- Updated anchor.
- Added documentation to roadmap.
2023-08-16 09:03:20 -04:00
Kevin Scott Adams 871c720026
Merge pull request #157 from TheGrandWazoo/TheGrandWazoo-readme-patch-2
Update README.md
2023-08-16 08:54:47 -04:00
Kevin Scott Adams 65c1c250df
Update README.md
- Change announcement for the Cloudsmith repos.
- Changed the New Install section to include instructions for stable and development repos.
2023-08-16 08:54:15 -04:00
Kevin Scott Adams 80c5eda63a
Merge pull request #155 from TheGrandWazoo/TheGrandWazoo-patch-1
Update README.md
2023-08-09 13:07:11 -04:00
Kevin Scott Adams 3977be6daa
Update README.md
Changed Attention description to notify that a new repo is on the horizon.
2023-08-09 13:02:43 -04:00
Kevin Scott Adams a86bf3eb95
Update README.md
Update README.md

- Added ATTENTION due to JFrog canceling my subscription.
2023-07-13 09:09:22 -04:00
Kevin Scott Adams 0997a68048 Import Proxmox stock PVE Manager Lib.
- Imported the stock Proxmox pvemanagerlib.js from Proxmox 7.4-3.
2023-06-12 17:19:16 -04:00
Kevin Scott Adams d507706996 Remove previous commmit.
- Forgot to change branches.
2023-06-12 17:17:56 -04:00
Kevin Scott Adams 9de5aaf81b Import stock pvemanagerlib.js.
- Imported stock pvemanagerlib.js from Proxmox 7.4-3 to develop and
create patches against.
2023-06-12 17:16:29 -04:00
Kevin Scott Adams dc5a5c2be9
Merge pull request #130 from TheGrandWazoo/revert-129-2.0
Revert "2.0"
2023-02-20 13:24:48 -05:00
Kevin Scott Adams c1f453e15c
Revert "2.0" 2023-02-20 13:24:07 -05:00
Kevin Scott Adams 6141b6c784
Merge pull request #129 from TheGrandWazoo/2.0
2.0
2023-02-20 13:07:21 -05:00
Kevin Scott Adams b05124592f Update README.md
- Updated Roadmap and Updates.
- Removed Attention
- Added a note about systemctl restart pvescheduler.service before
2.2.0-0-beta8.
2023-02-12 17:14:15 -05:00
Kevin Scott Adams 9021ec22b7 Fix recursion error.
- When SSL redirect is enabled on TrueNAS and a change from V1 to V2
api's needs to happen then we overrun the limit of 1 on the recursion
loop. Set it to 2.
- Added some logging for TrueNAS-Scale conversion from slash (/) to dash
(-).
2022-06-05 18:57:52 -04:00
Kevin Scott Adams d2f5c2b27f Update readme.MD.
- Updated new repo install.
- Updated Roadmap.
- Cleanup old information.
- Updated Donation list.
- Changed FreeNAS to TrueNAS in most of the instructions.
2022-06-04 09:58:34 -04:00
Kevin Scott Adams a2e395658d
Update README.md 2022-05-31 16:58:53 -04:00
Kevin Scott Adams 4039df8a59
Update README.md 2022-05-31 16:56:05 -04:00
Kevin Scott Adams aea45c992f
Update README.md 2022-05-25 21:46:55 -04:00