diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 890facf1b7..8a9c958c5c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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; } diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 9286436827..01f89bf182 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -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 */ };