From patchwork Tue May 25 14:21:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 53551 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 82201B6ED0 for ; Wed, 26 May 2010 00:30:52 +1000 (EST) Received: from localhost ([127.0.0.1]:34535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGv9c-0005Pk-8q for incoming@patchwork.ozlabs.org; Tue, 25 May 2010 10:30:48 -0400 Received: from [140.186.70.92] (port=38678 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGv0R-0002vW-GG for qemu-devel@nongnu.org; Tue, 25 May 2010 10:21:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGv0P-0002MA-VL for qemu-devel@nongnu.org; Tue, 25 May 2010 10:21:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40045) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGv0P-0002Lx-OO for qemu-devel@nongnu.org; Tue, 25 May 2010 10:21:17 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4PELHH1015151 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 25 May 2010 10:21:17 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4PEL6Cc020067; Tue, 25 May 2010 10:21:16 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 25 May 2010 16:21:05 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 5/5] QMP: Emit migration events on outgoing migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- migration-exec.c | 3 ++- migration-fd.c | 1 + migration-tcp.c | 2 ++ migration-unix.c | 2 ++ migration.c | 5 +++++ 5 files changed, 12 insertions(+), 1 deletions(-) diff --git a/migration-exec.c b/migration-exec.c index 07af11a..ebc9256 100644 --- a/migration-exec.c +++ b/migration-exec.c @@ -20,6 +20,7 @@ #include "sysemu.h" #include "buffered_file.h" #include "block.h" +#include "monitor.h" //#define DEBUG_MIGRATION_EXEC @@ -91,9 +92,9 @@ MigrationState *exec_start_outgoing_migration(Monitor *mon, s->mig_state.shared = inc; s->state = MIG_STATE_ACTIVE; + monitor_protocol_event(QEVENT_MIGRATION_STARTED, NULL); s->mon = NULL; s->bandwidth_limit = bandwidth_limit; - if (!detach) { migrate_fd_monitor_suspend(s, mon); } diff --git a/migration-fd.c b/migration-fd.c index 6d14505..9c4c7ae 100644 --- a/migration-fd.c +++ b/migration-fd.c @@ -83,6 +83,7 @@ MigrationState *fd_start_outgoing_migration(Monitor *mon, s->mig_state.blk = blk; s->mig_state.shared = inc; + monitor_protocol_event(QEVENT_MIGRATION_STARTED, NULL); s->state = MIG_STATE_ACTIVE; s->mon = NULL; s->bandwidth_limit = bandwidth_limit; diff --git a/migration-tcp.c b/migration-tcp.c index 20f2e37..11a1203 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -18,6 +18,7 @@ #include "sysemu.h" #include "buffered_file.h" #include "block.h" +#include "monitor.h" //#define DEBUG_MIGRATION_TCP @@ -102,6 +103,7 @@ MigrationState *tcp_start_outgoing_migration(Monitor *mon, s->mig_state.blk = blk; s->mig_state.shared = inc; + monitor_protocol_event(QEVENT_MIGRATION_STARTED, NULL); s->state = MIG_STATE_ACTIVE; s->mon = NULL; s->bandwidth_limit = bandwidth_limit; diff --git a/migration-unix.c b/migration-unix.c index 57232c0..08f29a3 100644 --- a/migration-unix.c +++ b/migration-unix.c @@ -18,6 +18,7 @@ #include "sysemu.h" #include "buffered_file.h" #include "block.h" +#include "monitor.h" //#define DEBUG_MIGRATION_UNIX @@ -101,6 +102,7 @@ MigrationState *unix_start_outgoing_migration(Monitor *mon, s->mig_state.blk = blk; s->mig_state.shared = inc; + monitor_protocol_event(QEVENT_MIGRATION_STARTED, NULL); s->state = MIG_STATE_ACTIVE; s->mon = NULL; s->bandwidth_limit = bandwidth_limit; diff --git a/migration.c b/migration.c index 32470d5..86535a9 100644 --- a/migration.c +++ b/migration.c @@ -306,6 +306,7 @@ void migrate_fd_monitor_suspend(FdMigrationState *s, Monitor *mon) void migrate_fd_error(FdMigrationState *s) { DPRINTF("setting error state\n"); + monitor_protocol_event(QEVENT_MIGRATION_FAILED, NULL); s->state = MIG_STATE_ERROR; migrate_fd_cleanup(s); } @@ -403,8 +404,10 @@ void migrate_fd_put_ready(void *opaque) if (old_vm_running) { vm_start(); } + monitor_protocol_event(QEVENT_MIGRATION_FAILED, NULL); state = MIG_STATE_ERROR; } else { + monitor_protocol_event(QEVENT_MIGRATION_ENDED, NULL); state = MIG_STATE_COMPLETED; } migrate_fd_cleanup(s); @@ -427,6 +430,7 @@ void migrate_fd_cancel(MigrationState *mig_state) DPRINTF("cancelling migration\n"); + monitor_protocol_event(QEVENT_MIGRATION_CANCELED, NULL); s->state = MIG_STATE_CANCELLED; qemu_savevm_state_cancel(s->mon, s->file); @@ -440,6 +444,7 @@ void migrate_fd_release(MigrationState *mig_state) DPRINTF("releasing state\n"); if (s->state == MIG_STATE_ACTIVE) { + monitor_protocol_event(QEVENT_MIGRATION_CANCELED, NULL); s->state = MIG_STATE_CANCELLED; migrate_fd_cleanup(s); }