diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2017-08-25 16:20:26 +0300 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-09-05 18:12:21 +0200 |
commit | 432d889e55e2614bd0e8bb559af18a61ac217565 (patch) | |
tree | e5ea15da8af7dd17a61903496924dc4c0807fa44 /include/qemu/throttle.h | |
parent | f738cfc843055238ad969782db69156929873832 (diff) | |
download | qemu-432d889e55e2614bd0e8bb559af18a61ac217565.zip qemu-432d889e55e2614bd0e8bb559af18a61ac217565.tar.gz qemu-432d889e55e2614bd0e8bb559af18a61ac217565.tar.bz2 |
block: convert ThrottleGroup to object with QOM
ThrottleGroup is converted to an object. This will allow the future
throttle block filter drive easy creation and configuration of throttle
groups in QMP and cli.
A new QAPI struct, ThrottleLimits, is introduced to provide a shared
struct for all throttle configuration needs in QMP.
ThrottleGroups can be created via CLI as
-object throttle-group,id=foo,x-iops-total=100,x-..
where x-* are individual limit properties. Since we can't add non-scalar
properties in -object this interface must be used instead. However,
setting these properties must be disabled after initialization because
certain combinations of limits are forbidden and thus configuration
changes should be done in one transaction. The individual properties
will go away when support for non-scalar values in CLI is implemented
and thus are marked as experimental.
ThrottleGroup also has a `limits` property that uses the ThrottleLimits
struct. It can be used to create ThrottleGroups or set the
configuration in existing groups as follows:
{ "execute": "object-add",
"arguments": {
"qom-type": "throttle-group",
"id": "foo",
"props" : {
"limits": {
"iops-total": 100
}
}
}
}
{ "execute" : "qom-set",
"arguments" : {
"path" : "foo",
"property" : "limits",
"value" : {
"iops-total" : 99
}
}
}
This also means a group's configuration can be fetched with qom-get.
Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/qemu/throttle.h')
-rw-r--r-- | include/qemu/throttle.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/qemu/throttle.h b/include/qemu/throttle.h index 8e01885..8c93237 100644 --- a/include/qemu/throttle.h +++ b/include/qemu/throttle.h @@ -152,5 +152,8 @@ bool throttle_schedule_timer(ThrottleState *ts, bool is_write); void throttle_account(ThrottleState *ts, bool is_write, uint64_t size); +void throttle_limits_to_config(ThrottleLimits *arg, ThrottleConfig *cfg, + Error **errp); +void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var); #endif |