[libvirt] [PATCHv2] Add XML config switch to enable/disable vhost-net support

Eric Blake eblake at redhat.com
Fri Jan 14 19:02:41 UTC 2011


>      <interface type="network">
>        <model type="virtio"/>
>        <driver name="vhost"/>
> 
> will force use of vhost-net (if it's not available, the domain will
> fail to start). if driver name="qemu", vhost-net will not be used even
> if it is available.

> 
> Changes from V1:
> 
> enum now starts at 0 instead of -1. I just disallow "default" when
> parsing. This eliminates the need for vhost_specified.
> 
> Removed superfluous 3rd arg to open().

Thanks for those fixes.

> @@ -2559,6 +2567,19 @@ virDomainNetDefParseXML(virCapsPtr caps,
>          model = NULL;
>      }
>  
> +    if ((backend != NULL) &&
> +        (def->model && STREQ(def->model, "virtio"))) {
> +        int b;
> +        if (((b = virDomainNetBackendTypeFromString(backend)) < 0) ||
> +            (b == 0)) {

I probably would have done either this shorthand:

(b = virDomain...FromString) <= 0

or, keeping the long form, used a symbolic name rather than a magic number:

(b = virDomain...FromString) < 0 ||
(b == VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT)

But that's just style, so up to you if you want to make a tweak, or keep
it as-is.

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110114/aeef5abe/attachment-0001.sig>


More information about the libvir-list mailing list