From patchwork Thu Mar 7 08:23:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 225762 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 83FCE2C038E for ; Thu, 7 Mar 2013 19:33:30 +1100 (EST) Received: from localhost ([::1]:39868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDWGW-00087Z-KU for incoming@patchwork.ozlabs.org; Thu, 07 Mar 2013 03:33:28 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDWG6-00083U-1D for qemu-devel@nongnu.org; Thu, 07 Mar 2013 03:33:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDWG3-0007ht-WE for qemu-devel@nongnu.org; Thu, 07 Mar 2013 03:33:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49203) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDWG3-0007hd-OF for qemu-devel@nongnu.org; Thu, 07 Mar 2013 03:32:59 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r278Wxo0000612 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 7 Mar 2013 03:32:59 -0500 Received: from amd-6168-8-1.englab.nay.redhat.com (amd-6168-8-1.englab.nay.redhat.com [10.66.104.52]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r278WoI8007225; Thu, 7 Mar 2013 03:32:56 -0500 From: Jason Wang To: aliguori@us.ibm.com, pbonzini@redhat.com, owasserm@redhat.com, qemu-devel@nongnu.org Date: Thu, 7 Mar 2013 16:23:47 +0800 Message-Id: <1362644631-23113-2-git-send-email-jasowang@redhat.com> In-Reply-To: <1362644631-23113-1-git-send-email-jasowang@redhat.com> References: <1362644631-23113-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Jason Wang , mst@redhat.com Subject: [Qemu-devel] [PATCH V7 1/5] runstate: introduce prelaunch-migrate state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sometimes, we need track the state when guest is just about to start after migration. There's not a accurate state available which do this accurately (consider qemu may started with -S in destination). So this patch introduces a new state prelaunch-migrate which just tracks this state, it covers the case both w/ and w/o -S in destination. The first user of this is the support of doing announce by guest. Signed-off-by: Jason Wang --- migration.c | 3 +-- qapi-schema.json | 5 ++++- vl.c | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/migration.c b/migration.c index 11725ae..ecdf2c5 100644 --- a/migration.c +++ b/migration.c @@ -107,10 +107,9 @@ static void process_incoming_migration_co(void *opaque) /* Make sure all file formats flush their mutable metadata */ bdrv_invalidate_cache_all(); + runstate_set(RUN_STATE_PRELAUNCH_MIGRATE); if (autostart) { vm_start(); - } else { - runstate_set(RUN_STATE_PAUSED); } } diff --git a/qapi-schema.json b/qapi-schema.json index 28b070f..baa6361 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -174,11 +174,14 @@ # @suspended: guest is suspended (ACPI S3) # # @watchdog: the watchdog action is configured to pause and has been triggered +# +# @migrate-prelaunch: migration is completed and QEMU were started with -S ## { 'enum': 'RunState', 'data': [ 'debug', 'inmigrate', 'internal-error', 'io-error', 'paused', 'postmigrate', 'prelaunch', 'finish-migrate', 'restore-vm', - 'running', 'save-vm', 'shutdown', 'suspended', 'watchdog' ] } + 'running', 'save-vm', 'shutdown', 'suspended', 'watchdog', + 'prelaunch-migrate'] } ## # @SnapshotInfo diff --git a/vl.c b/vl.c index c03edf1..5dd2e0e 100644 --- a/vl.c +++ b/vl.c @@ -534,7 +534,7 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_DEBUG, RUN_STATE_RUNNING }, { RUN_STATE_INMIGRATE, RUN_STATE_RUNNING }, - { RUN_STATE_INMIGRATE, RUN_STATE_PAUSED }, + { RUN_STATE_INMIGRATE, RUN_STATE_PRELAUNCH_MIGRATE }, { RUN_STATE_INTERNAL_ERROR, RUN_STATE_PAUSED }, { RUN_STATE_INTERNAL_ERROR, RUN_STATE_FINISH_MIGRATE }, @@ -580,6 +580,8 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING }, { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_PRELAUNCH_MIGRATE, RUN_STATE_RUNNING }, + { RUN_STATE_MAX, RUN_STATE_MAX }, };