Now that we're removing mentions of 'parameters' from migration code, the "Parameter X expects..." message is a little confusing, although the "parameter" there refers to the QMP command parameter. There's also some instances which don't make sense grammatically.
Remove all the usage of QERR_INVALID_PARAMETER_VALUE. Signed-off-by: Fabiano Rosas <faro...@suse.de> --- migration/migration.c | 3 +-- migration/options.c | 56 +++++++++++++++--------------------------- migration/page_cache.c | 6 ++--- migration/ram.c | 3 +-- 4 files changed, 24 insertions(+), 44 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 9324d4f44e..8ca1383b46 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2281,8 +2281,7 @@ static void qmp_migrate_finish(MigrationAddress *addr, bool resume_requested, } else if (addr->transport == MIGRATION_ADDRESS_TYPE_FILE) { file_start_outgoing_migration(s, &addr->u.file, &local_err); } else { - error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "uri", - "a valid migration protocol"); + error_setg(&local_err, "uri is not a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); } diff --git a/migration/options.c b/migration/options.c index 7c41fbbce6..0bdd9e23f6 100644 --- a/migration/options.c +++ b/migration/options.c @@ -993,8 +993,7 @@ bool migrate_config_check(MigrationConfig *params, Error **errp) if (params->has_throttle_trigger_threshold && (params->throttle_trigger_threshold < 1 || params->throttle_trigger_threshold > 100)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "throttle_trigger_threshold", + error_setg(errp, "Option throttle_trigger_threshold expects " "an integer in the range of 1 to 100"); return false; } @@ -1002,8 +1001,7 @@ bool migrate_config_check(MigrationConfig *params, Error **errp) if (params->has_cpu_throttle_initial && (params->cpu_throttle_initial < 1 || params->cpu_throttle_initial > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_initial", + error_setg(errp, "Option cpu_throttle_initial expects " "an integer in the range of 1 to 99"); return false; } @@ -1011,15 +1009,13 @@ bool migrate_config_check(MigrationConfig *params, Error **errp) if (params->has_cpu_throttle_increment && (params->cpu_throttle_increment < 1 || params->cpu_throttle_increment > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_increment", + error_setg(errp, "Option cpu_throttle_increment expects " "an integer in the range of 1 to 99"); return false; } if (params->has_max_bandwidth && (params->max_bandwidth > SIZE_MAX)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_bandwidth", + error_setg(errp, "Option max_bandwidth expects " "an integer in the range of 0 to "stringify(SIZE_MAX) " bytes/second"); return false; @@ -1027,8 +1023,7 @@ bool migrate_config_check(MigrationConfig *params, Error **errp) if (params->has_avail_switchover_bandwidth && (params->avail_switchover_bandwidth > SIZE_MAX)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "avail_switchover_bandwidth", + error_setg(errp, "Option avail_switchover_bandwidth expects " "an integer in the range of 0 to "stringify(SIZE_MAX) " bytes/second"); return false; @@ -1036,25 +1031,21 @@ bool migrate_config_check(MigrationConfig *params, Error **errp) if (params->has_downtime_limit && (params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "downtime_limit", + error_setg(errp, "Option downtime_limit expects " "an integer in the range of 0 to " stringify(MAX_MIGRATE_DOWNTIME)" ms"); return false; } - /* x_checkpoint_delay is now always positive */ - if (params->has_multifd_channels && (params->multifd_channels < 1)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "multifd_channels", + error_setg(errp, "Option multifd_channels expects " "a value between 1 and 255"); return false; } if (params->has_multifd_zlib_level && (params->multifd_zlib_level > 9)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level", + error_setg(errp, "Option multifd_zlib_level expects " "a value between 0 and 9"); return false; } @@ -1062,14 +1053,14 @@ bool migrate_config_check(MigrationConfig *params, Error **errp) if (params->has_multifd_qatzip_level && ((params->multifd_qatzip_level > 9) || (params->multifd_qatzip_level < 1))) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_qatzip_level", + error_setg(errp, "Option multifd_qatzip_level expects " "a value between 1 and 9"); return false; } if (params->has_multifd_zstd_level && (params->multifd_zstd_level > 20)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level", + error_setg(errp, "Option multifd_zstd_level expects " "a value between 0 and 20"); return false; } @@ -1077,8 +1068,7 @@ bool migrate_config_check(MigrationConfig *params, Error **errp) if (params->has_xbzrle_cache_size && (params->xbzrle_cache_size < qemu_target_page_size() || !is_power_of_2(params->xbzrle_cache_size))) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "xbzrle_cache_size", + error_setg(errp, "Option xbzrle_cache_size expects " "a power of two no less than the target page size"); return false; } @@ -1086,40 +1076,35 @@ bool migrate_config_check(MigrationConfig *params, Error **errp) if (params->has_max_cpu_throttle && (params->max_cpu_throttle < params->cpu_throttle_initial || params->max_cpu_throttle > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_cpu_throttle", + error_setg(errp, "max_Option cpu_throttle expects " "an integer in the range of cpu_throttle_initial to 99"); return false; } if (params->has_announce_initial && params->announce_initial > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_initial", + error_setg(errp, "Option announce_initial expects " "a value between 0 and 100000"); return false; } if (params->has_announce_max && params->announce_max > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_max", + error_setg(errp, "Option announce_max expects " "a value between 0 and 100000"); - return false; + return false; } if (params->has_announce_rounds && params->announce_rounds > 1000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_rounds", + error_setg(errp, "Option announce_rounds expects " "a value between 0 and 1000"); - return false; + return false; } if (params->has_announce_step && (params->announce_step < 1 || params->announce_step > 10000)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_step", + error_setg(errp, "Option announce_step expects " "a value between 0 and 10000"); - return false; + return false; } if (params->has_block_bitmap_mapping && @@ -1148,8 +1133,7 @@ bool migrate_config_check(MigrationConfig *params, Error **errp) if (params->has_x_vcpu_dirty_limit_period && (params->x_vcpu_dirty_limit_period < 1 || params->x_vcpu_dirty_limit_period > 1000)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "x-vcpu-dirty-limit-period", + error_setg(errp, "Option x-vcpu-dirty-limit-period expects " "a value between 1 and 1000"); return false; } diff --git a/migration/page_cache.c b/migration/page_cache.c index 6d4f7a9bbc..650b15e48c 100644 --- a/migration/page_cache.c +++ b/migration/page_cache.c @@ -45,15 +45,13 @@ PageCache *cache_init(uint64_t new_size, size_t page_size, Error **errp) PageCache *cache; if (new_size < page_size) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "is smaller than one target page size"); + error_setg(errp, "cache size is smaller than target page size"); return NULL; } /* round down to the nearest power of 2 */ if (!is_power_of_2(num_pages)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "is not a power of two number of pages"); + error_setg(errp, "number of pages is not a power of two"); return NULL; } diff --git a/migration/ram.c b/migration/ram.c index b938bd621e..c7d122c4a0 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -161,8 +161,7 @@ int xbzrle_cache_resize(uint64_t new_size, Error **errp) /* Check for truncation */ if (new_size != (size_t)new_size) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", - "exceeding address space"); + error_setg(errp, "xbzrle cache size integer overflow"); return -1; } -- 2.35.3