From patchwork Tue Apr 20 21:09:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 50583 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 C3463B7D0B for ; Wed, 21 Apr 2010 07:32:23 +1000 (EST) Received: from localhost ([127.0.0.1]:42980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4L3L-0006mP-WC for incoming@patchwork.ozlabs.org; Tue, 20 Apr 2010 17:32:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4Ki8-0007BY-Uv for qemu-devel@nongnu.org; Tue, 20 Apr 2010 17:10:25 -0400 Received: from [140.186.70.92] (port=37333 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4Ki3-00079K-8h for qemu-devel@nongnu.org; Tue, 20 Apr 2010 17:10:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4Khs-0003vY-9c for qemu-devel@nongnu.org; Tue, 20 Apr 2010 17:10:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60864) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4Khq-0003vB-Ha for qemu-devel@nongnu.org; Tue, 20 Apr 2010 17:10:08 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3KLA6qk023830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Apr 2010 17:10:06 -0400 Received: from localhost (vpn-9-57.rdu.redhat.com [10.11.9.57]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3KLA41T030965; Tue, 20 Apr 2010 17:10:05 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org, armbru@redhat.com, quintela@redhat.com, kwolf@redhat.com Date: Tue, 20 Apr 2010 18:09:34 -0300 Message-Id: <1271797792-24571-5-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1271797792-24571-1-git-send-email-lcapitulino@redhat.com> References: <1271797792-24571-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH 04/22] savevm: do_loadvm(): Always resume the VM 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 do_loadvm(), which implements the 'loadvm' Monitor command, pauses the emulation to load the saved VM, however it will only resume it if the loading succeeds. In other words, if the user issues 'loadvm' and it fails, the end result will be an error message and a paused VM. This seems an undesirable side effect to me because, most of the time, if a Monitor command fails the best thing we can do is to leave the VM as it were before the command was executed. FIXME: This will try to run a potentially corrupted image, the solution is to split load_vmstate() in two and only keep the VM paused if qemu_loadvm_state() fails. Signed-off-by: Luiz Capitulino --- monitor.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/monitor.c b/monitor.c index 975e77c..542c858 100644 --- a/monitor.c +++ b/monitor.c @@ -2472,8 +2472,11 @@ static void do_loadvm(Monitor *mon, const QDict *qdict) vm_stop(0); - if (load_vmstate(name) >= 0 && saved_vm_running) + load_vmstate(name); + + if (saved_vm_running) { vm_start(); + } } int monitor_get_fd(Monitor *mon, const char *fdname)