[libvirt] [PATCH] PCI passthrough docs, tests and minor change

Daniel P. Berrange berrange at redhat.com
Mon Jan 12 11:46:38 UTC 2009


On Mon, Jan 12, 2009 at 11:30:51AM +0100, Daniel Veillard wrote:
>   The following add the documentation for the PCI passthrough,
> extends the RNG and add an extra test for the QEmu parsing to
> args and serialization back to XML.
>   I also noticed that we parse (and save) and extra PCI domain
> argument, but it's not actually used when calling qemu, so I
> assume it's a missing feature for QEmu and just decided to patch
> the code to not save the extra value when not defined (i.e. 0).


> Index: src/domain_conf.c
> ===================================================================
> RCS file: /data/cvs/libxen/src/domain_conf.c,v
> retrieving revision 1.52
> diff -u -r1.52 domain_conf.c
> --- src/domain_conf.c	8 Jan 2009 13:54:20 -0000	1.52
> +++ src/domain_conf.c	12 Jan 2009 10:23:03 -0000
> @@ -3137,11 +3137,20 @@
>          }
>      }
>      if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
> -        virBufferVSprintf(buf, "        <address domain='0x%.4x' bus='0x%.2x' slot='0x%.2x' function='0x%.1x'/>\n",
> -                          def->source.subsys.u.pci.domain,
> -                          def->source.subsys.u.pci.bus,
> -                          def->source.subsys.u.pci.slot,
> -                          def->source.subsys.u.pci.function);
> +        if (def->source.subsys.u.pci.domain != 0) {
> +            virBufferVSprintf(buf,
> +    "        <address domain='0x%.4x' bus='0x%.2x' slot='0x%.2x' function='0x%.1x'/>\n",
> +                              def->source.subsys.u.pci.domain,
> +                              def->source.subsys.u.pci.bus,
> +                              def->source.subsys.u.pci.slot,
> +                              def->source.subsys.u.pci.function);
> +        } else {
> +            virBufferVSprintf(buf,
> +    "        <address bus='0x%.2x' slot='0x%.2x' function='0x%.1x'/>\n",
> +                              def->source.subsys.u.pci.bus,
> +                              def->source.subsys.u.pci.slot,
> +                              def->source.subsys.u.pci.function);
> +        }
>      }
>  
>      virBufferAddLit(buf, "      </source>\n");

NACK to this chunk - we should always output the 'domain' attribute
even when it is zero - it should only be optional when parsing the
XML. The fact that QEMU doesn't use it is just an impl artifact of
QEMU.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list