From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nuo7U-0000Hd-3C for qemu-devel@nongnu.org; Thu, 25 Mar 2010 10:33:12 -0400 Received: from [140.186.70.92] (port=33307 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nuo7S-0000GN-3w for qemu-devel@nongnu.org; Thu, 25 Mar 2010 10:33:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nuo7P-0007z0-Dn for qemu-devel@nongnu.org; Thu, 25 Mar 2010 10:33:08 -0400 Received: from e5.ny.us.ibm.com ([32.97.182.145]:49081) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nuo7P-0007yu-BT for qemu-devel@nongnu.org; Thu, 25 Mar 2010 10:33:07 -0400 Received: from d01relay06.pok.ibm.com (d01relay06.pok.ibm.com [9.56.227.116]) by e5.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id o2PEIaxJ030789 for ; Thu, 25 Mar 2010 10:18:36 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o2PEX3vs1409258 for ; Thu, 25 Mar 2010 10:33:04 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o2PEX3E5022319 for ; Thu, 25 Mar 2010 11:33:03 -0300 Received: from localhost.localdomain (frylock.austin.ibm.com [9.53.41.12]) by d01av03.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o2PEX2mL022298 for ; Thu, 25 Mar 2010 11:33:03 -0300 Date: Thu, 25 Mar 2010 09:32:58 -0500 From: Ryan Harper Message-ID: <20100325143258.GS27260@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] Add qerror message if the 'change' target filename can't be opened List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@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); -- 1.6.3.3 -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ryanh@us.ibm.com