Skip to content

Add VixDiskLib_GetInfo (capacity, geometry, DDB_GET fields) - #4

Open
doccaz wants to merge 3 commits into
cloudbase:mainfrom
doccaz:pr2-getinfo-ddbget
Open

doccaz wants to merge 3 commits into
cloudbase:mainfrom
doccaz:pr2-getinfo-ddbget

Conversation

@doccaz

@doccaz doccaz commented Sep 19, 2026

Copy link
Copy Markdown

Summary

  • VixDiskLib_GetInfo: capacity and physical geometry come free from the OPEN_FILE reply — found by dumping every byte of that reply during a GetInfo capture rather than just the fields an earlier Open-only capture had labeled. Offset 28 (uint64, bytes) matches VixDiskLibInfo.capacity; offsets 40/44/48 match physGeo exactly. No extra NFC round trip needed for these two fields.
  • DDB_GET: a generic VMDK descriptor key/value NFC message, implemented as its own thing too. Request is a 16-byte fixed payload plus the key name as a raw ASCII extra; reply is 16 bytes plus a value extra that's ASCII text on the wire (not binary) — geometry.cylinders comes back as the literal bytes b"2088", matching how a VMDK descriptor's DDB section stores key/value pairs as plain text.
  • VixDiskLibHandle.get_info() now issues the same 5 DDB_GET round trips (biosGeo, adapterType, uuid) real VDDK's VixDiskLib_GetInfo pays on every call — matching its behavior and cost exactly.

Full protocol details are in docs/nfc_open.md.

Test plan

  • New unit tests (OPEN_FILE reply parsing, DDB_GET wire format, query_full_info field combination/fallback logic) — no lab needed, pytest tests/unit
  • Validated against a live standalone ESXi 8.0.3 host: output matches native VDDK's own GetInfo on the same disk exactly (adapterType=3 ↔ "lsilogic", same uuid string, same zeroed biosGeo)
  • New integration test (test_get_info) plus the existing suite pass

Note on PR sequencing

Second of 4 focused PRs splitting up the original combined PR #2 (now closed). Independent of #3 (direct-ESXi fix), #? (QueryAllocatedBlocks/NFC_DELTA_DISK), and #? (CBT) — can merge in any order. (This PR was validated live by temporarily stacking it on the direct-ESXi fix locally, since our test lab happens to be a bare ESXi host that needs that fix to connect at all — a normal vCenter-backed lab wouldn't hit that.)

🤖 Generated with Claude Code

Capacity and physical geometry come free from the OPEN_FILE reply:
found via an SSL-hook capture of VixDiskLib_GetInfo that dumped every
byte of the reply rather than just the fields an earlier Open-only
capture had labeled. Offset 28 (uint64, bytes) matches
VixDiskLibInfo.capacity; offsets 40/44/48 match physGeo exactly. No
extra NFC round trip needed for these two fields.

biosGeo, adapterType, and uuid come from DDB_GET (a generic VMDK
descriptor key/value NFC message, implemented here too): request is a
16-byte fixed payload plus the key name as a raw ASCII extra; reply is
16 bytes plus a value extra that is ASCII text on the wire (not
binary) -- geometry.cylinders comes back as the literal bytes b"2088",
matching how a VMDK descriptor's DDB section stores key/value pairs
as plain text.

VixDiskLibHandle.get_info() now issues the same 5 DDB_GET round trips
real VDDK's VixDiskLib_GetInfo pays on every call, matching its
behavior and cost exactly (previously it only returned the two free
OPEN_FILE-derived fields).

Adds unit tests for the OPEN_FILE reply parsing, the DDB_GET wire
format, and query_full_info's field combination/fallback logic -- no
lab needed. Validated against a live standalone ESXi 8.0.3 host:
output matches native VDDK's own GetInfo on the same disk exactly
(adapterType=3 <-> "lsilogic", same uuid string, same zeroed biosGeo).
Full protocol details in docs/nfc_open.md.
We're currently hitting the following mypy error:

```
tests/unit/test_nfc_open.py:107: error: Argument "sock" to "NfcDisk"
has incompatible type "_FakeSocket"; expected "socket"  [arg-type]
```

`typing.Protocol` is a convenient way of addressing this.

https://typing.python.org/en/latest/spec/protocol.html
petrutlucian94 added a commit to doccaz/OpenVixDiskLib that referenced this pull request Sep 23, 2026
We'll use the same typing.Protocol approach as
cloudbase#4, minimizing
merge conflicts.
petrutlucian94 added a commit to doccaz/OpenVixDiskLib that referenced this pull request Sep 24, 2026
We'll use the same typing.Protocol approach as
cloudbase#4, minimizing
merge conflicts.
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.

2 participants