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

Re: [libvirt] [PATCH 09/10] Convert PCI device assignment over to -device



On Tue, Dec 15, 2009 at 03:14:49PM +0000, Daniel P. Berrange wrote:
> The old syntax is
> 
>   -pcidevice host=BUS:SLOT:FUNCTION
> 
> The new syntax is
> 
>   -device pci-assign,host=BUS:SLOT:FUNCTION
> ---
>  src/qemu/qemu_conf.c |   26 +++++++++++++++-----------
>  1 files changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index ac322a7..f8c6ae6 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -2852,22 +2852,26 @@ int qemudBuildCommandLine(virConnectPtr conn,
>          /* PCI */
>          if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
>              hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
> -            if (!(qemuCmdFlags & QEMUD_CMD_FLAG_PCIDEVICE)) {
> +            if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
> +                ADD_ARG_LIT("-device");
> +                ret = virAsprintf(&pcidev, "pci-assign,host=%.2x:%.2x.%.1x",
> +                                  hostdev->source.subsys.u.pci.bus,
> +                                  hostdev->source.subsys.u.pci.slot,
> +                                  hostdev->source.subsys.u.pci.function);
> +            } else if (qemuCmdFlags & QEMUD_CMD_FLAG_PCIDEVICE) {
> +                ADD_ARG_LIT("-pcidevice");
> +                ret = virAsprintf(&pcidev, "host=%.2x:%.2x.%.1x",
> +                                  hostdev->source.subsys.u.pci.bus,
> +                                  hostdev->source.subsys.u.pci.slot,
> +                                  hostdev->source.subsys.u.pci.function);
> +            } else {
>                  qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT, "%s",
>                                   _("PCI device assignment is not supported by this version of qemu"));
>                  goto error;
>              }
> -            ret = virAsprintf(&pcidev, "host=%.2x:%.2x.%.1x",
> -                           hostdev->source.subsys.u.pci.bus,
> -                           hostdev->source.subsys.u.pci.slot,
> -                           hostdev->source.subsys.u.pci.function);
> -            if (ret < 0) {
> -                pcidev = NULL;
> +            if (ret < 0)
>                  goto no_memory;
> -            }
> -            ADD_ARG_LIT("-pcidevice");
> -            ADD_ARG_LIT(pcidev);
> -            VIR_FREE(pcidev);
> +            ADD_ARG(pcidev);
>          }
>      }
>  

  ACK,

Daniel

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


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