Re: [PATCH V2 2/4] libxl: support hotplug USB host device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/23/2016 12:51 AM, Chun Yan Liu wrote:
>
> Yes, I think it's OK. And another place needs to be updated, since now it's
> not only pci device, but also could be usb device, so the error message
> should be updated.
>              if (virDomainHostdevFind(vmdef, hostdev, &found) >= 0) {
> -                pcisrc = &hostdev->source.subsys.u.pci;
>                  virReportError(VIR_ERR_OPERATION_FAILED,
> -                               _("target pci device %.4x:%.2x:%.2x.%.1x\
> -                                  already exists"),
> -                               pcisrc->addr.domain, pcisrc->addr.bus,
> -                               pcisrc->addr.slot, pcisrc->addr.function);
> +                               _("device already exists in domain configuration"));
>                  return -1;
>              }

Nice catch. I've squashed in the below diff, changing the error code and message
to match the qemu driver.

Regards,
Jim


diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 5b6f87a..4d7124d 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3293,7 +3293,6 @@ libxlDomainAttachDeviceConfig(virDomainDefPtr vmdef,
virDomainDeviceDefPtr dev)
     virDomainNetDefPtr net;
     virDomainHostdevDefPtr hostdev;
     virDomainHostdevDefPtr found;
-    virDomainHostdevSubsysPCIPtr pcisrc;
     char mac[VIR_MAC_STRING_BUFLEN];
 
     switch (dev->type) {
@@ -3336,12 +3335,8 @@ libxlDomainAttachDeviceConfig(virDomainDefPtr vmdef,
virDomainDeviceDefPtr dev)
             }
 
             if (virDomainHostdevFind(vmdef, hostdev, &found) >= 0) {
-                pcisrc = &hostdev->source.subsys.u.pci;
-                virReportError(VIR_ERR_OPERATION_FAILED,
-                               _("target pci device %.4x:%.2x:%.2x.%.1x\
-                                  already exists"),
-                               pcisrc->addr.domain, pcisrc->addr.bus,
-                               pcisrc->addr.slot, pcisrc->addr.function);
+                virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                               _("device is already in the domain configuration"));
                 return -1;
             }
 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]