From: Chen Hanxiao <chenhanxiao@xxxxxxxxx> If we insert or eject a CD-ROM/floppy device by: 'virsh change-media VM --eject/--insert some.iso --live', and the original CD-ROM device was configed with a boot order, we may get: unsupported configuration: boot order 2 is already used by another device We just updated 'source file' section rather than hotplug a new device. This check should be skipped in this case. Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxx> --- v2: commit message updated remove ATTRIBUTE_UNUSED from @device src/conf/domain_conf.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a1c25060f..e006cea0a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26881,17 +26881,26 @@ virDomainDeviceIsUSB(virDomainDeviceDefPtr dev) static int virDomainDeviceInfoCheckBootIndex(virDomainDefPtr def ATTRIBUTE_UNUSED, - virDomainDeviceDefPtr device ATTRIBUTE_UNUSED, + virDomainDeviceDefPtr device, virDomainDeviceInfoPtr info, void *opaque) { virDomainDeviceInfoPtr newinfo = opaque; + virDomainDiskDefPtr disk = device->data.disk; + int disk_device = disk->device; if (info->bootIndex == newinfo->bootIndex) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("boot order %u is already used by another device"), - newinfo->bootIndex); - return -1; + /* Skip check for insert or eject CD-ROM device */ + if (disk_device == VIR_DOMAIN_DISK_DEVICE_FLOPPY || + disk_device == VIR_DOMAIN_DISK_DEVICE_CDROM) { + VIR_DEBUG("Skip boot index check for floppy or CDROM"); + return 0; + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("boot order %u is already used by another device"), + newinfo->bootIndex); + return -1; + } } return 0; } -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list