[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 03/21] Add qerror message if the 'change' target fil
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 03/21] Add qerror message if the 'change' target filename can't be opened |
Date: |
Mon, 5 Apr 2010 17:33:44 -0300 |
From: Ryan Harper <address@hidden>
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 <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
monitor.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/monitor.c b/monitor.c
index 822dc27..89952e8 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1097,6 +1097,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.7.0.4.297.g6555b1
- [Qemu-devel] [PATCH 05/21] error: New QERR_DUPLICATE_ID, (continued)
- [Qemu-devel] [PATCH 05/21] error: New QERR_DUPLICATE_ID, Luiz Capitulino, 2010/04/05
- [Qemu-devel] [PATCH 08/21] error: Convert qemu_opts_set() to QError, Luiz Capitulino, 2010/04/05
- [Qemu-devel] [PATCH 16/21] monitor: New argument type 'b', Luiz Capitulino, 2010/04/05
- [Qemu-devel] [PATCH 14/21] monitor: New commands netdev_add, netdev_del, Luiz Capitulino, 2010/04/05
- [Qemu-devel] [PATCH 13/21] error: New QERR_DEVICE_IN_USE, Luiz Capitulino, 2010/04/05
- [Qemu-devel] [PATCH 11/21] error: Convert qemu_opts_validate() to QError, Luiz Capitulino, 2010/04/05
- [Qemu-devel] [PATCH 19/21] virtio-blk: Fix use after free in error case, Luiz Capitulino, 2010/04/05
- [Qemu-devel] [PATCH 21/21] Monitor: Convert do_screen_dump() to QObject, Luiz Capitulino, 2010/04/05
- [Qemu-devel] [PATCH 18/21] monitor: Convert do_set_link() to QObject, QError, Luiz Capitulino, 2010/04/05
- [Qemu-devel] [PATCH 10/21] error: Use QERR_INVALID_PARAMETER_VALUE instead of QERR_INVALID_PARAMETER, Luiz Capitulino, 2010/04/05
- [Qemu-devel] [PATCH 03/21] Add qerror message if the 'change' target filename can't be opened,
Luiz Capitulino <=
- Re: [Qemu-devel] [PATCH 00/21][PULL]: QMP/Monitor queue, Aurelien Jarno, 2010/04/18