qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] Changing error message of QMP 'migrate_set_downtime' to seconds
@ 2017-02-20 16:03 Daniel Henrique Barboza
  2017-02-21  9:02 ` Markus Armbruster
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Henrique Barboza @ 2017-02-20 16:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: quintela, dgilbert

The previous error message was displaying the values in miliseconds,
being misleading with the command that accepts the value in seconds:

{ "execute": "migrate_set_downtime", "arguments": {"value": 3000}}
{"error": {"class": "GenericError", "desc": "Parameter 'downtime_limit'
expects an integer in the range of 0 to 2000000 milliseconds"}}

This patch changes it to '2000 seconds' to keep consistency with
the expected parameter. The macro 'QERR_INVALID_PARAMETER_VALUE'
was changed for a regular string that allows the use of the
MAX_MIGRATE_SET_DOWNTIME as a parameter, instead of hardcoding
the value in the error message.

Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
---
 migration/migration.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index c6ae69d..c05e764 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -49,6 +49,9 @@
  * for sending the last part */
 #define DEFAULT_MIGRATE_SET_DOWNTIME 300
 
+/* Maximum migrate downtime set to 2000*1000 miliseconds */
+#define MAX_MIGRATE_SET_DOWNTIME (2000 * 1000)
+
 /* Default compression thread count */
 #define DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT 8
 /* Default decompression thread count, usually decompression is at
@@ -843,10 +846,11 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp)
         return;
     }
     if (params->has_downtime_limit &&
-        (params->downtime_limit < 0 || params->downtime_limit > 2000000)) {
-        error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
-                   "downtime_limit",
-                   "an integer in the range of 0 to 2000000 milliseconds");
+        (params->downtime_limit < 0 ||
+         params->downtime_limit > MAX_MIGRATE_SET_DOWNTIME)) {
+        error_setg(errp, "Parameter 'downtime_limit' expects an integer in "
+                         "the range of 0 to %d seconds",
+                         MAX_MIGRATE_SET_DOWNTIME / 1000);
         return;
     }
     if (params->has_x_checkpoint_delay && (params->x_checkpoint_delay < 0)) {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-02-21 21:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-20 16:03 [Qemu-devel] [PATCH v2] Changing error message of QMP 'migrate_set_downtime' to seconds Daniel Henrique Barboza
2017-02-21  9:02 ` Markus Armbruster
2017-02-21 13:31   ` Daniel Henrique Barboza
2017-02-21 13:54     ` Juan Quintela
2017-02-21 14:15     ` Markus Armbruster
2017-02-21 14:32       ` Dr. David Alan Gilbert
2017-02-21 15:47         ` Markus Armbruster
2017-02-21 21:49           ` Daniel Henrique Barboza

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).