Commit Graph

54 Commits

Author SHA1 Message Date
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
Kevin Adams 6571ab23d1 fix: remove zvol delete from run_delete_lu to eliminate false negative (#240)
ZFSPlugin's free_image deletes the zvol via SSH after calling our
run_delete_lu. Our earlier addition of freenas_delete_zvol in
run_delete_lu caused a double-delete: SSH would fail, free_image's
error recovery would call run_create_lu on the now-missing zvol,
producing a spurious "Unable to create lun (rolled back)" in the task
log even though the migration had already succeeded.

freenas_delete_zvol remains in run_create_lu's rollback path where it
correctly cleans up zvols orphaned by a failed LUN creation (#239).

Also documents ZFS blocksize requirements for TrueNAS SCALE (16k) vs
CORE (8k) in README configuration and troubleshooting sections (#241).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 11:50:12 -04:00
Kevin Adams 267e14ebfa fix: explicitly delete zvol via pool/dataset API on extent removal (#239)
remove:true in the iSCSI extent DELETE body is unreliable on TrueNAS
SCALE 24.10+ — the extent config is removed but the underlying zvol is
left behind as an orphaned dataset. Add freenas_delete_zvol() which calls
DELETE /api/v2.0/pool/dataset/id/{path}/ explicitly after every extent
removal, covering both the rollback path in run_create_lu and normal
disk deletion in run_delete_lu. Guarded to v2.0 API only using the
per-host cache to avoid stale package-global state when two storage
hosts with different API versions are active simultaneously.

Verified on TrueNAS SCALE 24.10.2.1: zvol is fully removed from
Datasets after a forced rollback test (FREENAS_TEST_ROLLBACK=1).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 08:56:02 -04:00
Kevin Adams ec4085b244 fix: full eval-based rollback on LUN creation failure, add test trigger (#239)
Replace the ad-hoc if/rollback in run_create_lu with an eval block that
tracks both extent_id and link_id so either resource is cleaned up if
anything fails at any point during creation (#214 only covered the
link-creation step).

Also adds a FREENAS_TEST_ROLLBACK env-var trigger: set it in pvedaemon's
environment to force a rollback after a successful create, allowing
verification that orphaned extents and links are removed without needing
a real failure condition.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 00:00:55 -04:00
Kevin Adams 168cf0adf7 fix: repair freenas_api_connect autovivification and ping URL passthrough (#238)
Two bugs caused clone/migrate to fail with 'setHost on undefined value'
followed by 'Loop recursion prevention':

1. freenas_api_check reads $freenas_server_list->{$apihost}{client} to
   check if initialized. Perl autovivifies {$apihost} as an empty {} on
   that read. freenas_api_connect then saw a defined (but empty) hash and
   skipped initialization, leaving client undef → setHost crash.
   Fix: guard also checks !defined ...{client}.

2. $ping was a local variable reset to v1.0 on each recursive call.
   TrueNAS 25.04+ removed the v1.0 endpoint (returns 404), so the
   v1.0→v2.0 upgrade branch looped until the runaway counter tripped.
   Fix: accept $ping as optional second parameter (defaults to v1.0)
   and pass it through on both recursive call sites.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 23:34:58 -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 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 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 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 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 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 0b760eefc3 Fix TrueNAS-Scale slash replacement.
- When changing from slashes (/) to dashes (-), I did not provide the
global parameter so a Storage/Tank/Disks would turn out to be
Storage-Tank/Disks causing a iSCSI: Failed to connect to LUN :
iscsi_service failed with : iscsi_service_reconnect_if_loggedin. Can not
reconnect right now.
2022-05-21 15:19:46 -04:00
Kevin Scott Adams c3b6f38c61 Fix TrueNAS-Scale parsing.
- TrueNAS-Scale returns 'application/json' so we need to catch that also
on the return code of 200 from a version API call.
2022-05-21 14:21:05 -04:00
Kevin Scott Adams 75f63b56d1 Update plugin for TrueNAS 13
- Created conditional to parse new TrueNAS 13 version.
- Created conditional to check for a 200 and that the Content-Type is
text/html so it will change to v2.0 of the API's. This is new behavior
in TrueNAS-Core 13.
2022-05-20 12:39:55 -04:00
Kevin Scott Adams 85a67077b2 Optimize methods.
- Instead of using foreach loops to iterate through an array change to
using a hash which the key is the value we are looking for.
2022-04-13 16:29:24 -04:00
Kevin Scott Adams 780c6590fe Update patches and some fixes.
- Add the true path to the debug statement when comparing targets.
- Add patch set for ZFSPlugin.pm for Storage lib 7.1-1
- Add patch set for pvemanagerlib.js for pve-manager version 7.1-11
- Add patch set for apidoc.js for pve-docs version 7.1-2.
- Create stable-7 directory for future installs based on Proxmox major
version each modules version.
2022-04-03 09:18:31 -04:00
Hans 4b0ec91508
Don't replace scfg data
Fix TheGrandWazoo/freenas-proxmox#107
2022-02-24 01:07:32 +08:00
Kevin Scott Adams 55f699e0b1 Update for issues with Proxmox 7.
- The eval{} block was originally returning a value that would allow
execution in the $@ conditional. This changed between Proxmox 6 and 7.
Why, no idea at the moment. Also, the original HASH was no longer valid
as a variable. I don't like the code block at this moment, I need to do
some regression testing to Proxmox 5 and FreeNAS/TrueNAS 11 and 12 to
see if I can clean up the conditional block. It was there for a reason I
just don't know at this moment.
2021-08-08 09:30:49 -04:00
Kevin Scott Adams 1048ee23a7 Missing right curly bracket in TrueNAS-SCALE Fix.
- Added a '}' at line 515.
- Fixes issues reported in #98 abd #75.
- freenas-proxmox-packer also fixed. The stable build directory somehow
was moved to the development building directory.
2021-04-15 20:29:59 -04:00
Kevin Scott Adams cc9707a14c TrueNAS-Scale slash substitution.
- Changed a slash (/) to a dash (-) on the $cfg->{'pool'} reference.
SCST does not support '/' characters on the device.
- Possible fix for #75.
2021-04-13 14:47:21 -04:00
Kevin Scott Adams 084faf9903 Fixed pull request to support FreeNAS, TrueNAS-CORE and TrueNAS-SCALE.
- Adjusted Regex to parse the current TrueNAS-SCALE product and
versioning. Also changed the FreeNAS and TrueNAS so releases will be a
variable (e.g. - U, BETA, RC, MASTER)
- Used the $product_name to change use either a slash (/) for
FreeNAS/TrueNAS-CORE and a dash (-) for FreeNAS-SCALE.
2020-09-24 12:32:19 -04:00
Hans 6eedef4137 fix bug when method is DELETE 2020-09-20 21:44:22 +08:00
Hans 29cf4c48cd extent name replace / to - 2020-09-20 16:23:57 +08:00
Hans 401bcfce53 Support for TrueNAS SCALE version pattern 2020-09-20 15:08:32 +08:00
Kevin Scott Adams c9ecef474b Fix issue with JSON variable names in V1.0 api
- JSON return variables for V1.0 api are iscsi_extent and iscsi_target.
The 'id' was a copy and paste error.

Fixes #72
2020-09-10 15:36:41 -04:00
Kevin Scott Adams 7c0738bab4 Added a space to kick off a build.
- Checking the build of branch 2.0.
2020-09-02 16:37:24 -04:00
Kevin Scott Adams a40e0ac299 Rework the error routine so it will not error out.
- Under a certain condition, the variable $freenas_rest_connection would
not be defined resulting in a perl ‘blessed’ error. Added logic to see
if a variable is being passed in the @_ and use it, else use
$freenas_rest_connection.
- Use caller (1)[3] instead of passing the function name through the @_.
2020-08-27 13:05:56 -04:00
Kevin Scott Adams 91c192f349 Reduce loop from running through all elements
- Just addign a 'last' statement once an extent is found. No since
looking for more after the extent is found because there is no more.
Should make plugin run a bit faster.
2020-07-30 14:22:22 -04:00
Kevin Scott Adams b4a9cd27ea Cleanup of code created issue for some calls to run_lun_command
- When cleaning up code from last commit, I removed a line from the
run_lun_command that initialize the code thinking that the way it would
work would be throught the freenas_api_check when calling the
freenas_api_call. Well certain procedures from the Proxmox ZFSPlugin
call procedures that do not have the $freenas_api_methods variable set
yet because freenas_api_check has NOT been called yet. Inserted the
freenas_api_check() in the run_lun_command() to get the variable
initialized. Fixes #62 and other tests that I found to have this issue.
freenas-proxmox-2.0.0-0beta4 will also have the fix.
2020-07-20 09:59:52 -04:00
Kevin Scott Adams 3e128e673c Allow multiple instances of the [Free|True}NAS REST::Client construct.
- When optimizing the code to remove the redundant calls to create a
'new' REST::Client this had a single variable to hold the instance. If
you were moving between two different servers then the variables would
not match the destination parameters of the [Free|True]NAS server.
Implemented a hashref of the construct of REST:Client with the hashref
being the IP address of the portal or API IP. Fixes #61.
- Remove some white spacing and superfluous code.
- Added some comments so I know what I was changing.
2020-07-14 17:54:37 -04:00
Kevin Scott Adams ac1c31f2d0 Added 302 and 307 code handlers on initial API connection and various
other changes.

- Add logic to freenas_api_connect to handle a '302 Found' which seems
to mean it does not handle v1.0 API's. Fixes #60.
- Add logic to freenas_api_connect to handle a '307 Temporary Redirect'
which is when the redirect http to https box is checked. Fixes #59.
- Redesign the RegEx that validates and pulls the version information
from the API system/version call. This is due to a format like
TrueNAS-12.0-BETA instead of [FreeNAS|TrueNAS]-12.0-U1.1. Also make sure
empty RegEx return variables are zero (0) so the version number that is
formulated is correct (e.g. 12000000, 11030302). Fixes #60.
- During testing needed to add a check due to the
api/v2.0/system/version returning a quoted string where
api/v1.0/system/version returned a JSON-format data.
- Tested against baremetal FreeNAS 11.3-U3.2 and virtual TrueNAS
12.0-BETA machines.
2020-07-07 11:14:30 -04:00
Kevin Scott Adams aa11d596bd Code efficiency improvements.
- Cleaned up the API calling routine so it will only create one instance
of the REST::Client module. Typically was 10 to 30+ instances per VM
disk CRUD.
- Due to this some variables needed to be “global” to the plugin.
- Removed some superfluous hashes and variables.
- Repetitive code reduced to only on call.
- Created one “Frankenstein” hash that retains all API methods,
variables and json body structures for each API version used by the
plugin.
- One call to the global configuration in the version check to reduce
execution time.
- Cleanup some code and formatting.
- Added some comments.
2020-06-11 12:49:28 -04:00
Kevin Scott Adams 977b00a178 FreeNAS API v2.0 features
- Allows the use of FreeNAS API v2.0 so we can finally remove a VM drive
from the Proxmox VE GUI.
- Created a Frankenstein of out of FreeNAS.pm to allow 'one module to
rule them all' for v1.0 and v2.0 API's to FreeNAS.
- librest-client-perl changes so the call can have a <body/> to it on
GET and DELETE methods.
- Some spelling mistakes.
- Better syslog entries.
- More debbugging for testing purposes to the syslog.
2020-06-09 12:31:31 -04:00
KevinAdams 5e255a6208 Fixed block size issue and updated for Proxmox VE 5.3-5
- Removed code in FreeNAS.PM that used the blocksize field from the GUI
for the use of iSCSI block size causing migration and large extent
sizes. Fixes issues #9 and #33.
- Prefixed 'ZFS' to the 'Block Size' label on the GUI.
- Updated for 5.3-5
2018-12-22 13:18:51 -05:00
Kevin Scott Adams 94d897f7d1 Added API Host
- This change allows the API traffic to be on a different interface then
the iSCSI Provider interface. This allows the selection of the FreeNAS
WebGUI address for HTTP/HTTPS to be on a specific interface instead of
"ALL" (0.0.0.0) interfaces.  If the API Host is not defined then the API
traffic will default to the iSCSI Provider interface.
2018-08-19 15:28:39 -04:00
Kevin Scott Adams 3f6059e75f Add test for the FreeNAS API
- Add a simple API test using the FreeNAS API call to get its version
number, which could prove useful in future versions. Closes #17
- Whitespace cleanup
2018-07-31 22:40:22 -04:00
Kevin Scott Adams 42edb8614e Few housekeeping changes
- Whitespace cleanup
- Removed the 'hardcoded' username and password. Will not throw an error
if it is not defined or blank in /etc/pve/storage.cfg for each ZFS via
ISCSI definition.
- Used a Ternary (Elvis - ?:) Operator for the scheme variable.
2018-07-31 21:33:21 -04:00
Tristan Lostroh cce719afb7 Add a function to return NAA
Adds a function to return NAA. This is required to match the WWID for multipath
2018-07-16 09:16:10 +10:00
Krzysztof Raczkowski d3c477c40d Support for SSL access to FreeNAS API. 2018-07-11 12:41:19 +02:00
Kevin Scott Adams a29328e7fa Undef $iscsi_lunid in FreeNAS.pm on line 457
- The perl code was creating a new variable in the ‘if’ code block by
using 'my' at the beginning of the assignment at line 452. Once the code
exited this block that variable was released and now defaulted to the
main block variable at line 441 which is still set to 'undef'. Removing
the 'my' from the assignment line allowed the code to use the main block
$iscsi_lunid variable.

Fixes issue #7
2018-07-09 15:38:54 -04:00
Kevin Scott Adams 23990fc008 Add tainted checking to iscsi_lunid
- So we do not have to change the /usr/bin/pvedaemon a small fix to
check the $item->{'iscsi_target'} varaible from the API call is needed.
This closes issue #3.
2018-06-26 15:00:09 -04:00
Kevin Scott Adams af42dfd008 Change iscsi_lunid values of 'undef' to 0 (zero)
- In FreeNAS 11.1 it seems like a Lun of 0 becomes 'Auto'. When the API
returns the targent_to_extent data any Lun of "Auto" become 'undef' and
causes issues and errors in the syslog. This change corrects this
behavior. Have tested with adding, detaching, removing and "Moving Disk"
functions of Proxmox version 5.1-51.
2018-04-18 13:53:29 -04:00