* [PATCH 0/3] Improved reporting for migrate parameters
@ 2020-03-29 5:01 Mao Zhongyi
2020-03-29 5:01 ` [PATCH 1/3] migration/migration: improve error " Mao Zhongyi
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Mao Zhongyi @ 2020-03-29 5:01 UTC (permalink / raw)
To: qemu-devel; +Cc: dgilbert, Mao Zhongyi, quintela
This series mainly improve the report message of migrate parameters
to make it easier to read.
Cc: quintela@redhat.com
Cc: dgilbert@redhat.com
Mao Zhongyi (3):
migration/migration: improve error reporting for migrate parameters
monitor/hmp-cmds: add hmp_handle_error() for hmp_migrate_set_speed()
migration: move the units of migrate parameters from milliseconds to
ms.
migration/migration.c | 17 +++++++++--------
monitor/hmp-cmds.c | 13 ++++++++-----
2 files changed, 17 insertions(+), 13 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] migration/migration: improve error reporting for migrate parameters
2020-03-29 5:01 [PATCH 0/3] Improved reporting for migrate parameters Mao Zhongyi
@ 2020-03-29 5:01 ` Mao Zhongyi
2020-03-30 12:05 ` Juan Quintela
2020-03-29 5:01 ` [PATCH 2/3] monitor/hmp-cmds: add hmp_handle_error() for hmp_migrate_set_speed() Mao Zhongyi
2020-03-29 5:01 ` [PATCH 3/3] migration: move the units of migrate parameters from milliseconds to ms Mao Zhongyi
2 siblings, 1 reply; 7+ messages in thread
From: Mao Zhongyi @ 2020-03-29 5:01 UTC (permalink / raw)
To: qemu-devel; +Cc: dgilbert, Mao Zhongyi, quintela
use QERR_INVALID_PARAMETER_VALUE instead of
"Parameter '%s' expects" for consistency.
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
---
migration/migration.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 2b7b5bccfa..e0223f3b15 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1202,16 +1202,17 @@ 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 '2^64 - 1' 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 2000000 milliseconds");
return false;
}
@@ -2108,9 +2109,9 @@ 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 2000 seconds");
return;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] monitor/hmp-cmds: add hmp_handle_error() for hmp_migrate_set_speed()
2020-03-29 5:01 [PATCH 0/3] Improved reporting for migrate parameters Mao Zhongyi
2020-03-29 5:01 ` [PATCH 1/3] migration/migration: improve error " Mao Zhongyi
@ 2020-03-29 5:01 ` Mao Zhongyi
2020-03-30 12:07 ` Juan Quintela
2020-03-29 5:01 ` [PATCH 3/3] migration: move the units of migrate parameters from milliseconds to ms Mao Zhongyi
2 siblings, 1 reply; 7+ messages in thread
From: Mao Zhongyi @ 2020-03-29 5:01 UTC (permalink / raw)
To: qemu-devel; +Cc: dgilbert, Mao Zhongyi, quintela
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
---
monitor/hmp-cmds.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 790fad3afe..63097ddcc8 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1203,8 +1203,11 @@ void hmp_migrate_set_cache_size(Monitor *mon, const QDict *qdict)
/* Kept for backwards compatibility */
void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict)
{
+ Error *err = NULL;
+
int64_t value = qdict_get_int(qdict, "value");
- qmp_migrate_set_speed(value, NULL);
+ qmp_migrate_set_speed(value, &err);
+ hmp_handle_error(mon, err);
}
void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict)
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] migration: move the units of migrate parameters from milliseconds to ms.
2020-03-29 5:01 [PATCH 0/3] Improved reporting for migrate parameters Mao Zhongyi
2020-03-29 5:01 ` [PATCH 1/3] migration/migration: improve error " Mao Zhongyi
2020-03-29 5:01 ` [PATCH 2/3] monitor/hmp-cmds: add hmp_handle_error() for hmp_migrate_set_speed() Mao Zhongyi
@ 2020-03-29 5:01 ` Mao Zhongyi
2020-03-30 12:08 ` Juan Quintela
2 siblings, 1 reply; 7+ messages in thread
From: Mao Zhongyi @ 2020-03-29 5:01 UTC (permalink / raw)
To: qemu-devel; +Cc: dgilbert, Mao Zhongyi, quintela
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Suggested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/migration.c | 2 +-
monitor/hmp-cmds.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index e0223f3b15..d014da388a 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1212,7 +1212,7 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
(params->downtime_limit > MAX_MIGRATE_DOWNTIME)) {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
"downtime_limit",
- "an integer in the range of 0 to 2000000 milliseconds");
+ "an integer in the range of 0 to 2000000 ms");
return false;
}
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 63097ddcc8..c5de8af1ee 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -231,18 +231,18 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "\n");
}
- monitor_printf(mon, "total time: %" PRIu64 " milliseconds\n",
+ monitor_printf(mon, "total time: %" PRIu64 " ms\n",
info->total_time);
if (info->has_expected_downtime) {
- monitor_printf(mon, "expected downtime: %" PRIu64 " milliseconds\n",
+ monitor_printf(mon, "expected downtime: %" PRIu64 " ms\n",
info->expected_downtime);
}
if (info->has_downtime) {
- monitor_printf(mon, "downtime: %" PRIu64 " milliseconds\n",
+ monitor_printf(mon, "downtime: %" PRIu64 " ms\n",
info->downtime);
}
if (info->has_setup_time) {
- monitor_printf(mon, "setup: %" PRIu64 " milliseconds\n",
+ monitor_printf(mon, "setup: %" PRIu64 " ms\n",
info->setup_time);
}
}
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] migration/migration: improve error reporting for migrate parameters
2020-03-29 5:01 ` [PATCH 1/3] migration/migration: improve error " Mao Zhongyi
@ 2020-03-30 12:05 ` Juan Quintela
0 siblings, 0 replies; 7+ messages in thread
From: Juan Quintela @ 2020-03-30 12:05 UTC (permalink / raw)
To: Mao Zhongyi; +Cc: qemu-devel, dgilbert
Mao Zhongyi <maozhongyi@cmss.chinamobile.com> wrote:
> use QERR_INVALID_PARAMETER_VALUE instead of
> "Parameter '%s' expects" for consistency.
I agree with the idea.
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> ---
> migration/migration.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 2b7b5bccfa..e0223f3b15 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1202,16 +1202,17 @@ 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 '2^64 - 1' bytes/second");
> return false;
> }
You are inlining the constants. What about:
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
"max_bandwidth",
"an integer in the range of 0 to '" stringify(SIZE_MAX)
"'bytes/second");
Same for the others.
Thanks, Juan.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] monitor/hmp-cmds: add hmp_handle_error() for hmp_migrate_set_speed()
2020-03-29 5:01 ` [PATCH 2/3] monitor/hmp-cmds: add hmp_handle_error() for hmp_migrate_set_speed() Mao Zhongyi
@ 2020-03-30 12:07 ` Juan Quintela
0 siblings, 0 replies; 7+ messages in thread
From: Juan Quintela @ 2020-03-30 12:07 UTC (permalink / raw)
To: Mao Zhongyi; +Cc: qemu-devel, dgilbert
Mao Zhongyi <maozhongyi@cmss.chinamobile.com> wrote:
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] migration: move the units of migrate parameters from milliseconds to ms.
2020-03-29 5:01 ` [PATCH 3/3] migration: move the units of migrate parameters from milliseconds to ms Mao Zhongyi
@ 2020-03-30 12:08 ` Juan Quintela
0 siblings, 0 replies; 7+ messages in thread
From: Juan Quintela @ 2020-03-30 12:08 UTC (permalink / raw)
To: Mao Zhongyi; +Cc: qemu-devel, dgilbert
Mao Zhongyi <maozhongyi@cmss.chinamobile.com> wrote:
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Suggested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
I don't really care one way or another. But I agree that consistence is good.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-03-30 12:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-29 5:01 [PATCH 0/3] Improved reporting for migrate parameters Mao Zhongyi
2020-03-29 5:01 ` [PATCH 1/3] migration/migration: improve error " Mao Zhongyi
2020-03-30 12:05 ` Juan Quintela
2020-03-29 5:01 ` [PATCH 2/3] monitor/hmp-cmds: add hmp_handle_error() for hmp_migrate_set_speed() Mao Zhongyi
2020-03-30 12:07 ` Juan Quintela
2020-03-29 5:01 ` [PATCH 3/3] migration: move the units of migrate parameters from milliseconds to ms Mao Zhongyi
2020-03-30 12:08 ` Juan Quintela
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).