From patchwork Wed Aug 19 02:07:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 31622 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 5E78DB7B60 for ; Wed, 19 Aug 2009 12:43:07 +1000 (EST) Received: from localhost ([127.0.0.1]:54078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mdb8d-0004Kt-Uq for incoming@patchwork.ozlabs.org; Tue, 18 Aug 2009 22:42:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mdb2G-0002lI-Hu for qemu-devel@nongnu.org; Tue, 18 Aug 2009 22:36:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mdb2B-0002iH-HO for qemu-devel@nongnu.org; Tue, 18 Aug 2009 22:36:23 -0400 Received: from [199.232.76.173] (port=37502 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mdb2B-0002iE-AC for qemu-devel@nongnu.org; Tue, 18 Aug 2009 22:36:19 -0400 Received: from [66.187.237.31] (port=53936 helo=mx2.redhat.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mdb2A-0004SU-SU for qemu-devel@nongnu.org; Tue, 18 Aug 2009 22:36:19 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7J2AC4U026693 for ; Tue, 18 Aug 2009 22:10:12 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n7J2ABDN001622; Tue, 18 Aug 2009 22:10:11 -0400 Received: from localhost.localdomain (vpn1-4-108.ams2.redhat.com [10.36.4.108]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n7J2A1t5004927; Tue, 18 Aug 2009 22:10:10 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 19 Aug 2009 04:07:49 +0200 Message-Id: <927bb26f5425c58febd666db8fec67f55a229b5c.1250646771.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [Qemu-devel] [PATCH 6/6] Continue a migrated vm is a bad idea 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.c | 1 + monitor.c | 6 ++++++ sysemu.h | 1 + vl.c | 1 + 4 files changed, 9 insertions(+), 0 deletions(-) diff --git a/migration.c b/migration.c index ee64d41..f91401e 100644 --- a/migration.c +++ b/migration.c @@ -275,6 +275,7 @@ void migrate_fd_put_ready(void *opaque) state = MIG_STATE_ERROR; } else { state = MIG_STATE_COMPLETED; + vm_has_migrated = 1; } migrate_fd_cleanup(s); s->state = state; diff --git a/monitor.c b/monitor.c index ea5c33a..762a9a5 100644 --- a/monitor.c +++ b/monitor.c @@ -567,6 +567,11 @@ static void do_cont(Monitor *mon) { struct bdrv_iterate_context context = { mon, 0 }; + if (unlikely(vm_has_migrated)) { + monitor_printf(mon, "this vm has migrated to other machine\n"); + monitor_printf(mon, "You have to load other vm\n"); + return; + } bdrv_iterate(encrypted_bdrv_it, &context); /* only resume the vm if all keys are set and valid */ if (!context.err) @@ -1780,6 +1785,7 @@ static void do_loadvm(Monitor *mon, const char *name) { int saved_vm_running = vm_running; + vm_has_migrated = 0; vm_stop(0); if (load_vmstate(mon, name) >= 0 && saved_vm_running) diff --git a/sysemu.h b/sysemu.h index e0338ce..7c3fdc1 100644 --- a/sysemu.h +++ b/sysemu.h @@ -18,6 +18,7 @@ extern const char *bios_name; char *qemu_find_file(int type, const char *name); extern int vm_running; +extern int vm_has_migrated; extern const char *qemu_name; extern uint8_t qemu_uuid[]; int qemu_uuid_parse(const char *str, uint8_t *uuid); diff --git a/vl.c b/vl.c index bf2468e..d39295a 100644 --- a/vl.c +++ b/vl.c @@ -188,6 +188,7 @@ ram_addr_t ram_size; int nb_nics; NICInfo nd_table[MAX_NICS]; int vm_running; +int vm_has_migrated; int autostart; static int rtc_utc = 1; static int rtc_date_offset = -1; /* -1 means no change */