I just want to summarize
XML for OpenVZ will looks like
<domain type='openvz'>
<name>209</name>
<uuid>8dea22b31d52d8f32516782e98ab8fa0</uuid>
<devices>
<filesystem type="template">
<source name="fedora-core-5-i386" />
<quota type="size" max="10000"/>
<quota type="inodes" max="200000"/>
</filesystem>
<interface type='bridge'> //for bridge
<source bridge='eth10'/>
<mac address='00:16:3e:5d:c7:9e'/>
</interface>
<interface type='bridge'> //for NAT
<source bridge='eth11'/>
<target type='network'>
<source network='default'/>
</target>
</interface>
<interface type='network'> //for phisical device
<host class='network' dev='eth1'/>
</interface>
<interface type='route'> //for routing network
<mac address='00:16:3e:34:21:9e'/>
<ip address="192.168.122.1" />
<ip address="192.168.122.15" />
</interface>
</devices>
</domain>
Please, correct if it is necessary.
On Wed, Jul 23, 2008 at 01:33:25PM +0400, Evgeniy Sokolov wrote:
>> On Tue, Jul 22, 2008 at 08:41:36PM +0400, Evgeniy Sokolov wrote:
>>>>> For tag domain/devices/interface:
>>>>> How to describe, if want to add ip addresses for routing network?
>>>> We'll probably want todo something based on <interface
type='ethernet'
>>>> which is a generic catch all config.
>>>>
>>>> Does OpenVZ support bridging, or NAT for containers ?
>>> bridging is supported.
>>> NAT can be configured via iptables.
>> If it supports bridging that is sufficient. The libvirt networking
>> APIs, allow us to implement NAT for any VM in terms of the generic
>> bridge support. Basically libvirt creates a bridge device 'virbr0'
>> and sets up NAT rules for that device. A guest VM simply needs to
>> be connected to virbr0, and then NAT automagically works for it.
> Do I correctly undertand? For NAT we shoud use tag "interface" with type
> "bridge" and
> <target dev="virbr0" />
No, you'd have something like
<target type='network'>
<source network='default'/>
</target>
And inside your driver you will call virNetworkLookupByName(...)
and then virNetworkGetBridge() to find the actual bridge device name.
Take a look at the QEMU driver 's qemudNetworkIfaceConnect() method
and how it deals with VIR_DOMAIN_NET_TYPE_NETWORK vs the alternative
VIR_DOMAIN_NET_TYPE_BRIDGE
Regards,
Daniel