Skip to content

Commit

Permalink
fixup! config-linux: Refined JSON definitions for RDMA limits (#1)
Browse files Browse the repository at this point in the history
additionalProperties is defined for the JSON Schema draft-04 in [1]
with clearer documentation in draft-07 [2].  It is supportd by
gojsonschema since xeipuuv/gojsonschema@0572d9d (added
additionalProperties with inner schema, 2013-06-21).

[1]: https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.4
[2]: https://tools.ietf.org/html/draft-handrews-json-schema-validation-00#section-6.5.6

Signed-off-by: W. Trevor King <wking@tremily.us>
  • Loading branch information
wking authored and paravmellanox committed Jan 24, 2018
1 parent 60c82b2 commit 18ff08c
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 28 deletions.
46 changes: 19 additions & 27 deletions config-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,40 +457,32 @@ The following parameters can be specified to set up the controller:

### <a name="configLinuxRDMA" />RDMA

**`rdma`** (object, OPTIONAL) represents the cgroup subsystem `rdma`.
**`rdmaLimits`** (object, OPTIONAL) represents the cgroup subsystem `rdma`.
For more information, see the kernel cgroups documentation about [rdma][cgroup-v1-rdma].

The following parameters can be specified to set up the controller:
The name of the device to limit is the entry key.
Entry values are objects with the following properties:

* **`hca_handles`** *(uint32, OPTIONAL)* - specifies the maximum number of hca_objects in the cgroup
* **`hca_objects`** *(uint32, OPTIONAL)* - specifies the maximum number of hca_handles in the cgroup

* **`rdmaLimits`** *(list of objects, OPTIONAL)* - specifies a list of limit objects applicable to processes in the group.
Limit object is a key value pair that defines limits of a device.
* **`hca_device`** *(string, REQUIRED)* - specifies the device name whose resources limit to be configured
The following parameters can be specified per-device:
* **`hca_handles`** *(uint32, OPTIONAL)* - specifies the maximum number of hca_objects in the cgroup
* **`hca_objects`** *(uint32, OPTIONAL)* - specifies the maximum number of hca_handles in the cgroup
You MUST specify at least one of the `hca_handles` or `hca_objects` in a given entry, and MAY specify both.
You MUST specify at least one of the `hca_handles` or `hca_objects` in a given entry, and MAY specify both.

#### Example

```json
"rdma": [
{
"mlx5_1": {
"hca_handles": 3,
"hca_objects": 10000
}
},
{
"mlx4_0": {
"hca_objects": 1000
}
},
{
"rxe3": {
"hca_objects": 10000
}
}
]
"rdmaLimits": {
"mlx5_1": {
"hca_handles": 3,
"hca_objects": 10000
},
"mlx4_0": {
"hca_objects": 1000
},
"rxe3": {
"hca_objects": 10000
}
}
```

## <a name="configLinuxIntelRdt" />IntelRdt
Expand Down
6 changes: 6 additions & 0 deletions schema/config-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@
}
}
}
},
"rdmaLimits": {
"type": "object",
"additionalProperties": {
"$ref": "defs-linux.json#/definitions/RdmaLimit"
}
}
}
},
Expand Down
11 changes: 11 additions & 0 deletions schema/defs-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,17 @@
"priority"
]
},
"RdmaLimit": {
"type": "object",
"properties": {
"hca_handles": {
"$ref": "defs.json#/definitions/uint32"
},
"hca_objects": {
"$ref": "defs.json#/definitions/uint32"
}
}
},
"NamespaceType": {
"type": "string",
"enum": [
Expand Down
15 changes: 15 additions & 0 deletions schema/test/config/bad/linux-rdma.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ociVersion": "1.0.0",
"root": {
"path": "rootfs"
},
"linux": {
"resources": {
"rdmaLimits": {
"mlx5_1": {
"hca_handles": "not a uint32"
}
}
}
}
}
22 changes: 22 additions & 0 deletions schema/test/config/good/linux-rdma.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"ociVersion": "1.0.0",
"root": {
"path": "rootfs"
},
"linux": {
"resources": {
"rdmaLimits": {
"mlx5_1": {
"hca_handles": 3,
"hca_objects": 10000
},
"mlx4_0": {
"hca_objects": 1000
},
"rxe3": {
"hca_objects": 10000
}
}
}
}
}
2 changes: 1 addition & 1 deletion specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ type LinuxResources struct {
HugepageLimits []LinuxHugepageLimit `json:"hugepageLimits,omitempty"`
// Network restriction configuration
Network *LinuxNetwork `json:"network,omitempty"`
// Rdma resource restriction configuration
// RdmaLimits resource restriction configuration.
// Limits are a set of key value pairs that define RDMA resource limits,
// where the key is device name and value is resource limits.
RdmaLimits map[string]LinuxRdmaLimit `json:"rdmaLimits,omitempty"`
Expand Down

0 comments on commit 18ff08c

Please sign in to comment.