qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH 0/2] Guess host device type from guest device ty


From: Anthony Liguori
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
User-agent: Thunderbird 2.0.0.21 (X11/20090320)

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




reply via email to

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