From 432d889e55e2614bd0e8bb559af18a61ac217565 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Fri, 25 Aug 2017 16:20:26 +0300 Subject: 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 Reviewed-by: Stefan Hajnoczi Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf --- tests/test-throttle.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/test-throttle.c') diff --git a/tests/test-throttle.c b/tests/test-throttle.c index e3a45cc605..948a42c991 100644 --- a/tests/test-throttle.c +++ b/tests/test-throttle.c @@ -739,6 +739,7 @@ int main(int argc, char **argv) qemu_init_main_loop(&error_fatal); ctx = qemu_get_aio_context(); bdrv_init(); + module_call_init(MODULE_INIT_QOM); do {} while (g_main_context_iteration(NULL, false)); -- cgit v1.2.3