From 5bb7910af031cce09cc619b982d39dc889776f65 Mon Sep 17 00:00:00 2001 From: aliguori Date: Mon, 13 Oct 2008 03:12:02 +0000 Subject: Introduce UI for live migration This patch introduces a command line parameter and monitor command for starting a live migration. The next patch will provide an example of how to use these parameters. Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5476 c046a42c-6fe2-441c-8c8c-71466251a162 --- migration.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 migration.c (limited to 'migration.c') diff --git a/migration.c b/migration.c new file mode 100644 index 0000000000..732fe3fe4c --- /dev/null +++ b/migration.c @@ -0,0 +1,83 @@ +/* + * QEMU live migration + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include "qemu-common.h" +#include "migration.h" +#include "console.h" + +/* Migration speed throttling */ +static uint32_t max_throttle = (32 << 20); + +static MigrationState *current_migration; + +void qemu_start_incoming_migration(const char *uri) +{ + fprintf(stderr, "unknown migration protocol: %s\n", uri); +} + +void do_migrate(int detach, const char *uri) +{ + term_printf("unknown migration protocol: %s\n", uri); +} + +void do_migrate_cancel(void) +{ + MigrationState *s = current_migration; + + if (s) + s->cancel(s); +} + +void do_migrate_set_speed(const char *value) +{ + double d; + char *ptr; + + d = strtod(value, &ptr); + switch (*ptr) { + case 'G': case 'g': + d *= 1024; + case 'M': case 'm': + d *= 1024; + case 'K': case 'k': + d *= 1024; + default: + break; + } + + max_throttle = (uint32_t)d; +} + +void do_info_migrate(void) +{ + MigrationState *s = current_migration; + + if (s) { + term_printf("Migration status: "); + switch (s->get_status(s)) { + case MIG_STATE_ACTIVE: + term_printf("active\n"); + break; + case MIG_STATE_COMPLETED: + term_printf("completed\n"); + break; + case MIG_STATE_ERROR: + term_printf("failed\n"); + break; + case MIG_STATE_CANCELLED: + term_printf("cancelled\n"); + break; + } + } +} + -- cgit v1.2.3