[libvirt] [PATCH] Fix USB/PCI device address aliases in QEMU hotplug driver

Daniel Veillard veillard at redhat.com
Tue Mar 2 12:49:47 UTC 2010


On Mon, Mar 01, 2010 at 09:07:12PM +0000, Daniel P. Berrange wrote:
> The USB/PCI device hotplug code for the QEMU driver was forgetting
> to allocate a unique device alias.
> 
> * src/qemu/qemu_driver.c: Fill in device alias for USB/PCI devices
> ---
>  src/qemu/qemu_driver.c |   11 ++++++++---
>  1 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index c2bd46d..5ac3316 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -5878,6 +5878,8 @@ static int qemudDomainAttachHostPciDevice(struct qemud_driver *driver,
>      }
>  
>      if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
> +        if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
> +            goto error;
>          if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &hostdev->info) < 0)
>              goto error;
>  
> @@ -5926,9 +5928,12 @@ static int qemudDomainAttachHostUsbDevice(struct qemud_driver *driver,
>      qemuDomainObjPrivatePtr priv = vm->privateData;
>      char *devstr = NULL;
>  
> -    if ((qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) &&
> -        !(devstr = qemuBuildUSBHostdevDevStr(hostdev)))
> -        goto error;
> +    if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
> +        if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
> +            goto error;
> +        if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev)))
> +            goto error;
> +    }
>  
>      if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs+1) < 0) {
>          virReportOOMError();

  Missing part to fix Rolf Eike Beer reported problems, looks fine, ACK

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list