vmm: use RateLimiterGroup for virtio-blk devices

Add a 'rate_limit_groups' field to VmConfig that defines a set of
named RateLimiterGroups.

When the 'rate_limit_group' field of DiskConfig is defined, all
virtio-blk queues will be rate-limited by a shared RateLimiterGroup.
The lifecycle of all RateLimiterGroups is tied to the Vm.
A RateLimiterGroup may exist even if no Disks are configured to use
the RateLimiterGroup. Disks may be hot-added or hot-removed from the
RateLimiterGroup.

When the 'rate_limiter' field of DiskConfig is defined, we construct
an anonymous RateLimiterGroup whose lifecycle is tied to the Disk.
This is primarily done for api backwards compatability. Importantly,
the behavior is not the same! This implementation rate_limits the
aggregate bandwidth / iops of an individual disk rather than the
bandwidth / iops of an individual queue of a disk.

When neither the 'rate_limit_group' or the 'rate_limiter' fields of
DiskConfig is defined, the Disk is not rate-limited.

Signed-off-by: Thomas Barrett <tbarrett@crusoeenergy.com>
This commit is contained in:
Thomas Barrett
2023-12-07 19:45:08 +00:00
committed by Bo Chen
parent c71da496c0
commit c297d8d796
10 changed files with 358 additions and 18 deletions

View File

@@ -554,6 +554,10 @@ components:
$ref: "#/components/schemas/MemoryConfig"
payload:
$ref: "#/components/schemas/PayloadConfig"
rate_limit_groups:
type: array
items:
$ref: "#/components/schemas/RateLimitGroupConfig"
disks:
type: array
items:
@@ -812,6 +816,17 @@ components:
Defines an IO rate limiter with independent bytes/s and ops/s limits.
Limits are defined by configuring each of the _bandwidth_ and _ops_ token buckets.
RateLimitGroupConfig:
required:
- id
- rate_limiter_config
type: object
properties:
id:
type: string
rate_limiter_config:
$ref: "#/components/schemas/RateLimiterConfig"
DiskConfig:
required:
- path
@@ -848,6 +863,8 @@ components:
type: string
serial:
type: string
rate_limit_group:
type: string
NetConfig:
type: object