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 <[EMAIL PROTECTED]> diff --git a/Makefile.target b/Makefile.target index 4b4cdd3..6bf5229 100644 --- a/Makefile.target +++ b/Makefile.target @@ -472,7 +472,8 @@ endif #CONFIG_DARWIN_USER # System emulator target ifndef CONFIG_USER_ONLY -OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o net-checksum.o migration.o +OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o net-checksum.o +OBJS+=migration.o ifdef CONFIG_WIN32 OBJS+=block-raw-win32.o else diff --git a/migration.c b/migration.c index 507c9d9..8a8b4a5 100644 --- a/migration.c +++ b/migration.c @@ -198,3 +198,12 @@ QEMUFile *qemu_fopen_ops_buffered(void *opaque, return s->file; } +void qemu_start_incoming_migration(const char *uri) +{ + fprintf(stderr, "unknown migration protocol: %s\n", uri); +} + +void do_migrate(const char *uri) +{ + fprintf(stderr, "unknown migration protocol: %s\n", uri); +} diff --git a/migration.h b/migration.h index 3994fbb..2119a59 100644 --- a/migration.h +++ b/migration.h @@ -14,4 +14,8 @@ QEMUFile *qemu_fopen_ops_buffered(void *opaque, size_t xfer_limit, BufferedWaitForUnfreezeFunc *wait_for_unfreeze, BufferedCloseFunc *close); +void qemu_start_incoming_migration(const char *uri); + +void do_migrate(const char *uri); + #endif diff --git a/monitor.c b/monitor.c index 76a2ddb..5b7a1c5 100644 --- a/monitor.c +++ b/monitor.c @@ -36,6 +36,7 @@ #include "disas.h" #include <dirent.h> #include "qemu-timer.h" +#include "migration.h" //#define DEBUG //#define DEBUG_COMPLETION @@ -1449,6 +1450,7 @@ static term_cmd_t term_cmds[] = { { "nmi", "i", do_inject_nmi, "cpu", "inject an NMI on the given CPU", }, #endif + { "migrate", "s", do_migrate, "uri", "migrate to URI" }, { NULL, NULL, }, }; diff --git a/qemu_socket.h b/qemu_socket.h index 5229c24..a9009d5 100644 --- a/qemu_socket.h +++ b/qemu_socket.h @@ -27,5 +27,6 @@ #endif /* !_WIN32 */ void socket_set_nonblock(int fd); +int parse_host_port(struct sockaddr_in *saddr, const char *str); #endif /* QEMU_SOCKET_H */ diff --git a/vl.c b/vl.c index d89435a..5a7d0ed 100644 --- a/vl.c +++ b/vl.c @@ -37,6 +37,7 @@ #include "qemu-char.h" #include "block.h" #include "audio/audio.h" +#include "migration.h" #include <unistd.h> #include <fcntl.h> @@ -3381,7 +3382,6 @@ static void udp_chr_update_read_handler(CharDriverState *chr) } } -int parse_host_port(struct sockaddr_in *saddr, const char *str); #ifndef _WIN32 static int parse_unix_path(struct sockaddr_un *uaddr, const char *str); #endif @@ -8380,6 +8380,7 @@ enum { QEMU_OPTION_startdate, QEMU_OPTION_tb_size, QEMU_OPTION_icount, + QEMU_OPTION_incoming, }; typedef struct QEMUOption { @@ -8468,6 +8469,7 @@ const QEMUOption qemu_options[] = { #ifdef CONFIG_CURSES { "curses", 0, QEMU_OPTION_curses }, #endif + { "incoming", HAS_ARG, QEMU_OPTION_incoming }, /* temporary options */ { "usb", 0, QEMU_OPTION_usb }, @@ -8734,6 +8736,7 @@ int main(int argc, char **argv) int tb_size; const char *pid_file = NULL; VLANState *vlan; + const char *incoming = NULL; LIST_INIT (&vm_change_state_head); #ifndef _WIN32 @@ -9342,6 +9345,9 @@ int main(int argc, char **argv) icount_time_shift = strtol(optarg, NULL, 0); } break; + case QEMU_OPTION_incoming: + incoming = optarg; + break; } } } @@ -9678,6 +9684,11 @@ int main(int argc, char **argv) if (loadvm) do_loadvm(loadvm); + if (incoming) { + autostart = 0; /* fixme how to deal with -daemonize */ + qemu_start_incoming_migration(incoming); + } + { /* XXX: simplify init */ read_passwords(); -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html