qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] virtio-blk: Allow startup of empty cdroms


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] virtio-blk: Allow startup of empty cdroms
Date: Thu, 7 Jan 2016 12:48:58 +0800
User-agent: Mutt/1.5.24 (2015-08-30)

On Wed, Jan 06, 2016 at 11:35:43AM +0100, Michal Privoznik wrote:
> If you have an empty IDE cdrom we will start just fine:
> 
> -drive if=none,id=drive-ide0-0-0,readonly=on
> -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0
> 
> However, that's not the case with virtio disk:
> 
> -drive if=none,media=cdrom,id=drive-virtio-disk1,readonly=on
> -device 
> virtio-blk-pci,scsi=off,bus=pci.2,addr=0x2,drive=drive-virtio-disk1,id=virtio-disk1
> 
> One will get the following error:
> 
> qemu-system-x86_64: -device 
> virtio-blk-pci,scsi=off,bus=pci.2,addr=0x2,drive=drive-virtio-disk1,id=virtio-disk1:
>  Device needs media, but drive is empty
> 
> The error comes from virtio_blk_device_realize() where we check
> if virtio block device has a media inserted. This should,
> however, be not required for cdroms.
> 
> Signed-off-by: Michal Privoznik <address@hidden>
> ---
>  hw/block/virtio-blk.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

virtio-blk doesn't do CD-ROM emulation but it supports read-only block
devices.  The difference is that read-only block devices don't offer the
features that CD-ROMs support like media status and tray eject.

Also, virtio-blk does not support media change.  If we allow it to start
with an empty disk, is there an expectation that media can be changed
later?

In order to support empty media that can later be inserted virtio-blk.c
needs to implement BlockDevOps->change_media_cb() to notify the guest.
You'd need to check guest whether existing guest drivers handle a virtio
configuration interrupt properly (i.e. by invalidating cached pages from
the block devices).

Is this patch supposed to make virtio-blk support CD-ROMs?  In that case
a lot more work is necessary and it's probably better to use virtio-scsi
instead.

Is this patch purely supposed to make virtio-blk happy with empty
drives?  If so, then I'm not sure why that is a good idea since media
change isn't supported.

Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]