-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5476 c046a42c-6fe2-441c-8c8c-71466251a162
- Loading branch information
aliguori
committed
Oct 13, 2008
1 parent
39b65c2
commit 5bb7910
Showing
6 changed files
with
150 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* QEMU live migration | ||
* | ||
* Copyright IBM, Corp. 2008 | ||
* | ||
* Authors: | ||
* Anthony Liguori <aliguori@us.ibm.com> | ||
* | ||
* 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; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* QEMU live migration | ||
* | ||
* Copyright IBM, Corp. 2008 | ||
* | ||
* Authors: | ||
* Anthony Liguori <aliguori@us.ibm.com> | ||
* | ||
* This work is licensed under the terms of the GNU GPL, version 2. See | ||
* the COPYING file in the top-level directory. | ||
* | ||
*/ | ||
|
||
#ifndef QEMU_MIGRATION_H | ||
#define QEMU_MIGRATION_H | ||
|
||
#define MIG_STATE_ERROR -1 | ||
#define MIG_STATE_COMPLETED 0 | ||
#define MIG_STATE_CANCELLED 1 | ||
#define MIG_STATE_ACTIVE 2 | ||
|
||
typedef struct MigrationState MigrationState; | ||
|
||
struct MigrationState | ||
{ | ||
/* FIXME: add more accessors to print migration info */ | ||
void (*cancel)(MigrationState *s); | ||
int (*get_status)(MigrationState *s); | ||
void (*release)(MigrationState *s); | ||
}; | ||
|
||
void qemu_start_incoming_migration(const char *uri); | ||
|
||
void do_migrate(int detach, const char *uri); | ||
|
||
void do_migrate_cancel(void); | ||
|
||
void do_migrate_set_speed(const char *value); | ||
|
||
void do_info_migrate(void); | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters