Skip to content

Commit c9a2fde

Browse files
committed
Address feedback in design sync
1 parent 82b11b0 commit c9a2fde

File tree

2 files changed

+173
-4
lines changed

2 files changed

+173
-4
lines changed

cns/api.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,14 +402,14 @@ type AssignIBDevicesToPodResponse struct {
402402
Message string `json:"message"` // Additional message or error description
403403
}
404404

405-
// GetIBDeviceInfoRequest represents the request to get InfiniBand device information
405+
// GetIBDeviceStatusRequest represents the request to get InfiniBand device information
406406
// GET /ibdevices/{mac-address-of-device} - no request body needed for GET
407-
type GetIBDeviceInfoRequest struct {
407+
type GetIBDeviceStatusRequest struct {
408408
MACAddress string `json:"macAddress"` // MAC address of the device (from URL path)
409409
}
410410

411-
// GetIBDeviceInfoResponse represents the response containing InfiniBand device information
412-
type GetIBDeviceInfoResponse struct {
411+
// GetIBDeviceStatusResponse represents the response containing InfiniBand device information
412+
type GetIBDeviceStatusResponse struct {
413413
MACAddress string `json:"macAddress"` // MAC address of the device
414414
PodID string `json:"podID"` // Pod that the device is assigned to
415415
Status infiniband.Status `json:"status"` // Device status (e.g., "pendingProgramming", "error", "programmed", "pendingDeletion", "available")

cns/swagger.yaml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,78 @@ paths:
120120
schema:
121121
$ref: "#/components/schemas/UnpublishNetworkContainerResponse"
122122

123+
/ibdevices/pod/{podname-podnamespace}:
124+
put:
125+
summary: Assigns IB devices to a pod
126+
description: >-
127+
Assigns the specified IB devices to the pod identified by PodID. The
128+
MAC addresses of the devices are provided in the request body.
129+
parameters:
130+
- name: podname-podnamespace
131+
in: path
132+
required: true
133+
description: The name and namespace of the pod
134+
schema:
135+
type: string
136+
requestBody:
137+
required: true
138+
content:
139+
application/json:
140+
schema:
141+
$ref: "#/components/schemas/AssignIBDevicesToPodRequest"
142+
responses:
143+
'200':
144+
description: >-
145+
The request passed initial validation and CNS was able to propagate its state.
146+
content:
147+
application/json:
148+
schema:
149+
$ref: "#/components/schemas/AssignIBDevicesToPodResponse"
150+
'404':
151+
description: >-
152+
The pod specified by PodID was not found
153+
content:
154+
application/json:
155+
schema:
156+
$ref: "#/components/schemas/AssignIBDevicesToPodResponse"
157+
'400':
158+
description: >-
159+
One of the IB devices specified is not available
160+
content:
161+
application/json:
162+
schema:
163+
$ref: "#/components/schemas/AssignIBDevicesToPodResponse"
164+
165+
/ibdevices/{macaddress}:
166+
get:
167+
summary: Get status about an IB device
168+
description: >-
169+
Retrieves the current status of the specified IB device.
170+
parameters:
171+
- name: macaddress
172+
in: path
173+
required: true
174+
description: The MAC address of the IB device (with colons ":")
175+
schema:
176+
type: string
177+
requestBody:
178+
required: false
179+
responses:
180+
'200':
181+
description: >-
182+
The request was successful and the status of the IB device is returned.
183+
content:
184+
application/json:
185+
schema:
186+
$ref: "#/components/schemas/GetIBDeviceStatusResponse"
187+
'404':
188+
description: >-
189+
The IB device specified by MAC address was not found.
190+
content:
191+
application/json:
192+
schema:
193+
$ref: "#/components/schemas/GetIBDeviceStatusResponse"
194+
123195
components:
124196
schemas:
125197
UnpublishNetworkContainerResponse:
@@ -351,3 +423,100 @@ components:
351423
Message:
352424
type: string
353425
description: The error message
426+
427+
ErrorCode:
428+
type: integer
429+
description: Pre-defined error code of what went wrong, if anything (see cns/types/infiniband/errorcodes.go)
430+
oneOf:
431+
- title: Success
432+
const: 0
433+
description: Successful operation
434+
- title: PodNotFound
435+
const: 1
436+
description: Pod not found
437+
- title: DeviceUnavailable
438+
const: 2
439+
description: Device is unavailable
440+
- title: DeviceNotFound
441+
const: 3
442+
description: Device not found
443+
- title: AnnotationNotFound
444+
const: 4
445+
description: Annotation not found on pod
446+
- title: PodAlreadyAllocated
447+
const: 5
448+
description: Pod was already assigned IB devices (and new ones don't match)
449+
- title: InternalProgrammingError
450+
const: 6
451+
description: Something went wrong programming the devices
452+
453+
Status:
454+
type: integer
455+
description: Status of IB device (see cns/types/infiniband/status.go)
456+
oneOf:
457+
- title: ProgrammingPending
458+
const: 0
459+
description: Programming of device is pending
460+
- title: ProgrammingFailed
461+
const: 1
462+
description: Programming of device failed
463+
- title: ProgrammingComplete
464+
const: 2
465+
description: Programming of device is complete
466+
- title: ReleasePending
467+
const: 3
468+
description: Release of device is pending
469+
- title: Available
470+
const: 4
471+
description: Device is available for use
472+
473+
AssignIBDevicesToPodRequest:
474+
type: object
475+
required:
476+
- PodID
477+
- MACAddresses
478+
properties:
479+
PodID:
480+
type: string
481+
description: podname-podnamespace of which pod to attach these devices through
482+
MACAddresses:
483+
type: array
484+
description: MAC addresses of IB devices such as "60:45:bd:a4:b5:7a"
485+
items:
486+
type: string
487+
488+
AssignIBDevicesToPodResponse:
489+
type: object
490+
required:
491+
- ErrorCode
492+
- Message
493+
properties:
494+
ErrorCode:
495+
$ref: "#/components/schemas/ErrorCode"
496+
Message:
497+
type: string
498+
description: Human-readable message or error description
499+
500+
GetIBDeviceStatusResponse:
501+
type: object
502+
required:
503+
- MACAddress
504+
- PodID
505+
- Status
506+
- ErrorCode
507+
- Message
508+
properties:
509+
MACAddress:
510+
type: string
511+
description: MAC address of the IB device
512+
PodID:
513+
type: string
514+
description: podname-podnamespace of the pod to which the device is assigned, if any
515+
Status:
516+
$ref: "#/components/schemas/Status"
517+
ErrorCode:
518+
$ref: "#/components/schemas/ErrorCode"
519+
Message:
520+
type: string
521+
description: Human-readable message or error description
522+

0 commit comments

Comments
 (0)