From ca381fbec3841313d35011a2b6b390200f28d404 Mon Sep 17 00:00:00 2001 From: Uri Lublin <uril@redhat.com> Date: Wed, 21 Jan 2009 15:29:52 +0200 Subject: [PATCH 31/54] qemu: notify (async) management when migration finished at destination SolidICE wants to know when a VM has migrated to another node. After that event happens, it takes down the source VM and informs the administrator of a successful migration. The source can ask for "info migration". The destination waits for an asynchronous notification. This patch provides that notification by emitting a message to qemu monitor, telling vdsm of the successful completion of the migration process. Remember to "notify migration on" on destination before migration starts. This is a modification of the patch Dan Kenigsberg sent to the list, making use of Amit's asynchronous notifications. Signed-off-by: Uri Lublin <uril@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> RH-Type: improvement RH-Upstream-status: pending --- qemu/console.h | 3 ++- qemu/migration-tcp.c | 1 + qemu/monitor.c | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/qemu/console.h b/qemu/console.h index c969c6a..c8c95ec 100644 --- a/qemu/console.h +++ b/qemu/console.h @@ -191,7 +191,8 @@ extern uint8_t _translate_keycode(const int key); #define VNC_ASYNC_EVENT 1 #define RTC_ASYNC_EVENT 2 #define SHUTDOWN_ASYNC_EVENT 3 -#define MAX_ASYNC_EVENTS SHUTDOWN_ASYNC_EVENT +#define MIGRATION_ASYNC_EVENT 4 +#define MAX_ASYNC_EVENTS MIGRATION_ASYNC_EVENT /* FIXME: term_printf et al should probably go elsewhere so everything does not need to include console.h */ diff --git a/qemu/migration-tcp.c b/qemu/migration-tcp.c index a0e347d..9acfd5c 100644 --- a/qemu/migration-tcp.c +++ b/qemu/migration-tcp.c @@ -450,6 +450,7 @@ static void tcp_incoming_load_vm(void) qemu_set_fd_handler2(in_state.listener, NULL, NULL, NULL, NULL); close(in_state.listener); in_state.listener = -1; + term_printf_async(MIGRATION_ASYNC_EVENT, "migration: migration process finished\n"); vm_start(); error: diff --git a/qemu/monitor.c b/qemu/monitor.c index d2078f8..e80b70c 100644 --- a/qemu/monitor.c +++ b/qemu/monitor.c @@ -253,6 +253,8 @@ static void do_notify_async_events(char *event_str, char *enable) event = RTC_ASYNC_EVENT; else if (!strcmp(event_str, "shutdown")) event = SHUTDOWN_ASYNC_EVENT; + else if (!strcmp(event_str, "migration")) + event = MIGRATION_ASYNC_EVENT; else return; @@ -1611,7 +1613,7 @@ static term_cmd_t term_cmds[] = { { "set_qxl_log_level", "i", qxl_do_set_log_level, "", "set qxl log level" }, #endif { "notify", "ss", do_notify_async_events, - "vnc|rtc|shutdown on|off", "enable / disable printing of notifications for the specified event" }, + "vnc|rtc|shutdown|migration on|off", "enable / disable printing of notifications for the specified event" }, { NULL, NULL, }, }; -- 1.6.1