
On 12/25/2017 06:21 AM, Chen Hanxiao wrote:
From: Chen Hanxiao <chenhanxiao@gmail.com>
If we insert or eject a CD-ROM/floppy device with a boot order, we may get: unsupported configuration: boot order 2 is already used by another device
This check should be skipped in this case.
Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com> --- src/conf/domain_conf.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
Is there a specific reason for your assertion? Given what scenario? virDomainDefCompatibleDevice is called from Attach and Update qemu/lxc code currently. I dunno, but if someone is trying to attach or update a floppy/cdrom and wanted to use a boot index in use by something else, then I would think inhibiting that is a good idea...
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9a62bc472..885ab88d2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26880,11 +26880,19 @@ virDomainDeviceInfoCheckBootIndex(virDomainDefPtr def ATTRIBUTE_UNUSED, { virDomainDeviceInfoPtr newinfo = opaque;
+ int disk_device = device->data.disk->device;
Typically the deref would be something like virDomainDiskDefPtr disk = device->data.disk; and then "disk->device" BTW: @device would then no longer be ATTRIBUTE_UNUSED. John
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; }