From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M9lC3-0005Z4-8K for qemu-devel@nongnu.org; Thu, 28 May 2009 15:23:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M9lBy-0005T6-3H for qemu-devel@nongnu.org; Thu, 28 May 2009 15:23:10 -0400 Received: from [199.232.76.173] (port=38453 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M9lBx-0005Sv-Va for qemu-devel@nongnu.org; Thu, 28 May 2009 15:23:06 -0400 Received: from mx2.redhat.com ([66.187.237.31]:45693) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M9lBx-0001Oc-2R for qemu-devel@nongnu.org; Thu, 28 May 2009 15:23:05 -0400 From: Glauber Costa Date: Thu, 28 May 2009 15:22:58 -0400 Message-Id: <1243538578-28581-3-git-send-email-glommer@redhat.com> In-Reply-To: <1243538578-28581-2-git-send-email-glommer@redhat.com> References: <1243538578-28581-1-git-send-email-glommer@redhat.com> <1243538578-28581-2-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] set migration max downtime List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com provide a monitor command to allow one to set the maximum downtime he is willing to suffer during migration, in seconds. "ms", "us", "ns" and "s" are accepted as modifiers. This parameter will be used by ram_save_live() code to determine a safe moment to enter stage 3 Signed-off-by: Glauber Costa --- migration.c | 19 +++++++++++++++++++ migration.h | 2 ++ monitor.c | 2 ++ 3 files changed, 23 insertions(+), 0 deletions(-) diff --git a/migration.c b/migration.c index 754c2fa..5c62eee 100644 --- a/migration.c +++ b/migration.c @@ -118,6 +118,25 @@ uint64_t migrate_max_downtime(void) return max_downtime; } +void do_migrate_set_downtime(Monitor *mon, const char *value) +{ + char *ptr; + double d; + + 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; + } + + max_downtime = (uint64_t)d; +} + void do_info_migrate(Monitor *mon) { MigrationState *s = current_migration; diff --git a/migration.h b/migration.h index 0596f24..37c7f8e 100644 --- a/migration.h +++ b/migration.h @@ -57,6 +57,8 @@ void do_migrate_set_speed(Monitor *mon, const char *value); uint64_t migrate_max_downtime(void); +void do_migrate_set_downtime(Monitor *mon, const char *value); + void do_info_migrate(Monitor *mon); int exec_start_incoming_migration(const char *host_port); diff --git a/monitor.c b/monitor.c index 0f38c71..55b09c3 100644 --- a/monitor.c +++ b/monitor.c @@ -1744,6 +1744,8 @@ static const mon_cmd_t mon_cmds[] = { "", "cancel the current VM migration" }, { "migrate_set_speed", "s", do_migrate_set_speed, "value", "set maximum speed (in bytes) for migrations" }, + { "migrate_set_downtime", "s", do_migrate_set_downtime, + "value", "set maximum tolerated downtime (in seconds) for migrations" }, #if defined(TARGET_I386) { "drive_add", "ss", drive_hot_add, "pci_addr=[[:]:]\n" "[file=file][,if=type][,bus=n]\n" -- 1.5.6.6