|
| 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