From: Michal Privoznik <mprivozn@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio-blk: Allow startup of empty cdroms
Date: Thu, 7 Jan 2016 07:42:19 +0100 [thread overview]
Message-ID: <568E08CB.5050007@redhat.com> (raw)
In-Reply-To: <20160107044858.GB12971@stefanha-x1.localdomain>
On 07.01.2016 05:48, Stefan Hajnoczi wrote:
> 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 <mprivozn@redhat.com>
>> ---
>> 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.
Yeah, I realized I was aiming at CD-ROMs. But I'm not that familiar with
qemu to supply proper patch. It's just that after 39c4ae941ed992a3bb5 I
had to fix libvirt, because it was passing format= even for sourceless
devices. But while testing it I've noticed that virtio CD-ROMs still
don't work. This was my attempt to fix it. Well, maybe one day :)
Thanks!
Michal
prev parent reply other threads:[~2016-01-07 6:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-06 10:35 [Qemu-devel] [PATCH] virtio-blk: Allow startup of empty cdroms Michal Privoznik
2016-01-06 18:37 ` P J P
2016-01-07 4:48 ` Stefan Hajnoczi
2016-01-07 6:42 ` Michal Privoznik [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=568E08CB.5050007@redhat.com \
--to=mprivozn@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).