mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: domain: Store whether a virStorageSource is a host CDROM drive
Use virFileIsCDROM to detect whether a block device is a cdrom drive and store it in virStorageSource. This will be necessary to correctly create the 'host_cdrom' backend in qemu when using -blockdev. We assume that host_cdrom makes only sense when used directly as a raw image, but if a backing chain would be put in front of it, libvirt will use 'host_device' in that case. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
f3282d1f9b
commit
e5dc760d0c
@ -7530,6 +7530,14 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
|
||||
VIR_ALLOC(src->backingStore) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* host cdrom requires special treatment in qemu, so we need to check
|
||||
* whether a block device is a cdrom */
|
||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
|
||||
src->format == VIR_STORAGE_FILE_RAW &&
|
||||
virStorageSourceIsBlockLocal(src) &&
|
||||
virFileIsCDROM(src->path) == 1)
|
||||
src->hostcdrom = true;
|
||||
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -316,6 +316,8 @@ struct _virStorageSource {
|
||||
|
||||
bool floppyimg; /* set to true if the storage source is going to be used
|
||||
as a source for floppy drive */
|
||||
|
||||
bool hostcdrom; /* backing device is a cdrom */
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user