[libvirt] [PATCH 2/2] domain_conf: allow CDROM/Floppy media change with attach-device

Daniel Henrique Barboza danielhb413 at gmail.com
Wed Apr 10 21:49:07 UTC 2019


Commit f1d6585300 ("domain_conf: check device address before attach")
added an address verification for all devices, avoiding calling
the driver attach() for a case in which we know that the device
would have duplicated address.

That commit failed to contemplate the case of CDROM/Floppy devices
that can change and eject media using attach-device, an usage
that is also covered by this command. This patch adds an
extra condition for the added address verification code,
allowing CDROM/Floppy devices to bypass it.

Fixes: f1d6585300001c7b23b8796a0faa4411c3531996
Reported-by: Jim Fehlig <jfehlig at suse.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
---
 src/conf/domain_conf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b6be1e730d..f65a335d86 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -28597,6 +28597,7 @@ virDomainDefCompatibleDevice(virDomainDefPtr def,
     if (action == VIR_DOMAIN_DEVICE_ACTION_ATTACH &&
         data.newInfo &&
         data.newInfo->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
+        !virDomainDiskIsCdromOrFloppy(dev->data.disk) &&
         virDomainDefHasDeviceAddress(def, data.newInfo)) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("Domain already contains a device with the same address"));
-- 
2.20.1




More information about the libvir-list mailing list