Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > aadbe78a25743146bb784eee19f007c5 > files > 575

kvm-83-164.el5_5.9.src.rpm

From 6b5382a68731b9531eb37ebec9487028bf358ffb Mon Sep 17 00:00:00 2001
From: Glauber Costa <glommer@redhat.com>
Date: Tue, 2 Jun 2009 09:10:09 -0400
Subject: [PATCH 4/4] set migration max downtime

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 <glommer@redhat.com>
RH-Upstream-status: pending (qemu)
Message-Id: <1243948209-24257-3-git-send-email-glommer@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Obsoletes: <1243925661-21880-3-git-send-email-glommer@redhat.com>
Acked-by: Dor Laor <dlaor@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
Acked-by: "Michael S. Tsirkin" <mst@redhat.com>
Bugzilla: 504237
---
 qemu/migration.c |   19 +++++++++++++++++++
 qemu/migration.h |    2 ++
 qemu/monitor.c   |    2 ++
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/qemu/migration.c b/qemu/migration.c
index a82cd61..415d693 100644
--- a/qemu/migration.c
+++ b/qemu/migration.c
@@ -119,6 +119,25 @@ uint64_t migrate_max_downtime(void)
     return max_downtime;
 }
 
+void do_migrate_set_downtime(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(void)
 {
     MigrationState *s = current_migration;
diff --git a/qemu/migration.h b/qemu/migration.h
index 03a500b..0cd03b9 100644
--- a/qemu/migration.h
+++ b/qemu/migration.h
@@ -57,6 +57,8 @@ void do_migrate_set_speed(const char *value);
 
 uint64_t migrate_max_downtime(void);
 
+void do_migrate_set_downtime(const char *value);
+
 void do_info_migrate(void);
 
 int exec_start_incoming_migration(const char *host_port);
diff --git a/qemu/monitor.c b/qemu/monitor.c
index 2bf8e78..c627656 100644
--- a/qemu/monitor.c
+++ b/qemu/monitor.c
@@ -1626,6 +1626,8 @@ static term_cmd_t term_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" },
     { "balloon", "i", do_balloon,
       "target", "request VM to change it's memory allocation (in MB)" },
     { "set_link", "ss", do_set_link, "name [up|down]" },
-- 
1.6.3.rc4.29.g8146