Skip to content

flasharray: skip hosts missing on the array and say so on attach - #14864

Open
Damans227 wants to merge 2 commits into
apache:4.22from
Damans227:flasharray-host-lookup
Open

Damans227 wants to merge 2 commits into
apache:4.22from
Damans227:flasharray-host-lookup

Conversation

@Damans227

Copy link
Copy Markdown
Contributor

Fixes #14862
Fixes #14863

When a KVM host has no host object with the same name on the FlashArray, the host lookup crashes, which fails VM deployment outright, and attach fails with an error about revoking access that says nothing about the name. This makes the lookup return "not found" so the planner just skips that host, and attach now fails with a message that names the host and says the names must match.

  • getHost() returns null for an unknown host instead of crashing, and retries the short name only when the name has a domain part
  • attach fails with "Host [name] not found in FlashArray at [url]. The host object on the array must have the same name as the CloudStack host"
  • the attach fallback no longer crashes on a host name without a dot

Test:

Rename the array host object for one KVM host (purehost rename b08-36 b08-36-fc), then deploy a VM and attach a volume to a VM on that host.

Before: deploy crashes, attach error points at revoking access.

"errorcode": 530,
"errortext": "Cannot invoke \"...FlashArrayList.getItems()\" because \"list\" is null"

CloudRuntimeException: Error revoking access for host Host {"id":4,"name":"b08-36",...} to volume VolumeObject {...}

before-deploy
before-attach

After: deploy on that host fails cleanly, deploy without a host lands on the other host, attach says what is wrong.

== deploy on b08-36
"errortext": "No destination found for a deployment for VM instance ..."
== deploy any host
{"virtualmachine":{"hostname":"b08-35","state":"Running"}}

Host [b08-36] not found in FlashArray at [https://10.23.26.50:443/api]. The host object on the array must have the same name as the CloudStack host

after-deploy-attach
after-attach-message

Also added unit tests for the host lookup.

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.33333% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.33%. Comparing base (6489766) to head (9bb26dd).
⚠️ Report is 9 commits behind head on 4.22.

Files with missing lines Patch % Lines
...atastore/adapter/flasharray/FlashArrayAdapter.java 53.33% 14 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #14864      +/-   ##
============================================
- Coverage     18.34%   18.33%   -0.01%     
- Complexity    16669    16687      +18     
============================================
  Files          5939     5940       +1     
  Lines        537819   538186     +367     
  Branches      65941    65941              
============================================
+ Hits          98638    98696      +58     
- Misses       427960   428261     +301     
- Partials      11221    11229       +8     
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.43% <53.33%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@prashanthr2

Copy link
Copy Markdown
Contributor

Verified working, both halves.

Verified on CloudStack 4.22.1.1, packages rebuilt from patched source. KVM on Ubuntu 24.04.4 LTS, Pure FA-X20R4, Purity//FA 6.10.6, provider Flash Array, FibreChannel.

Renamed the array host object b08-36 to b08-36-fc so it no longer matched the CloudStack host name.

#14862 - deploying a VM pinned to that host no longer throws NullPointerException ... FlashArrayList.getItems() because "list" is null. The lookup failure is logged and the planner adds the host to the avoid set.

#14863 - attaching a volume to a VM already running on that host now gives:

Host [b08-36] not found in FlashArray at [https://10.23.26.50:443/api]. The host object on the
array must have the same name as the CloudStack host

On 4.22.1.1 this surfaces as Failed to spool template disk at path: ... connid.b08-36-fc=2;, which gives no hint that host naming is involved.

One small thing: findHost() catches Exception rather than the 400 specifically, so a timeout, TLS failure or expired token also becomes "not found" - and the administrator is then told to rename host objects when the array is simply unreachable.

cc: @Damans227 Can you please check the last point on this

@Damans227

Copy link
Copy Markdown
Contributor Author

One small thing: findHost() catches Exception rather than the 400 specifically, so a timeout, TLS failure or expired token also becomes "not found" - and the administrator is then told to rename host objects when the array is simply unreachable.

@prashanthr2 thanks for testing. pushed a fix, now only a 400 from the array counts as not found. a timeout, login or connection failure fails with its own error instead of the rename message.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants