[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [RFC PATCH 18/56] migration: Make parameter max-bandwidth u
From: |
Markus Armbruster |
Subject: |
[Qemu-block] [RFC PATCH 18/56] migration: Make parameter max-bandwidth unsigned in QAPI/QMP |
Date: |
Mon, 7 Aug 2017 16:45:22 +0200 |
Byte rates should use QAPI type 'size' (uint64_t).
migrate_set_speed's parameter @value and member @max-bandwidth of
MigrationParameters and MigrateSetParameters are 'int' (int64_t).
Change them all to 'size'.
migrate_set_speed and migrate-set-parameters now accept bandwidth
values between 2^63 and SIZE_MAX (commonly 2^64-1). They accept
negative values as before, because that's how the QObject input
visitor works for backward compatibility.
So does HMP's migrate_set_speed, except it continues to reject
negative values.
query-migrate-parameters now reports bandwidth values above 2^63-1
correctly instead of their (negative) two's complement.
So does HMP's "info migrate_params".
Signed-off-by: Markus Armbruster <address@hidden>
---
hmp.c | 2 +-
migration/migration.c | 9 ++++-----
qapi-schema.json | 6 +++---
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/hmp.c b/hmp.c
index 184fb8b..9bcdcb3 100644
--- a/hmp.c
+++ b/hmp.c
@@ -322,7 +322,7 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict
*qdict)
MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME],
params->tls_hostname);
assert(params->has_max_bandwidth);
- monitor_printf(mon, "%s: %" PRId64 " bytes/second\n",
+ monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n",
MigrationParameter_lookup[MIGRATION_PARAMETER_MAX_BANDWIDTH],
params->max_bandwidth);
assert(params->has_downtime_limit);
diff --git a/migration/migration.c b/migration/migration.c
index 2d7f3a2..0b47371 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -716,8 +716,7 @@ static bool migrate_params_check(MigrationParameters
*params, Error **errp)
return false;
}
- if (params->has_max_bandwidth &&
- (params->max_bandwidth < 0 || params->max_bandwidth > SIZE_MAX)) {
+ if (params->has_max_bandwidth && params->max_bandwidth > SIZE_MAX) {
error_setg(errp, "Parameter 'max_bandwidth' expects an integer in the"
" range of 0 to %zu bytes/second", SIZE_MAX);
return false;
@@ -1311,7 +1310,7 @@ uint64_t qmp_query_migrate_cache_size(Error **errp)
return migrate_xbzrle_cache_size();
}
-void qmp_migrate_set_speed(int64_t value, Error **errp)
+void qmp_migrate_set_speed(uint64_t value, Error **errp)
{
MigrateSetParameters p = {
.has_max_bandwidth = true,
@@ -2179,8 +2178,8 @@ static Property migration_properties[] = {
DEFINE_PROP_INT64("x-cpu-throttle-increment", MigrationState,
parameters.cpu_throttle_increment,
DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT),
- DEFINE_PROP_INT64("x-max-bandwidth", MigrationState,
- parameters.max_bandwidth, MAX_THROTTLE),
+ DEFINE_PROP_UINT64("x-max-bandwidth", MigrationState,
+ parameters.max_bandwidth, MAX_THROTTLE),
DEFINE_PROP_INT64("x-downtime-limit", MigrationState,
parameters.downtime_limit,
DEFAULT_MIGRATE_SET_DOWNTIME),
diff --git a/qapi-schema.json b/qapi-schema.json
index 2eee676..c18e574 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1116,7 +1116,7 @@
'*cpu-throttle-increment': 'int',
'*tls-creds': 'StrOrNull',
'*tls-hostname': 'StrOrNull',
- '*max-bandwidth': 'int',
+ '*max-bandwidth': 'size',
'*downtime-limit': 'int',
'*x-checkpoint-delay': 'int',
'*block-incremental': 'bool' } }
@@ -1200,7 +1200,7 @@
'*cpu-throttle-increment': 'int',
'*tls-creds': 'str',
'*tls-hostname': 'str',
- '*max-bandwidth': 'int',
+ '*max-bandwidth': 'size',
'*downtime-limit': 'int',
'*x-checkpoint-delay': 'int',
'*block-incremental': 'bool' } }
@@ -2852,7 +2852,7 @@
# <- { "return": {} }
#
##
-{ 'command': 'migrate_set_speed', 'data': {'value': 'int'} }
+{ 'command': 'migrate_set_speed', 'data': {'value': 'size'} }
##
# @migrate-set-cache-size:
--
2.7.5
- [Qemu-block] [RFC PATCH 17/56] migration: Make MigrationStats sizes unsigned in QAPI/QMP, (continued)
- [Qemu-block] [RFC PATCH 17/56] migration: Make MigrationStats sizes unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 19/56] block: Make snapshot VM state size unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 21/56] block: Clean up get_human_readable_size(), Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 22/56] block: Mix up signed and unsigned less in bdrv_img_create(), Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 25/56] block/qcow2: Change qcow2_calc_prealloc_size() to uint64_t, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 02/56] qdict: New helpers to put and get unsigned integers, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 06/56] char: Don't truncate -chardev and HMP chardev-add ringbuf size, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 18/56] migration: Make parameter max-bandwidth unsigned in QAPI/QMP,
Markus Armbruster <=
- [Qemu-block] [RFC PATCH 15/56] migration: Make XBZRLE cache size unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 08/56] dump: Make sizes and addresses unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 24/56] block/qcow2: Change align_offset() to operate on uint64_t, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 10/56] hmp: Make balloon's argument unsigned, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 23/56] option: Fix type of qemu_opt_set_number() parameter @val, Markus Armbruster, 2017/08/07