Skip to content

Fix direct-ESXi (no vCenter) connectivity - #3

Open
doccaz wants to merge 3 commits into
cloudbase:mainfrom
doccaz:pr1-direct-esxi
Open

doccaz wants to merge 3 commits into
cloudbase:mainfrom
doccaz:pr1-direct-esxi

Conversation

@doccaz

@doccaz doccaz commented Sep 19, 2026

Copy link
Copy Markdown

Summary

nfc_service() hardcoded the NfcService moref as "nfcService", which is correct for vCenter but wrong for a bare ESXi host (moref is "ha-nfc-service" there). Connecting directly to ESXi therefore failed outright with vmodl.fault.ManagedObjectNotFound.

Fixed by resolving the moref dynamically via an internal RetrieveInternalContent SOAP call, the same way real VDDK does it — confirmed via an SSL-hook capture of native VDDK connecting to a bare ESXi 8.0.3 host.

Also fixes connect_authd() for tickets that omit host: a direct-ESXi ticket doesn't include this field at all (the authd endpoint is implicitly the same host already logged into over VIM), which previously resulted in None being passed to socket.create_connection.

Full protocol details and the wire-level differences from the vCenter-mediated path are documented in docs/nfc_auth.md.

Test plan

  • Validated end-to-end (ConnectEx + Open + Read, both nbd and nbdssl transports) against a live standalone ESXi 8.0.3 host with no vCenter in the topology
  • pytest tests/integration/test_nfc_auth.py passes standalone
  • Existing vCenter-mediated path unaffected (moref resolution now dynamic for both cases)

Note on PR sequencing

This is the first of 4 focused PRs splitting up what was originally one larger combined PR (#2, now closed). The other three (GetInfo+DDB_GET, QueryAllocatedBlocks+NFC_DELTA_DISK investigation, and CBT) are independent of this one and can merge in any order — each was verified to build and pass its own tests standalone against master.

🤖 Generated with Claude Code

nfc_service() hardcoded the NfcService moref as "nfcService", which is
correct for vCenter but wrong for a bare ESXi host (where the moref is
"ha-nfc-service"). Connecting directly to ESXi therefore failed with
vmodl.fault.ManagedObjectNotFound.

Fixed by resolving the moref dynamically via an internal
RetrieveInternalContent SOAP call, the same way real VDDK does it
(confirmed by an SSL-hook capture of native VDDK connecting to a bare
ESXi 8.0.3 host). Also fixes connect_authd() for tickets that omit
`host`: on a direct-ESXi ticket the field is absent entirely (the
authd endpoint is implicitly the same host already logged into),
which previously caused a plain None passed to socket.create_connection.

Validated end-to-end (ConnectEx + Open + Read, both nbd and nbdssl
transports) against a live standalone ESXi 8.0.3 host with no vCenter
in the topology. Full protocol details and the wire-level differences
from the vCenter-mediated path are in docs/nfc_auth.md.
@petrutlucian94

Copy link
Copy Markdown
Member

@doccaz Hi, thanks a lot for opening those PRs! I'll review and test them as soon as possible.

FYI: I'm working on "hotadd" and "san" transport support, I'll send those soon. We're also planing to do a rewrite in Rust in order to provide a C ABI compatible replacement for VDDK. It will probably be a separate branch called "rust". New features will probably still go in the pure-python implementation first since it's easier to test and extend.

@doccaz

doccaz commented Sep 21, 2026

Copy link
Copy Markdown
Author

Nice! Happy to help.

The OpenVixDiskLib integration tests currently expect vSphere
credentials.

We'll add a test class that specifically covers direct ESXi connections.

An ESXi node will be picked from vSphere, using credentials from
`.test_config.yaml`. If no ESXi credentials are provided, we'll try
to use the default "root" user and the vSphere password.
@petrutlucian94

Copy link
Copy Markdown
Member

I've added some integration tests that specifically target direct ESXi connections and fixed a linter error, I hope you don't mind.

My PM informed me that we'll need a CLA before accepting external contributions. I'll review the other PRs in the meantime, I should have more information about the CLA soon.

@rwmjones

Copy link
Copy Markdown

My PM informed me that we'll need a CLA before accepting external contributions. I'll review the other PRs in the meantime, I should have more information about the CLA soon.

Please let us know when you have information about this. Will this be a copyright assignment or a more general agreement? And are there particular reasons why this would be needed?

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