Skip to content

Commit 1ea1519

Browse files
dhrgitalxiord
authored andcommitted
Documenting PATCH /network-interfaces/
Added a doc providing details about the usage of the new API call for post-boot updating the net rate limiters. Added a CHANGELOG entry mentioning this new API call. Signed-off-by: Dan Horobeanu <[email protected]>
1 parent 9b1e121 commit 1ea1519

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
[the docs](docs/api_requests/actions.md#sendctrlaltdel) for details.
99
- New metric counting the number of egress packets with a spoofed MAC:
1010
`net.tx_spoofed_mac_count`.
11+
- New API call: `PATCH /network-interfaces/`, used to update the rate limiters
12+
on a network interface, after the start of a microVM.
1113

1214
### Changed
1315

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Updating A Network Interface
2+
3+
After the microVM is started, the rate limiters assigned to a network
4+
interface can be updated via a `PATCH /network-interfaces/{id}` API
5+
call.
6+
7+
E.g. for a network interface created with:
8+
9+
```
10+
PUT /network-interfaces/iface_1 HTTP/1.1
11+
Host: localhost
12+
Content-Type: application/json
13+
Accept: application/json
14+
15+
{
16+
"iface_id": "iface_1",
17+
"host_dev_name": "fctap1",
18+
"guest_mac": "06:00:c0:a8:34:02",
19+
"rx_rate_limiter": {
20+
"bandwidth": {
21+
"size": 1024,
22+
"one_time_burst": 1048576,
23+
"refill_time": 1000
24+
}
25+
},
26+
"tx_rate_limiter": {
27+
"bandwidth": {
28+
"size": 1024,
29+
"one_time_burst": 1048576,
30+
"refill_time": 1000
31+
}
32+
}
33+
}
34+
```
35+
36+
A `PATCH` request can be sent at any future time, to update the rate
37+
limiters:
38+
39+
```
40+
PATCH /network-interfaces/iface_1 HTTP/1.1
41+
Host: localhost
42+
Content-Type: application/json
43+
Accept: application/json
44+
45+
{
46+
"iface_id": "iface_1",
47+
"rx_rate_limiter": {
48+
"bandwidth": {
49+
"size": 1048576,
50+
"refill_time": 1000
51+
},
52+
"ops": {
53+
"size": 2000,
54+
"refill_time": 1000
55+
}
56+
}
57+
```
58+
59+
The full specification of the data structures available for this call can be
60+
found in our [OpenAPI spec](../../api_server/swagger/firecracker.yaml).
61+
62+
**Note**: The data provided for the update is merged with the existing data.
63+
In the above example, the RX rate limit is updated, but the TX rate limit
64+
remains unchanged.
65+
66+
67+
# Removing Rate Limiting
68+
69+
A rate limit can be disabled by providing a 0-sized token bucket. E.g.,
70+
following the above example, the TX rate limit can be disabled with:
71+
72+
73+
```
74+
PATCH /network-interfaces/iface_1 HTTP/1.1
75+
Host: localhost
76+
Content-Type: application/json
77+
Accept: application/json
78+
79+
{
80+
"iface_id": "iface_1",
81+
"tx_rate_limiter": {
82+
"bandwidth": {
83+
"size": 0,
84+
"refill_time": 0
85+
},
86+
"ops": {
87+
"size": 0,
88+
"refill_time": 0
89+
}
90+
}
91+
```

0 commit comments

Comments
 (0)