Skip to content

External SAN arrays for the multi-attach LUN mode: 11 vendor plugins, KMS-wrapped credentials - #1701

Merged
schmidt-scaled merged 4 commits into
feat/ec-floorsfrom
feat/array-credentials
Nov 20, 2026
Merged

schmidt-scaled merged 4 commits into
feat/ec-floorsfrom
feat/array-credentials

Conversation

@schmidt-scaled

@schmidt-scaled schmidt-scaled commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1626 (feat/ec-floors): the multi-attach array LUN mode there already has array registration, the per-node LUN at node add, attach/grow/fence and the takeover. This PR adds the SAN arrays to it and replaces its credential storage. Merge #1626 first.

Summary

Plug-in framework for provisioning LUNs / NVMe namespaces on external enterprise arrays (create, grow, delete, host mapping), plus the credential store that holds the array logins.

There is no usable cross-vendor standard (SMI-S deprecated, Swordfish barely implemented, CSI is Kubernetes-bound), so each array family gets its own REST adapter behind one contract.

Credentials (simplyblock_core/credentials.py, simplyblock_core/kms/)

  • Array credentials are never stored in plaintext in FDB. Three reference kinds:
    • managed: wrapped by a per-cluster key-encryption key in the cluster's KMS (Vault Transit or KMIP Encrypt/Decrypt).
    • vault-kv: the secret lives in Vault KV v2; we store only mount/path/version.
    • kmip-secret: a KMIP SecretData object; we store only its UID.
  • Every secret is bound to a context (array/<id>/<scheme>://<host>:<port>), so rewriting an array's endpoint in FDB cannot redirect its credential to another host.
  • LocalKMS (no external KMS) refuses to store credentials unless the cluster explicitly opts in (allow_local_kms_credentials).
  • In-memory TTL cache, invalidated on auth failure (credential rotation).

Array framework (simplyblock_core/storage_arrays/)

  • ArrayClient is the single entry point: sb-<uuid> naming, size rounding to array granularity, idempotent create/map/unmap/delete, and ownership checks before resize/map/delete (name prefix, name derived from the recorded volume UUID, recorded WWN/NGUID). Shrink is refused; deleting a host never drops a live mapping. One re-auth + retry on auth failure.
  • RestSession: pinned CA bundle per array, timeouts, retries for idempotent calls, uniform error mapping.

Adapters

Pure FlashArray, NetApp ONTAP, Dell PowerStore / PowerMax / PowerFlex, HPE WSAPI (Alletra MP, Primera, 3PAR), HPE Nimble (Alletra 5000/6000), IBM FlashSystem, Hitachi VSP, Huawei Dorado, Infinidat InfiniBox. Plain requests, no vendor SDK dependencies.

Integration with the multi-attach array LUN mode (#1626)

  • simplyblock_core/array/san.py: each adapter is an ArrayPlugin (built in + entry points), usable with cluster set-array --plugin pure-flasharray .... Ownership is encoded in the LUN name (sb-<cluster hash><lun hash>), since SAN arrays have no tags; any operation on another cluster's LUN raises ForeignLunError. Option protocol picks the initiators the hosts are registered with.
  • Node agent: /info reports san_initiators (iSCSI IQN, FC WWPNs, NVMe host NQN, PowerFlex SDC GUID); new POST /scan_new_luns (SCSI host scan + NVMe rescan). Node add and the attachment reconcile scan while waiting for a LUN.
  • Credentials: register_array no longer stores plaintext through kms.put_secret. Credentials are wrapped by the cluster's KMS (KMIP now works; the local KMS needs allow_local_kms_credentials), bound to array id + endpoint, and kept as Cluster.array_credential_ref. Or credential_ref / --credential-ref names an external Vault KV / KMIP secret that simplyblock only reads. Registrations from before keep working and are migrated on re-registration.
  • Host prerequisites (not automated): iSCSI sessions logged in, FC zoning, NVMe-oF controllers connected.

Testing

  • Stateful in-memory fake of each vendor's REST API (storage_arrays/testing/<vendor>.py), plugged into requests via a transport adapter.
  • One shared contract suite runs against every adapter, plus per-vendor unit tests.
  • python -m simplyblock_core.storage_arrays.testing --vendor <key> serves any fake as an HTTPS mock array.
  • Live tier: SB_ARRAY_LIVE_CONFIG=<file> runs the same contract suite against a simulator or real array.
  • test_san_plugin.py: every plugin through the feat: erasure-coding resource floors; multi-attach array LUNs with fast takeover; array adapters #1626 plugin contract against its fake (multi-attach, fence/unfence, grow, delete, cross-cluster refusal).
  • Unit tier: only the known Windows-only failures (spdk_proxy, lblk_persistent_names, cluster_create_deploy_order, device_health_info), same as the base; ruff + mypy clean.

Not verified / follow-ups

  • No adapter has run against real hardware. The fakes encode our reading of each API. Each adapter docstring lists its uncertain API details under "Verify against a real system".
  • Not supported yet: NetApp ASA r2; NVMe on HPE WSAPI/Nimble, Hitachi, Huawei, Infinidat, PowerFlex.
  • KMIP key-encryption-key creation can race under concurrent first use.
  • Vault path tested with mocks only (KMIP path also against a real PyKMIP server).

🤖 Generated with Claude Code

@github-actions github-actions Bot added the target/main Targets the development branch label Nov 20, 2026
michixs and others added 3 commits November 20, 2026 15:47
Groundwork for storage-array plugins (provision/resize/delete LUNs): plugins
hold a credential reference and resolve it at call time; secrets never sit in
FoundationDB in clear.

- KMS: generic secret wrap/unwrap (wrap_secret/unwrap_secret) on all three
  backends, with a context binding (array identity + endpoint) and an
  embedded SHA-256 digest -- KMIP wraps with AES-CBC, so the digest is what
  catches tampering there. ensure_key_encryption_key never replaces an
  existing KEK (KMIP create was not idempotent).
- Vault: read_kv_secret for customer-managed KV v2 secrets; optional
  credentials_cert_role so a separate Vault policy can cover credentials.
- KMIP: get_secret_data for customer-managed SecretData objects.
- simplyblock_core.credentials: CredentialProvider with managed refs
  (wrapped under a per-cluster KEK) and external refs (Vault KV path, KMIP
  SecretData UID), in-memory TTL cache, invalidate-on-auth-failure.
- LocalKMS (no external KMS) only encodes, so credentials are refused unless
  the cluster opts in via allow_local_kms_credentials.
- cluster set: parse bool attributes explicitly; bool("false") was True.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e FlashArray adapter

ArrayClient (credential resolution + re-auth retry, sb- naming, size
rounding, idempotent create/map/unmap/delete, ownership + WWN checks),
RestSession (TLS/CA bundle, retries, error mapping), lazy vendor registry,
in-process vendor fakes + HTTPS mock server, shared contract suite with a
live tier (SB_ARRAY_LIVE_CONFIG).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ten more adapters behind the ArrayAdapter contract, each with a stateful
fake of the vendor REST API and vendor-specific tests: NetApp ONTAP, Dell
PowerStore / PowerMax / PowerFlex, HPE WSAPI (Alletra MP, Primera, 3PAR),
HPE Nimble (Alletra 5000/6000), IBM FlashSystem, Hitachi VSP, Huawei
OceanStor Dorado, Infinidat InfiniBox.

Framework follow-ups from integrating them:
- Volume.wwn holds any SCSI designator (naa. or eui. for Nimble).
- NVMe/FC initiators are NQNs, not WWPNs.
- Capabilities.max_initiators_per_host (PowerFlex SDC hosts = 1).
- Client pins resize/map/delete to the name derived from the recorded
  volume UUID (array ids and WWNs can be reused after delete, e.g. VSP).
- RestSession.sleep is public (async job polling without real waits).
- Fake transport fills the cookie jar like a real response.
- Contract: delete_host must not drop live mappings (Pure now checks).

Each adapter lists unverified API details under "Verify against a real
system"; nothing has run against real hardware yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
except KMSException as e:
raise CredentialError(f"Storing credential failed: {e.message}") from e
logger.info("Stored managed credential (backend=%s, fields=%s, context=%s)",
backend, sorted(secret_fields), context)
_self_signed(host, certfile, keyfile)
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
ctx.load_cert_chain(certfile, keyfile)
server.socket = ctx.wrap_socket(server.socket, server_side=True)
Plug the 11 storage_arrays adapters into the multi-attach array LUN mode of
#1626 and move its array credentials onto simplyblock_core.credentials.

Plugins (simplyblock_core/array/san.py): one ArrayPlugin per array family
(pure-flasharray, netapp-ontap, dell-powerstore/-powermax/-powerflex,
hpe-wsapi, hpe-nimble, ibm-flashsystem, hitachi-vsp, huawei-dorado,
infinidat-infinibox), built in and declared as entry points. Ownership is
encoded in the LUN name (sb-<cluster hash><lun hash>): SAN arrays have no
tags, and every operation refuses another cluster's LUN. wwn is returned in
the form lsblk reports. option `protocol` selects the host initiators.
list_luns is not offered; cluster delete deletes the recorded LUNs.

Host side: the agent reports its SAN initiators in /info (iSCSI IQN, FC
WWPNs, NVMe host NQN, PowerFlex SDC GUID; /host/etc first on Kubernetes)
and gets POST /scan_new_luns (SCSI host scan, NVMe namespace rescan). Node
add and the attachment reconcile scan while they wait for a LUN; an agent
without the endpoint is tolerated. WWN matching accepts naa.<hex>.

Credentials: register_array no longer stores plaintext through
kms.put_secret. Given credentials are wrapped by the cluster's credentials
key (Vault Transit, KMIP, or the local KMS only with
allow_local_kms_credentials), bound to array id + endpoint, and kept as
Cluster.array_credential_ref; or credential_ref names an external Vault KV /
KMIP secret that is only read. Arrays registered before keep working from
their KMS path, which a re-registration removes. API/CLI: credential_ref /
--credential-ref. CredentialProvider resolves the KMS connection per call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schmidt-scaled
schmidt-scaled changed the base branch from main to feat/ec-floors November 20, 2026 15:24
@github-actions github-actions Bot removed the target/main Targets the development branch label Nov 20, 2026
@schmidt-scaled schmidt-scaled changed the title External storage arrays: adapter framework, 11 vendor adapters, KMS-backed credential store External SAN arrays for the multi-attach LUN mode: 11 vendor plugins, KMS-wrapped credentials Nov 20, 2026
assert any(p.startswith(f"{prefix}/jobs/") for p in paths)
assert not any(p.startswith("/ConfigurationManager/v1/objects/ldevs") for p in paths)
finally:
client.close()
with pytest.raises(ArrayError):
client.get_info()
finally:
client.close()
client.create_volume(_uuid(), GIB)
assert 10 <= sum(sleeps) < 20
finally:
client.close()
with pytest.raises(ArrayError, match="No free LDEV"):
client.create_volume(_uuid(), GIB)
finally:
client.close()
g = next(g for g in fake.groups.values() if g["name"] == "sbtest-vm")
assert g["mode"] == "VMWARE_EX" and g["modeOptions"] == [54, 63]
finally:
client.close()
with pytest.raises(ArrayError, match="no configured fc port"):
client.ensure_host(HostSpec(name="sbtest-fc", initiators=(FC_A,)))
finally:
client.close()
with pytest.raises(ArrayError, match="not locked"):
client.create_volume(_uuid(), GIB)
finally:
client.close()
@schmidt-scaled
schmidt-scaled merged commit 144ca37 into feat/ec-floors Nov 20, 2026
24 of 34 checks passed
@schmidt-scaled
schmidt-scaled deleted the feat/array-credentials branch November 20, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants