The QERR_INVALID_PARAMETER_VALUE macro is documented as not to be used
in new code. Remove the usage from migration/options.c.
Signed-off-by: Fabiano Rosas <farosas@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 45e15ffeb6..031a5f8ede 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2302,8 +2302,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 190001f8ac..e2e3ab717f 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -1043,120 +1043,105 @@ bool migrate_params_check(MigrationParameters *params, Error **errp)
if (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;
}
if (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;
}
if (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->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;
}
if (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;
}
if (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->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->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;
}
if (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->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;
}
if (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;
}
if (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->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->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->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->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 (!check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, errp)) {
@@ -1184,8 +1169,7 @@ bool migrate_params_check(MigrationParameters *params, Error **errp)
if (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 22e462bf72..028358ef0d 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -191,8 +191,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