mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
qemu: command: Anotate formatting of the frontend attributes with -drive
Explain that certain attributes formatted with -drive are in fact attributes of the drive itself and not the storage backing it.
This commit is contained in:
@@ -1764,8 +1764,13 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
|||||||
virBufferAsprintf(&opt, ",index=%d", idx);
|
virBufferAsprintf(&opt, ",index=%d", idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Format attributes for the drive itself (not the storage backing it) which
|
||||||
|
* we've formatted historically with -drive */
|
||||||
qemuBuildDiskFrontendAttributes(disk, qemuCaps, &opt);
|
qemuBuildDiskFrontendAttributes(disk, qemuCaps, &opt);
|
||||||
|
|
||||||
|
/* While this is a frontend attribute, it only makes sense to be used when
|
||||||
|
* legacy -drive is used. In modern qemu the 'ide-cd' or 'scsi-cd' are used.
|
||||||
|
* virtio and other just ignore the attribute anyways */
|
||||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
|
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
|
||||||
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
|
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
|
||||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_CD))
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_CD))
|
||||||
@@ -1778,12 +1783,15 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is a frontend attribute which was replaced by bootindex passed in
|
||||||
|
* with -device arguments. */
|
||||||
if (bootable &&
|
if (bootable &&
|
||||||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) &&
|
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) &&
|
||||||
(disk->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
|
(disk->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
|
||||||
disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
|
disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
|
||||||
disk->bus != VIR_DOMAIN_DISK_BUS_IDE)
|
disk->bus != VIR_DOMAIN_DISK_BUS_IDE)
|
||||||
virBufferAddLit(&opt, ",boot=on");
|
virBufferAddLit(&opt, ",boot=on");
|
||||||
|
|
||||||
if (disk->src->readonly)
|
if (disk->src->readonly)
|
||||||
virBufferAddLit(&opt, ",readonly=on");
|
virBufferAddLit(&opt, ",readonly=on");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user