Skip to content

Commit 53f82a9

Browse files
committed
specs-go/config: Updated rdma resource limits as key-value pair
Updated rdma resource limits as key-value pairs. This avoid any issues that may arise or complicate code if it is done using an array, that can contain duplicate entries for a given device. It also makes resource definition more intutive to describe resource limit of a device. Signed-off-by: Parav Pandit <[email protected]>
1 parent 30a9d54 commit 53f82a9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

specs-go/config.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,12 @@ type LinuxNetwork struct {
322322

323323
// LinuxRdma for Linux cgroup 'rdma' resource management (Linux 4.11)
324324
type LinuxRdma struct {
325-
// Hca device name whose resources to be restricted
326-
HcaDevice string `json:"hca_device,omitempty"`
325+
// Limits are a set of key value pairs that define RDMA resource limits,
326+
// where the key is device name and value is resource limits.
327+
Limits map[string]LinuxRdmaLimit `json:"limits,omitempty"`
328+
}
329+
330+
type LinuxRdmaLimit struct {
327331
// Maximum number of HCA handles that can be opened. Default is "no limit".
328332
HcaHandles *uint32 `json:"hca_handles,omitempty"`
329333
// Maximum number of HCA objects that can be created. Default is "no limit".
@@ -347,7 +351,7 @@ type LinuxResources struct {
347351
// Network restriction configuration
348352
Network *LinuxNetwork `json:"network,omitempty"`
349353
// Rdma resource restriction configuration
350-
RdmaLimits []LinuxRdma `json:"rdmaLimits,omitempty"`
354+
RdmaLimits LinuxRdma `json:"rdmaLimits,omitempty"`
351355
}
352356

353357
// LinuxDevice represents the mknod information for a Linux special device file

0 commit comments

Comments
 (0)