From patchwork Fri Apr 9 12:46:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Harper X-Patchwork-Id: 49843 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 590F6B7CF5 for ; Fri, 9 Apr 2010 22:55:58 +1000 (EST) Received: from localhost ([127.0.0.1]:43937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0DjQ-0004Kr-ED for incoming@patchwork.ozlabs.org; Fri, 09 Apr 2010 08:54:44 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O0Dbw-0008Ac-Ff for qemu-devel@nongnu.org; Fri, 09 Apr 2010 08:47:00 -0400 Received: from [140.186.70.92] (port=46247 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0Dbv-00088f-1c for qemu-devel@nongnu.org; Fri, 09 Apr 2010 08:47:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O0Dbt-0005bg-JW for qemu-devel@nongnu.org; Fri, 09 Apr 2010 08:46:58 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:60797) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0Dbt-0005bT-ER for qemu-devel@nongnu.org; Fri, 09 Apr 2010 08:46:57 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e36.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o39Chpgi027224 for ; Fri, 9 Apr 2010 06:43:51 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id o39CkjpQ107294 for ; Fri, 9 Apr 2010 06:46:47 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o39Ckf5b016995 for ; Fri, 9 Apr 2010 06:46:41 -0600 Received: from localhost.localdomain (frylock.austin.ibm.com [9.53.41.12]) by d03av04.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o39Ckf1r016975 for ; Fri, 9 Apr 2010 06:46:41 -0600 Received: by localhost.localdomain (Postfix, from userid 1000) id 40E081BF80; Fri, 9 Apr 2010 07:46:38 -0500 (CDT) Date: Fri, 9 Apr 2010 07:46:38 -0500 From: Ryan Harper To: qemu-devel@nongnu.org Message-ID: <20100409124638.GY24351@us.ibm.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.6+20040907i X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Subject: [Qemu-devel] [PATCH][STABLE] Add qerror message if the 'change' target filename can't be opened 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 Currently when using the change command to switch the file in the cd drive the command doesn't complain if the file doesn't exit or can't be opened and the drive keeps the existing image. This patch adds a qerror_report call to print a message out indicating the failure. This error message can be used to catch failures. Current behavior: QEMU 0.12.50 monitor - type 'help' for more information (qemu) info block ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0 ide1-cd0: type=cdrom removable=1 locked=0 [not inserted] floppy0: type=floppy removable=1 locked=0 [not inserted] sd0: type=floppy removable=1 locked=0 [not inserted] (qemu) change ide1-cd0 /home/rharper/work/isos/Fedora-9-i386-DVD.iso (qemu) info block ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0 ide1-cd0: type=cdrom removable=1 locked=0 file=/home/rharper/work/isos/Fedora-9-i386-DVD.iso ro=0 drv=raw encrypted=0 floppy0: type=floppy removable=1 locked=0 [not inserted] sd0: type=floppy removable=1 locked=0 [not inserted] (qemu) change ide1-cd0 /tmp/non_existent_file.iso (qemu) info block ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0 ide1-cd0: type=cdrom removable=1 locked=0 [not inserted] floppy0: type=floppy removable=1 locked=0 [not inserted] sd0: type=floppy removable=1 locked=0 [not inserted] (qemu) With patch: QEMU 0.12.50 monitor - type 'help' for more information (qemu) change ide1-cd0 /tmp/non_existent_file.iso Could not open '/tmp/non_existent_file.iso' (qemu) Signed-off-by: Ryan Harper --- monitor.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/monitor.c b/monitor.c index 0448a70..196c7a6 100644 --- a/monitor.c +++ b/monitor.c @@ -1099,6 +1099,7 @@ static int do_change_block(Monitor *mon, const char *device, return -1; } if (bdrv_open2(bs, filename, BDRV_O_RDWR, drv) < 0) { + qerror_report(QERR_OPEN_FILE_FAILED, filename); return -1; } return monitor_read_bdrv_key_start(mon, bs, NULL, NULL);