- d = strtod(value, &ptr);
- if (!strcmp(ptr,"ms")) {
- d *= 1000000;
- } else if (!strcmp(ptr,"us")) {
- d *= 1000;
- } else if (!strcmp(ptr,"ns")) {
- } else {
- /* all else considered to be seconds */
- d *= 1000000000;
+ d = qdict_get_double(qdict, "value") * 1e9;
+ d = MAX(0, MIN(UINT64_MAX, d));
+ max_downtime = (uint64_t)d;
+
+ return 0;
+}
+
+static void migrate_print_status(Monitor *mon, const char *name,
+ const QDict *status_dict)
+{
+ QDict *qdict;
+
+ qdict = qobject_to_qdict(qdict_get(status_dict, name));
+
+ monitor_printf(mon, "transferred %s: %" PRIu64 " kbytes\n", name,
+ qdict_get_int(qdict, "transferred") >> 10);
+ monitor_printf(mon, "remaining %s: %" PRIu64 " kbytes\n", name,
+ qdict_get_int(qdict, "remaining") >> 10);
+ monitor_printf(mon, "total %s: %" PRIu64 " kbytes\n", name,
+ qdict_get_int(qdict, "total") >> 10);
+}
+
+void do_info_migrate_print(Monitor *mon, const QObject *data)
+{
+ QDict *qdict;
+
+ qdict = qobject_to_qdict(data);
+
+ monitor_printf(mon, "Migration status: %s\n",
+ qdict_get_str(qdict, "status"));
+
+ if (qdict_haskey(qdict, "ram")) {
+ migrate_print_status(mon, "ram", qdict);