Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934619Ab2JYDvb (ORCPT ); Wed, 24 Oct 2012 23:51:31 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:48493 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1758006Ab2JYDml (ORCPT ); Wed, 24 Oct 2012 23:42:41 -0400 X-IronPort-AV: E=Sophos;i="4.80,645,1344182400"; d="scan'208";a="6064357" From: Hu Tao To: kvm list , qemu-devel , "linux-kernel@vger.kernel.org" , Avi Kivity , "Daniel P. Berrange" , KAMEZAWA Hiroyuki , Jan Kiszka , Gleb Natapov , Blue Swirl , Eric Blake , Andrew Jones , Marcelo Tosatti , Sasha Levin , Luiz Capitulino Cc: Wen Congyang Subject: [PATCH v11 1/6] start vm after reseting it Date: Thu, 25 Oct 2012 11:42:33 +0800 Message-Id: <1351136563-15073-1-git-send-email-hutao@cn.fujitsu.com> X-Mailer: git-send-email 1.7.10.2 In-Reply-To: <0a2274eccf1b1dd420f16359f7e1de74fa2f9fbe.1351131144.git.hutao@cn.fujitsu.com> References: <0a2274eccf1b1dd420f16359f7e1de74fa2f9fbe.1351131144.git.hutao@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/10/25 11:41:59, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/10/25 11:42:01, Serialize complete at 2012/10/25 11:42:01 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2684 Lines: 82 From: Wen Congyang The guest should run after reseting it, but it does not run if its old state is RUN_STATE_INTERNAL_ERROR or RUN_STATE_PAUSED. We don't set runstate to RUN_STATE_PAUSED when reseting the guest, so the runstate will be changed from RUN_STATE_INTERNAL_ERROR or RUN_STATE_PAUSED to RUN_STATE_RUNNING(not RUN_STATE_PAUSED). Signed-off-by: Wen Congyang --- block.h | 2 ++ qmp.c | 2 +- vl.c | 7 ++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/block.h b/block.h index e2d89d7..df10e30 100644 --- a/block.h +++ b/block.h @@ -360,6 +360,8 @@ void bdrv_disable_copy_on_read(BlockDriverState *bs); void bdrv_set_in_use(BlockDriverState *bs, int in_use); int bdrv_in_use(BlockDriverState *bs); +void iostatus_bdrv_it(void *opaque, BlockDriverState *bs); + enum BlockAcctType { BDRV_ACCT_READ, BDRV_ACCT_WRITE, diff --git a/qmp.c b/qmp.c index 36c54c5..f4a757b 100644 --- a/qmp.c +++ b/qmp.c @@ -125,7 +125,7 @@ SpiceInfo *qmp_query_spice(Error **errp) }; #endif -static void iostatus_bdrv_it(void *opaque, BlockDriverState *bs) +void iostatus_bdrv_it(void *opaque, BlockDriverState *bs) { bdrv_iostatus_reset(bs); } diff --git a/vl.c b/vl.c index ee3c43a..ca2e1e2 100644 --- a/vl.c +++ b/vl.c @@ -343,7 +343,7 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_INMIGRATE, RUN_STATE_RUNNING }, { RUN_STATE_INMIGRATE, RUN_STATE_PRELAUNCH }, - { RUN_STATE_INTERNAL_ERROR, RUN_STATE_PAUSED }, + { RUN_STATE_INTERNAL_ERROR, RUN_STATE_RUNNING }, { RUN_STATE_INTERNAL_ERROR, RUN_STATE_FINISH_MIGRATE }, { RUN_STATE_IO_ERROR, RUN_STATE_RUNNING }, @@ -376,7 +376,7 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_SAVE_VM, RUN_STATE_RUNNING }, - { RUN_STATE_SHUTDOWN, RUN_STATE_PAUSED }, + { RUN_STATE_SHUTDOWN, RUN_STATE_RUNNING }, { RUN_STATE_SHUTDOWN, RUN_STATE_FINISH_MIGRATE }, { RUN_STATE_DEBUG, RUN_STATE_SUSPENDED }, @@ -1618,7 +1618,8 @@ static bool main_loop_should_exit(void) resume_all_vcpus(); if (runstate_check(RUN_STATE_INTERNAL_ERROR) || runstate_check(RUN_STATE_SHUTDOWN)) { - runstate_set(RUN_STATE_PAUSED); + bdrv_iterate(iostatus_bdrv_it, NULL); + vm_start(); } } if (qemu_wakeup_requested()) { -- 1.7.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/