aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-11-28 11:59:37 -0200
committerLuiz Capitulino <lcapitulino@redhat.com>2011-12-06 11:40:01 -0200
commit3dc853832db7bf8ac3878e0666c639d3bc02b587 (patch)
tree3a7cfd6a4412b73c1cedde073c18f8bb1be0b274
parent4f0a993bf349e61632113a11e85ef588c66b421d (diff)
downloadqemu-3dc853832db7bf8ac3878e0666c639d3bc02b587.zip
qemu-3dc853832db7bf8ac3878e0666c639d3bc02b587.tar.gz
qemu-3dc853832db7bf8ac3878e0666c639d3bc02b587.tar.bz2
qapi: Convert migrate_set_speed
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
-rw-r--r--hmp-commands.hx3
-rw-r--r--hmp.c6
-rw-r--r--hmp.h1
-rw-r--r--migration.c12
-rw-r--r--migration.h2
-rw-r--r--qapi-schema.json15
-rw-r--r--qmp-commands.hx5
7 files changed, 28 insertions, 16 deletions
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 6ba694d..fdbed15 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -786,8 +786,7 @@ ETEXI
.params = "value",
.help = "set maximum speed (in bytes) for migrations. "
"Defaults to MB if no size suffix is specified, ie. B/K/M/G/T",
- .user_print = monitor_user_noop,
- .mhandler.cmd_new = do_migrate_set_speed,
+ .mhandler.cmd = hmp_migrate_set_speed,
},
STEXI
diff --git a/hmp.c b/hmp.c
index 04e6b73..e7659d5 100644
--- a/hmp.c
+++ b/hmp.c
@@ -673,3 +673,9 @@ void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict)
double value = qdict_get_double(qdict, "value");
qmp_migrate_set_downtime(value, NULL);
}
+
+void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict)
+{
+ int64_t value = qdict_get_int(qdict, "value");
+ qmp_migrate_set_speed(value, NULL);
+}
diff --git a/hmp.h b/hmp.h
index 9182622..093242d 100644
--- a/hmp.h
+++ b/hmp.h
@@ -48,5 +48,6 @@ void hmp_block_resize(Monitor *mon, const QDict *qdict);
void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict);
void hmp_migrate_cancel(Monitor *mon, const QDict *qdict);
void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict);
+void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict);
#endif
diff --git a/migration.c b/migration.c
index a563162..75d4f02 100644
--- a/migration.c
+++ b/migration.c
@@ -473,21 +473,17 @@ void qmp_migrate_cancel(Error **errp)
migrate_fd_cancel(migrate_get_current());
}
-int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data)
+void qmp_migrate_set_speed(int64_t value, Error **errp)
{
- int64_t d;
MigrationState *s;
- d = qdict_get_int(qdict, "value");
- if (d < 0) {
- d = 0;
+ if (value < 0) {
+ value = 0;
}
s = migrate_get_current();
- s->bandwidth_limit = d;
+ s->bandwidth_limit = value;
qemu_file_set_rate_limit(s->file, s->bandwidth_limit);
-
- return 0;
}
void qmp_migrate_set_downtime(double value, Error **errp)
diff --git a/migration.h b/migration.h
index 539f8f1..999d60f 100644
--- a/migration.h
+++ b/migration.h
@@ -42,8 +42,6 @@ int qemu_start_incoming_migration(const char *uri);
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data);
-int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data);
-
uint64_t migrate_max_downtime(void);
void do_info_migrate_print(Monitor *mon, const QObject *data);
diff --git a/qapi-schema.json b/qapi-schema.json
index d9b9fa1..f358b49 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1153,3 +1153,18 @@
# Since: 0.14.0
##
{ 'command': 'migrate_set_downtime', 'data': {'value': 'number'} }
+
+##
+# @migrate_set_speed
+#
+# Set maximum speed for migration.
+#
+# @value: maximum speed in bytes.
+#
+# Returns: nothing on success
+#
+# Notes: A value lesser than zero will be automatically round up to zero.
+#
+# Since: 0.14.0
+##
+{ 'command': 'migrate_set_speed', 'data': {'value': 'int'} }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index b4cadeb..002e7e8 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -492,10 +492,7 @@ EQMP
{
.name = "migrate_set_speed",
.args_type = "value:o",
- .params = "value",
- .help = "set maximum speed (in bytes) for migrations",
- .user_print = monitor_user_noop,
- .mhandler.cmd_new = do_migrate_set_speed,
+ .mhandler.cmd_new = qmp_marshal_input_migrate_set_speed,
},
SQMP