[libvirt] [PATCH 08/14] Store the interface vlan number in the domain state

Daniel Veillard veillard at redhat.com
Mon Jul 20 12:48:21 UTC 2009


On Mon, Jul 20, 2009 at 12:51:18PM +0100, Mark McLoughlin wrote:
> Currently, an interface's vlan number corresponds to its index in
> the table of network interfaces. That is no longer true when we
> allow devices to be removed.
> 
> To fix this, we store the vlan number in the domain's state XML
> so that it survives libvirtd restarts.
> 
> * src/domain_conf.h: add vlan number to virDomainNetDef
> 
> * src/domain_conf.c: store it in XML as <state vlan='N'/>, defaulting
>   to -1 if this is state saved by a previous version of libvirt
> 
> * src/qemu_conf.c: assign vlan numbers before starting qemu
[...]
> @@ -3614,6 +3624,8 @@ virDomainNetDefFormat(virConnectPtr conn,
>              virBufferEscapeString(buf, " nic='%s'", def->nic_name);
>          if (def->hostnet_name)
>              virBufferEscapeString(buf, " hostnet='%s'", def->hostnet_name);
> +        if (def->vlan > 0)
> +            virBufferVSprintf(buf, " vlan='%d'", def->vlan);
>          virBufferAddLit(buf, "/>\n");
>      }

  shouldn't we do that only when doing 'internal' dump, otherwise there
is a risk to expose this at the public dump level, where adding it is a
completely different issue.


  Otherwise looks fine.

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