4 * Copyright IBM, Corp. 2008
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #include "qemu-common.h"
15 #include "migration.h"
18 /* Migration speed throttling */
19 static uint32_t max_throttle
= (32 << 20);
21 static MigrationState
*current_migration
;
23 void qemu_start_incoming_migration(const char *uri
)
27 if (strstart(uri
, "tcp:", &p
))
28 tcp_start_incoming_migration(p
);
30 fprintf(stderr
, "unknown migration protocol: %s\n", uri
);
33 void do_migrate(int detach
, const char *uri
)
35 MigrationState
*s
= NULL
;
38 if (strstart(uri
, "tcp:", &p
))
39 s
= tcp_start_outgoing_migration(p
, max_throttle
, detach
);
41 term_printf("unknown migration protocol: %s\n", uri
);
44 term_printf("migration failed\n");
46 if (current_migration
)
47 current_migration
->release(current_migration
);
49 current_migration
= s
;
53 void do_migrate_cancel(void)
55 MigrationState
*s
= current_migration
;
61 void do_migrate_set_speed(const char *value
)
66 d
= strtod(value
, &ptr
);
78 max_throttle
= (uint32_t)d
;
81 void do_info_migrate(void)
83 MigrationState
*s
= current_migration
;
86 term_printf("Migration status: ");
87 switch (s
->get_status(s
)) {
88 case MIG_STATE_ACTIVE
:
89 term_printf("active\n");
91 case MIG_STATE_COMPLETED
:
92 term_printf("completed\n");
95 term_printf("failed\n");
97 case MIG_STATE_CANCELLED
:
98 term_printf("cancelled\n");