From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kd9Ey-0001at-Vj for qemu-devel@nongnu.org; Tue, 09 Sep 2008 15:51:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kd9Eu-0001SL-2a for qemu-devel@nongnu.org; Tue, 09 Sep 2008 15:51:05 -0400 Received: from [199.232.76.173] (port=35809 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kd9Et-0001SD-TS for qemu-devel@nongnu.org; Tue, 09 Sep 2008 15:51:03 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:40681) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kd9Et-0001vA-OE for qemu-devel@nongnu.org; Tue, 09 Sep 2008 15:51:04 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e35.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id m89JotJc003869 for ; Tue, 9 Sep 2008 15:50:55 -0400 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m89Jorkl026234 for ; Tue, 9 Sep 2008 13:50:54 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m89JorYM007864 for ; Tue, 9 Sep 2008 13:50:53 -0600 From: Anthony Liguori Date: Tue, 9 Sep 2008 14:50:01 -0500 Message-Id: <1220989802-13706-10-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1220989802-13706-1-git-send-email-aliguori@us.ibm.com> References: <1220989802-13706-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 9/10] Introduce the UI components for live migration Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Chris Wright , Uri Lublin , Anthony Liguori , kvm@vger.kernel.org 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 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 #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 #include @@ -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();