[libvirt] [PATCH v2 1/2] qemu: Check for existing hostdev address for cold attach device

Ján Tomko jtomko at redhat.com
Wed Jun 13 08:15:43 UTC 2018


On Tue, Jun 12, 2018 at 10:32:06AM -0400, John Ferlan wrote:
>Add a check during qemuDomainAttachDeviceConfig whether the
>new/incoming <hostdev ...> device would have an existing
><address> already and if so fail the attach. This can happen
>if two hostdev's are added supplying the same address or
>if the new hostdev address could possibly be a duplicate
>of an existing SCSI <disk>.
>
>Signed-off-by: John Ferlan <jferlan at redhat.com>
>---
> src/qemu/qemu_driver.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>index f0fb806fcd..ae8e0e898a 100644
>--- a/src/qemu/qemu_driver.c
>+++ b/src/qemu/qemu_driver.c
>@@ -8015,6 +8015,12 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
>                            _("device is already in the domain configuration"));
>             return -1;
>         }
>+        if (dev->data.hostdev->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
>+            virDomainDefHasDeviceAddress(vmdef, dev->data.hostdev->info)) {
>+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>+                           _("a device with the same address already exists "));
>+            return -1;
>+        }

This check feels out of place here. We should be checking for that in
postParse. Do we have the same problem on domain startup?

Jano

>         if (virDomainHostdevInsert(vmdef, hostdev))
>             return -1;
>         dev->data.hostdev = NULL;
>-- 
>2.14.4
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180613/76883693/attachment-0001.sig>


More information about the libvir-list mailing list