[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 1/3] migration/migration: improve error reporting for migrate
From: |
Mao Zhongyi |
Subject: |
[PATCH v2 1/3] migration/migration: improve error reporting for migrate parameters |
Date: |
Tue, 31 Mar 2020 16:22:05 +0800 |
use QERR_INVALID_PARAMETER_VALUE instead of
"Parameter '%s' expects" for consistency.
Signed-off-by: Mao Zhongyi <address@hidden>
---
migration/migration.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 2b7b5bccfa..5a6436d035 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1202,16 +1202,19 @@ static bool migrate_params_check(MigrationParameters
*params, Error **errp)
}
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);
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ "max_bandwidth",
+ "an integer in the range of 0 to "stringify(SIZE_MAX)
+ " bytes/second");
return false;
}
if (params->has_downtime_limit &&
(params->downtime_limit > MAX_MIGRATE_DOWNTIME)) {
- error_setg(errp, "Parameter 'downtime_limit' expects an integer in "
- "the range of 0 to %d milliseconds",
- MAX_MIGRATE_DOWNTIME);
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ "downtime_limit",
+ "an integer in the range of 0 to "
+ stringify(MAX_MIGRATE_DOWNTIME)" milliseconds");
return false;
}
@@ -2108,9 +2111,10 @@ void qmp_migrate_set_speed(int64_t value, Error **errp)
void qmp_migrate_set_downtime(double value, Error **errp)
{
if (value < 0 || value > MAX_MIGRATE_DOWNTIME_SECONDS) {
- error_setg(errp, "Parameter 'downtime_limit' expects an integer in "
- "the range of 0 to %d seconds",
- MAX_MIGRATE_DOWNTIME_SECONDS);
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ "downtime_limit",
+ "an integer in the range of 0 to "
+ stringify(MAX_MIGRATE_DOWNTIME_SECONDS)" seconds");
return;
}
--
2.17.1
- [PATCH v2 0/3] Improved reporting for migrate parameters, Mao Zhongyi, 2020/03/31
- [PATCH v2 3/3] migration: move the units of migrate parameters from milliseconds to ms, Mao Zhongyi, 2020/03/31
- [PATCH v2 2/3] monitor/hmp-cmds: add hmp_handle_error() for hmp_migrate_set_speed(), Mao Zhongyi, 2020/03/31
- [PATCH v2 1/3] migration/migration: improve error reporting for migrate parameters,
Mao Zhongyi <=
- Re: [PATCH v2 0/3] Improved reporting for migrate parameters, no-reply, 2020/03/31
- Re: [PATCH v2 0/3] Improved reporting for migrate parameters, no-reply, 2020/03/31
- Re: [PATCH v2 0/3] Improved reporting for migrate parameters, no-reply, 2020/03/31