libvirt/tests/lxcxml2xmldata/lxc-ethernet-hostip.xml

45 lines
1.4 KiB
XML
Raw Normal View History

conf: support host-side IP/route information in <interface> This is place as a sub-element of <source>, where other aspects of the host-side connection to the network device are located (network or bridge name, udp listen port, etc). It's a bit odd that the interface we're configuring with this info is itself named in <target dev='x'/>, but that ship sailed long ago: <interface type='ethernet'> <mac address='00:16:3e:0f:ef:8a'/> <source> <ip address='192.168.122.12' family='ipv4' prefix='24' peer='192.168.122.1'/> <ip address='192.168.122.13' family='ipv4' prefix='24'/> <route family='ipv4' address='0.0.0.0' gateway='192.168.122.1'/> <route family='ipv4' address='192.168.124.0' prefix='24' gateway='192.168.124.1'/> </source> </interface> In practice, this will likely only be useful for type='ethernet', so its presence in any other type of interface is currently forbidden in the generic device Validate function (but it's been put into the general population of virDomainNetDef rather than the ethernet-specific union member so that 1) we can more easily add the capability to other types if needed, and 2) we can retain the info when set to an invalid interface type all the way through to validation and report a proper error, rather than just ignoring it (which is currently what happens for many other type-specific settings). (NB: The already-existing configuration of IP info for the guest-side of interfaces is in subelements directly under <interface>, and the name of the guest-side interface (when configurable) is in <guest dev='x'/>). (This patch had been pushed earlier in commit fe6a77898a38f491403a70cc49925a584101daee, but was reverted in commit d658456530c1010a49f45865613ed361a0fcc5b4 because it had been accidentally pushed during the freeze for release 2.0.0)
2016-06-09 19:35:08 +00:00
<domain type='lxc'>
<name>8675309</name>
<uuid>e21987a5-e98e-9c99-0e35-803e4d9ad1fe</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64'>exe</type>
<init>/sbin/init</init>
</os>
<idmap>
<uid start='0' target='100000' count='100000'/>
<gid start='0' target='100000' count='100000'/>
</idmap>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<filesystem type='mount' accessmode='passthrough'>
<source dir='/mach/8675309'/>
<target dir='/'/>
</filesystem>
<interface type='ethernet'>
<mac address='00:16:3e:0f:ef:8a'/>
<source>
<ip address='192.168.122.12' family='ipv4' prefix='24' peer='192.168.122.1'/>
<ip address='192.168.122.13' family='ipv4' prefix='24'/>
<route family='ipv4' address='0.0.0.0' gateway='192.168.122.1'/>
<route family='ipv4' address='192.168.124.0' prefix='24' gateway='192.168.124.1'/>
</source>
<ip address='192.168.122.1' family='ipv4' prefix='32' peer='192.168.122.12'/>
<guest dev='eth2'/>
</interface>
<console type='pty'>
<target type='lxc' port='0'/>
</console>
</devices>
<seclabel type='none'/>
</domain>