Moving the default value logic from qmp handler to generated code.
Signed-off-by: Fam Zheng <[email protected]>
---
blockdev.c | 6 +-----
qapi-schema.json | 2 +-
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 7810e9f..de06218 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1869,7 +1869,7 @@ void qmp_block_stream(const char *device, bool has_base,
void qmp_block_commit(const char *device,
bool has_base, const char *base, const char *top,
- bool has_speed, int64_t speed,
+ int64_t speed,
Error **errp)
{
BlockDriverState *bs;
@@ -1880,10 +1880,6 @@ void qmp_block_commit(const char *device,
*/
BlockdevOnError on_error = BLOCKDEV_ON_ERROR_REPORT;
- if (!has_speed) {
- speed = 0;
- }
-
/* drain all i/o before commits */
bdrv_drain_all();
diff --git a/qapi-schema.json b/qapi-schema.json
index 36cb964..06e373c 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2129,7 +2129,7 @@
##
{ 'command': 'block-commit',
'data': { 'device': 'str', '*base': 'str', 'top': 'str',
- '*speed': 'int' } }
+ '@speed': { 'type': 'int', 'optional': true, 'default': 0 } } }
##
# @drive-backup
--
1.9.2