mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-27 08:05:24 +00:00
9658e70f7d
When support for <interface type='ethernet'> was added in commit
9a4b705f
back in 2010, it erroneously looked at <source dev='blah'/>
for a user-specified guest-side interface name. This was never
documented though. (that attribute already existed at the time in the
data.ethernet union member of virDomainNetDef, but apparently had no
practical use - it was only used as a storage place for a NetDef's
bridge name during qemuDomainXMLToNative(), but even then that was
never used for anything).
When support for similar guest-side device naming was added to the lxc
driver several years later, it was put in a new subelement <guest
dev='blah'/>.
In the intervening years, since there was no validation that
ethernet.dev was NULL in the other drivers that didn't actually use
it, innocent souls who were adding other features assuming they needed
to account for non-NULL ethernet.dev when really they didn't, so
little bits of the usual pointless cargo-cult code showed up.
This patch not only switches the openvz driver to use the documented
<guest dev='blah'/> notation for naming the guest-side device (just in
case anyone is still using the openvz driver), and logs an error if
anyone tries to set <source dev='blah'/> for a type='ethernet'
interface, it also removes the cargo-cult uses of ethernet.dev and
<source dev='blah'/>, and eliminates if from the RNG and from
virDomainNetDef.
NB: I decided on this course of action after mentioning the
inconsistency here:
https://www.redhat.com/archives/libvir-list/2016-May/msg02038.html
and getting encouragement do eliminate it in a later IRC discussion
with danpb.
29 lines
874 B
XML
29 lines
874 B
XML
<domain type='xen' id='15'>
|
|
<name>pvtest</name>
|
|
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
|
<os>
|
|
<type>linux</type>
|
|
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
|
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
|
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
|
</os>
|
|
<memory unit='KiB'>430080</memory>
|
|
<vcpu>2</vcpu>
|
|
<on_poweroff>destroy</on_poweroff>
|
|
<on_reboot>destroy</on_reboot>
|
|
<on_crash>destroy</on_crash>
|
|
<devices>
|
|
<disk type='file' device='disk'>
|
|
<source file='/root/some.img'/>
|
|
<target dev='xvda'/>
|
|
</disk>
|
|
<interface type="ethernet">
|
|
<mac address="00:11:22:33:44:55"/>
|
|
<ip address="172.14.5.6"/>
|
|
<script path="vif-routed"/>
|
|
<target dev="vif4.0"/>
|
|
</interface>
|
|
<console tty='/dev/pts/4'/>
|
|
</devices>
|
|
</domain>
|