From 3b3cc8d1352bb8296b8ff6855fd1f11073bb70b3 Mon Sep 17 00:00:00 2001 From: Kevin Adams Date: Tue, 19 May 2026 23:16:17 -0400 Subject: [PATCH] fix: ZFSPlugin 8.4.x patch and missing patch dependency (#236 #237) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two install-time failures on PVE 8.4.x nodes: 1. 'patch' utility not in Depends — causes silent patch failure on fresh nodes; all three PVE file patches silently skip, plugin appears to install but storage operations fail. Added 'patch' to control.j2. 2. ZFSPlugin.pm routing not applied on PVE 8.4.x — tabs→spaces reformat and get_base($scfg) signature change in 8.4 broke hunks #3 and #4 (the freenas elsif routing branches). Nodes with a prior partial install are doubly affected: grep idempotency check passes on partial freenas strings, so the routing is never applied, causing: "freenas: unknown iscsi provider" on clone/migrate operations. New ZFSPlugin-8.4.14_1.pm.patch generated against stock PVE 8.4.19, bundled as patches/ZFSPlugin/8.4.patch alongside existing 8.patch. Verified clean on pve01-hq (8.4.19) and pve02-hq (8.4.14). Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/build.yml | 5 + packaging/DEBIAN/control.j2 | 2 +- .../PVE/Storage/ZFSPlugin-8.4.14_1.pm.patch | 106 ++++++++++++++++++ 3 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 stable-8/perl5/PVE/Storage/ZFSPlugin-8.4.14_1.pm.patch diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 239caaa..c615e05 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -187,6 +187,11 @@ jobs: # PVE 8 patches (8.0.x – 8.3.x) cp stable-8/perl5/PVE/Storage/ZFSPlugin.pm.patch \ "${STAGING}/usr/share/freenas-proxmox/patches/ZFSPlugin/8.patch" + + # PVE 8.4.x ZFSPlugin patch — indentation changed in 8.4, incompatible with 8.patch + cp stable-8/perl5/PVE/Storage/ZFSPlugin-8.4.14_1.pm.patch \ + "${STAGING}/usr/share/freenas-proxmox/patches/ZFSPlugin/8.4.patch" + echo "Bundled PVE 8.4.x ZFSPlugin patch" cp stable-8/pve-manager/js/pvemanagerlib.js.patch \ "${STAGING}/usr/share/freenas-proxmox/patches/pvemanagerlib/8.patch" cp stable-8/pve-docs/api-viewer/apidoc.js.patch \ diff --git a/packaging/DEBIAN/control.j2 b/packaging/DEBIAN/control.j2 index c2db59b..f63fba0 100644 --- a/packaging/DEBIAN/control.j2 +++ b/packaging/DEBIAN/control.j2 @@ -2,7 +2,7 @@ Package: freenas-proxmox Version: ${VERSION} Architecture: all Maintainer: KSA Technologies, LLC -Depends: librest-client-perl +Depends: librest-client-perl, patch Section: perl Priority: optional Homepage: https://github.com/TheGrandWazoo/freenas-proxmox diff --git a/stable-8/perl5/PVE/Storage/ZFSPlugin-8.4.14_1.pm.patch b/stable-8/perl5/PVE/Storage/ZFSPlugin-8.4.14_1.pm.patch new file mode 100644 index 0000000..d7dc610 --- /dev/null +++ b/stable-8/perl5/PVE/Storage/ZFSPlugin-8.4.14_1.pm.patch @@ -0,0 +1,106 @@ +--- /tmp/ZFSPlugin-8.4.19-stock.pm 2026-05-19 23:09:15.498561777 -0400 ++++ /tmp/ZFSPlugin-8.4.19-patched.pm 2026-05-19 23:13:40.830560931 -0400 +@@ -11,6 +11,7 @@ + + use base qw(PVE::Storage::ZFSPoolPlugin); + use PVE::Storage::LunCmd::Comstar; ++use PVE::Storage::LunCmd::FreeNAS; + use PVE::Storage::LunCmd::Istgt; + use PVE::Storage::LunCmd::Iet; + use PVE::Storage::LunCmd::LIO; +@@ -26,6 +27,7 @@ + modify_lu => 1, + add_view => 1, + list_view => 1, ++ list_extent => 1, + list_lu => 1, + }; + +@@ -44,6 +46,8 @@ + return PVE::Storage::LunCmd::Istgt::get_base($scfg); + } elsif ($scfg->{iscsiprovider} eq 'iet') { + return PVE::Storage::LunCmd::Iet::get_base($scfg); ++ } elsif ($scfg->{iscsiprovider} eq 'freenas') { ++ return PVE::Storage::LunCmd::FreeNAS::get_base($scfg); + } elsif ($scfg->{iscsiprovider} eq 'LIO') { + return PVE::Storage::LunCmd::LIO::get_base($scfg); + } else { +@@ -67,6 +71,8 @@ + $msg = PVE::Storage::LunCmd::Istgt::run_lun_command($scfg, $timeout, $method, @params); + } elsif ($scfg->{iscsiprovider} eq 'iet') { + $msg = PVE::Storage::LunCmd::Iet::run_lun_command($scfg, $timeout, $method, @params); ++ } elsif ($scfg->{iscsiprovider} eq 'freenas') { ++ $msg = PVE::Storage::LunCmd::FreeNAS::run_lun_command($scfg, $timeout, $method, @params); + } elsif ($scfg->{iscsiprovider} eq 'LIO') { + $msg = PVE::Storage::LunCmd::LIO::run_lun_command($scfg, $timeout, $method, @params); + } else { +@@ -158,7 +164,7 @@ + sub zfs_get_lun_number { + my ($class, $scfg, $guid) = @_; + +- die "could not find lun_number for guid $guid" if !$guid; ++ die "could not find lun_number for guid $guid" if !defined $guid; + + if ($class->zfs_request($scfg, undef, 'list_view', $guid) =~ /^(\d+)$/) { + return $1; +@@ -167,6 +173,14 @@ + die "lun_number for guid $guid is not a number"; + } + ++sub zfs_get_wwid_number { ++ my ($class, $scfg, $guid) = @_; ++ ++ die "could not find lun_number for guid $guid" if !defined $guid; ++ ++ return $class->zfs_request($scfg, undef, 'list_extent', $guid); ++} ++ + # Configuration + + sub type { +@@ -186,6 +200,32 @@ + description => "iscsi provider", + type => 'string', + }, ++ # This is for FreeNAS iscsi and API intergration ++ # And some enhancements asked by the community ++ freenas_user => { ++ description => "FreeNAS API Username", ++ type => 'string', ++ }, ++ freenas_password => { ++ description => "FreeNAS API Password (Deprecated)", ++ type => 'string', ++ }, ++ truenas_secret => { ++ description => "TrueNAS API Secret", ++ type => 'string', ++ }, ++ truenas_token_auth => { ++ description => "TrueNAS API Authentication with Token", ++ type => 'boolean', ++ }, ++ freenas_use_ssl => { ++ description => "FreeNAS API access via SSL", ++ type => 'boolean', ++ }, ++ freenas_apiv4_host => { ++ description => "FreeNAS API Host", ++ type => 'string', ++ }, + # this will disable write caching on comstar and istgt. + # it is not implemented for iet. iet blockio always operates with + # writethrough caching when not in readonly mode +@@ -224,6 +264,12 @@ + blocksize => { fixed => 1 }, + iscsiprovider => { fixed => 1 }, + nowritecache => { optional => 1 }, ++ freenas_user => { optional => 1 }, ++ freenas_password => { optional => 1 }, ++ truenas_secret => { optional => 1 }, ++ truenas_token_auth => { optional => 1 }, ++ freenas_use_ssl => { optional => 1 }, ++ freenas_apiv4_host => { optional => 1 }, + sparse => { optional => 1 }, + comstar_hg => { optional => 1 }, + comstar_tg => { optional => 1 },