From: Anthony Liguori <anthony@codemonkey.ws>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Cole Robinson <crobinso@redhat.com>
Subject: [Qemu-devel] Re: [PATCH 0/2] Guess host device type from guest device type for block devices
Date: Wed, 17 Jun 2009 17:17:24 -0500 [thread overview]
Message-ID: <4A396B74.3010400@codemonkey.ws> (raw)
In-Reply-To: <1245270508-23315-1-git-send-email-ehabkost@redhat.com>
Eduardo Habkost wrote:
> This fixes the following issue:
> https://bugzilla.redhat.com/show_bug.cgi?id=473154
>
> Sometimes a CD-ROM drive path doesn't start with /dev/cdrom, causing problems
> if a disk isn't inserted on the drive. With this patch, the floppy and cdrom
> drivers are used if using a host block device as backend and the
> virtual device type is floppy or CD-ROM.
>
Filename based probing is bad, but I think your solution is flawed too.
It breaks the case where someone does:
qemu -hda /dev/volumes/RH5-iso
Where /dev/volumes/RH5-iso is just a plain LVM volume. I can think of
legitimate reasons to do this.
I think a better approach would be to try and issue a cdrom-specific
ioctl without side-effects, and then use that probe to decide whether
it's a cdrom. For instance, CDROM_DRIVE_STATUS ought to be pretty safe.
Long term, I think we want to take a more thorough approach to host
devices. First, we should use fstat instead of filenames to determine
whether something is a host device.
We should then use the info in fstat to determine what type of device it
is. Then we can use host-specific mechanisms to determine what the host
device type is.
For instance, on Linux, the right thing to do is:
lstat(path) -> test -e /sys/dev/block/<major>:<minor>/capability ->
capability & GENHD_FL_CD
Regards,
Anthony Liguori
prev parent reply other threads:[~2009-06-17 22:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-17 20:28 [Qemu-devel] [PATCH 0/2] Guess host device type from guest device type for block devices Eduardo Habkost
2009-06-17 20:28 ` [Qemu-devel] [PATCH 1/2] Add a BlockDriverState parameter to bdrv_probe_device() Eduardo Habkost
2009-06-17 20:28 ` [Qemu-devel] [PATCH 2/2] Guess host device type from requested guest device type Eduardo Habkost
2009-06-17 22:17 ` Anthony Liguori [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=4A396B74.3010400@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=crobinso@redhat.com \
--cc=ehabkost@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).