Skip to content

CP-314178: gpumon_interface: add the GPU partition helper's reply types - #7378

Open
mg12 wants to merge 1 commit into
xapi-project:feature/migfrom
mg12:CP-314178-gpu-partition-helper-reply-types
Open

mg12 wants to merge 1 commit into
xapi-project:feature/migfrom
mg12:CP-314178-gpu-partition-helper-reply-types

Conversation

@mg12

@mg12 mg12 commented Nov 6, 2026

Copy link
Copy Markdown
Member

A helper program will report how an NVIDIA card is partitioned (MIG mode, GPU instances, the profile catalogue, the vGPUs placed on them) as one JSON reply, and through --version which commands and format versions it serves. xapi runs it and reads both replies. Both sides need one description of these replies, and xen-api has none.

Add the replies' types, with their JSON readers and writers, to the gpumon interface, which gpumon and xapi already link, in sub-modules named after what they describe. A later minor version may add members and values, and these types must still read its replies. gpumon's existing calls and their JSON are unchanged; nothing reads the new types until xapi's readers of the replies are added.

Each record has the reply's member names. An enumeration value that this reader does not know is kept as Unknown, and only the exact lower-case spelling reads as Known, since rpclib's variant reader ignores case. A member that is always present but may be null has its own typ. A member the reader can do without is kept as an Error when it is absent or cannot be read, and an integer must be a JSON integer in range.

A profile's signature is the resource counts, memory size and capabilities that the driver reports for it. It tells profiles apart beyond their names and numbers, and can show when a driver renumbers them. A member kept as an Error is lenient, so that a fault in it costs only that member, not the whole reply.

The gpumon interface test builds sample replies as OCaml values, writes each one and reads it back. Further cases edit a written reply, to drop or break a member or add what a newer helper may send, and check that the reader refuses the reply or loses only that member. Single values check the enumerations' spelling and the one renamed member.
All 22 pass, with the rest of xapi-idl's 268 tests.

A helper program is to report how an NVIDIA card is partitioned (MIG
mode, GPU instances, the profile catalogue, the vGPUs placed on them) as
one JSON reply, and through --version which commands and format versions
it serves. xapi runs it and reads both replies. Both sides need one
description of these replies, and xen-api has none.

Add the replies' types, with their JSON readers and writers, to the
gpumon interface, which gpumon and xapi already link, in sub-modules
named after what they describe. A later minor version may add members
and values, and these types must still read its replies. gpumon's
existing calls and their JSON are unchanged; nothing reads the new
types until xapi's readers of the replies are added.

Each record has the reply's member names. An enumeration value that this
reader does not know is kept as Unknown, and only the exact lower-case
spelling reads as Known, since rpclib's variant reader ignores case. A
member that is always present but may be null has its own typ. A member
the reader can do without is kept as an Error when it is absent or
cannot be read, and an integer must be a JSON integer in range.

A profile's signature is the resource counts, memory size and
capabilities that the driver reports for it. It tells profiles apart
beyond their names and numbers, and can show when a driver renumbers
them. A member kept as an Error is lenient, so that a fault in it costs
only that member, not the whole reply.

The gpumon interface test builds sample replies as OCaml values, writes
each one and reads it back. Further cases edit a written reply, to drop
or break a member or add what a newer helper may send, and check that
the reader refuses the reply or loses only that member. Single values
check the enumerations' spelling and the one renamed member.

Signed-off-by: Marcus Granado <marcus.granado@citrix.com>

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants