On Mon, 2009-07-20 at 14:48 +0200, Daniel Veillard wrote: > 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. Well spotted, at first I thought you were right and I'd missed it ... but all this code is within: if ((flags & VIR_DOMAIN_XML_INTERNAL_STATUS) && (def->nic_name || def->hostnet_name)) { which highlights another bug - I'm going to drop those checks, it doesn't matter if we end up with an empty <state/> element Cheers, Mark. -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list