On Tue, Aug 22, 2017 at 01:15:34PM +0300, Manos Pitsidianakis wrote: > @@ -3095,6 +3096,20 @@ > '*tls-creds': 'str' } } > > ## > +# @BlockdevOptionsThrottle: > +# > +# Driver specific block device options for the throttle driver > +# > +# @throttle-group: the name of the throttle-group object to use. It > +# must already exist. > +# @file: reference to or definition of the data source block > device > +# Since: 2.11 > +## > +{ 'struct': 'BlockdevOptionsThrottle', > + 'data': { '*throttle-group': 'str',
This field is optional but: group_name = qemu_opt_get(opts, QEMU_OPT_THROTTLE_GROUP_NAME); if (!group_name) { error_setg(errp, "Please specify a throttle group."); ret = EINVAL; goto fin; Should it be mandatory? > + 'file' : 'BlockdevRef' > + } } > +## > # @BlockdevOptions: > # > # Options for creating a block device. Many options are available for all > @@ -3155,6 +3170,7 @@ > 'replication':'BlockdevOptionsReplication', > 'sheepdog': 'BlockdevOptionsSheepdog', > 'ssh': 'BlockdevOptionsSsh', > + 'throttle': 'BlockdevOptionsThrottle', > 'vdi': 'BlockdevOptionsGenericFormat', > 'vhdx': 'BlockdevOptionsGenericFormat', > 'vmdk': 'BlockdevOptionsGenericCOWFormat', > diff --git a/include/block/throttle-groups.h b/include/block/throttle-groups.h > index 82f030523f..ec969e84fe 100644 > --- a/include/block/throttle-groups.h > +++ b/include/block/throttle-groups.h > @@ -76,5 +76,6 @@ void coroutine_fn > throttle_group_co_io_limits_intercept(ThrottleGroupMember *tgm > void throttle_group_attach_aio_context(ThrottleGroupMember *tgm, > AioContext *new_context); > void throttle_group_detach_aio_context(ThrottleGroupMember *tgm); > +bool throttle_group_exists(const char *name); > > #endif > diff --git a/include/qemu/throttle-options.h b/include/qemu/throttle-options.h > index 182b7896e1..3528a8f4a2 100644 > --- a/include/qemu/throttle-options.h > +++ b/include/qemu/throttle-options.h > @@ -29,6 +29,7 @@ > #define QEMU_OPT_BPS_WRITE_MAX "bps-write-max" > #define QEMU_OPT_BPS_WRITE_MAX_LENGTH "bps-write-max-length" > #define QEMU_OPT_IOPS_SIZE "iops-size" > +#define QEMU_OPT_THROTTLE_GROUP_NAME "throttle-group" > > #define THROTTLE_OPT_PREFIX "throttling." > #define THROTTLE_OPTS \ > diff --git a/block/throttle-groups.c b/block/throttle-groups.c > index a4268a954e..4b483a16d4 100644 > --- a/block/throttle-groups.c > +++ b/block/throttle-groups.c > @@ -101,7 +101,7 @@ static ThrottleGroup *throttle_group_by_name(const char > *name) > return NULL; > } > /* Must be called with the global mutex held */ > -static bool throttle_group_exists(const char *name) > +bool throttle_group_exists(const char *name) > { > return throttle_group_by_name(name) ? true : false; > }