[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Close the BlockDriverState when guest eject the media
From: |
Weidong Huang |
Subject: |
[Qemu-devel] Close the BlockDriverState when guest eject the media |
Date: |
Sat, 18 Oct 2014 18:02:49 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 |
Hi ALL:
There are two ways to eject the cdrom tray. One is by the eject's qmp
commmand(eject_device).
The another one is by the guest(bdrv_eject). They have different results.
eject_device: close the BlockDriverState(bdrv_close(bs))
bdrv_eject: don't close the BlockDriverState,
This is ambiguous. So libvirt can't handle some situations.
libvirt send eject qmp command ---> qemu send eject request to guest --->
guest respond to qemu ---> qemu emit tray_open event to libvirt --->
libvirt will not send change qmp command if media source is null. So
the media is not be replace to the null.
So close the BlockDriverState in bdrv_eject. Thanks.
diff --git a/block.c b/block.c
index d3aebeb..0be69de 100644
--- a/block.c
+++ b/block.c
@@ -5276,6 +5276,10 @@ void bdrv_eject(BlockDriverState *bs, bool eject_flag)
qapi_event_send_device_tray_moved(bdrv_get_device_name(bs),
eject_flag, &error_abort);
}
+
+ if (eject_flag) {
+ bdrv_close(bs);
+ }
}
- [Qemu-devel] Close the BlockDriverState when guest eject the media,
Weidong Huang <=
- Re: [Qemu-devel] Close the BlockDriverState when guest eject the media, Kevin Wolf, 2014/10/20
- Re: [Qemu-devel] Close the BlockDriverState when guest eject the media, Weidong Huang, 2014/10/20
- Re: [Qemu-devel] Close the BlockDriverState when guest eject the media, Kevin Wolf, 2014/10/20
- Re: [Qemu-devel] Close the BlockDriverState when guest eject the media, Weidong Huang, 2014/10/20
- Re: [Qemu-devel] Close the BlockDriverState when guest eject the media, Weidong Huang, 2014/10/21
- Re: [Qemu-devel] Close the BlockDriverState when guest eject the media, Gonglei, 2014/10/21
- Re: [Qemu-devel] Close the BlockDriverState when guest eject the media, Eric Blake, 2014/10/24
- Re: [Qemu-devel] Close the BlockDriverState when guest eject the media, Markus Armbruster, 2014/10/27
- Re: [Qemu-devel] Close the BlockDriverState when guest eject the media, Markus Armbruster, 2014/10/20
- Re: [Qemu-devel] Close the BlockDriverState when guest eject the media, Weidong Huang, 2014/10/21