Re: [PATCHv3 07/10] Reserve existing USB addresses

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

 



On 23/06/16 09:45, Ján Tomko wrote:
> Check if they fit on the USB controllers the domain has,
> and error out if two devices try to use the same address.
> ---
>  src/conf/domain_addr.c                             | 39 ++++++++++++++++++++++
>  src/conf/domain_addr.h                             |  4 +++
>  src/libvirt_private.syms                           |  1 +
>  src/qemu/qemu_domain.h                             |  1 +
>  src/qemu/qemu_domain_address.c                     | 38 ++++++++++++++++++++-
>  .../qemuxml2argv-usb-hub-conflict.xml              | 22 ++++++++++++
>  tests/qemuxml2argvtest.c                           |  3 ++
>  7 files changed, 107 insertions(+), 1 deletion(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-hub-conflict.xml
> 
> diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
> index 343ae0c..853f4ce 100644
> --- a/src/conf/domain_addr.c
> +++ b/src/conf/domain_addr.c
> @@ -1558,3 +1558,42 @@ int virDomainUSBAddressSetAddControllers(virDomainUSBAddressSetPtr addrs,
>      }
>      return 0;
>  }
> +
> +
> +int
> +virDomainUSBAddressReserve(virDomainDeviceInfoPtr info,
> +                           void *data)
> +{
> +    virDomainUSBAddressSetPtr addrs = data;
> +    virDomainUSBAddressHubPtr targetHub = NULL;
> +    char *portStr = NULL;
> +    int ret = -1;
> +    int targetPort;
> +
> +    if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB)
> +        return 0;
> +
> +    portStr = virDomainUSBAddressPortFormat(info->addr.usb.port);

So when you leave out the *port* attribute, and attempt to define such
domain would result in an unknown error, yet defining such a domain
worked previously just fine (yes, there were/are other issues with
that). But you already realized this, since you posted a patch
(https://www.redhat.com/archives/libvir-list/2016-June/msg01973.html) to
make the port attribute mandatory (See my comment there).
Compared to the behaviour of PCI address assignment, one would assume
that if you omit an attribute that the docs does not specify as
mandatory, everything will turn out just fine for the USB addresses, as
it is the case with PCI addresses.

Erik

--
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]