Hi,
[1] bridge was created but no interface assigned to it
I found two evidences which could cause that.
One is my mistake in XML and the other is in /usr/sbin/vznetcfg.
<source bridge='guestnet101'/>
I should have specified bridge name here like
<source bridge='br101'/>
vznetcfg runs vznetaddbr but it couldn't do without knowing what the
path is.
In the context of vznetcfg, there is a line "VZNETCFG='/etc/vz/
vznet.conf'" which I think should know the path.
But there was not such a file.
I have confirmed that it could succeed after fixing these issues and
it was not caused by bugs of libvirt after all.
Anyway, thanks Daniel.
Best Regards.
-----
Yuji Nishida
nishidy(a)nict.go.jp
On 2009/07/22, at 14:55, Yuji NISHIDA wrote:
> Hi,
>
> I'm bit confuing between 2 problems with libvirt-0.6.5 for OpenVZ.
>
[1] bridge was created but no interface assigned to it
> [2]
virsh dumpxml returns xml in which type is "qemu"
>
>
> [1] -------------------------------------------------
> I tried libvirt-0.6.5 on Fedora8 to create OpenVZ container ( OpenVZ
> kernel is linux-2.6.18 ).
> A bridge was seemed to successfully create but no interface could
> not be assigned to the bridge.
> Due to that, ping could not reach the guest in container(10.0.1.2).
>
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
> [root@node13 test]# brctl show
> bridge name bridge id STP enabled interfaces
> br101 8000.000000000000 no
>
> [root@node13 test]# ifconfig -a
> br101 Link encap:Ethernet HWaddr 00:00:00:00:00:00
> inet addr:10.0.1.1 Bcast:10.0.1.15 Mask:255.255.255.240
> inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:0 (0.0 b) TX bytes:5031 (4.9 KiB)
>
> eth0 Link encap:Ethernet HWaddr 00:1C:C4:xx:xx:xx
> inet addr:133.xx.xx.xx Bcast:133.xx.xx.xx Mask:255.255.255.0
> inet6 addr: fe80::21c:c4ff:xxxx:xxxx/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:196949 errors:0 dropped:0 overruns:0 frame:0
> TX packets:64300 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:228373526 (217.7 MiB) TX bytes:5652593 (5.3 MiB)
> Interrupt:169
>
> eth1 Link encap:Ethernet HWaddr 00:1C:C4:xx:xx:xx
> BROADCAST MULTICAST MTU:1500 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
> Interrupt:50
>
> lo Link encap:Local Loopback
> inet addr:127.0.0.1 Mask:255.0.0.0
> inet6 addr: ::1/128 Scope:Host
> UP LOOPBACK RUNNING MTU:16436 Metric:1
> RX packets:323 errors:0 dropped:0 overruns:0 frame:0
> TX packets:323 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:29949 (29.2 KiB) TX bytes:29949 (29.2 KiB)
>
> sit0 Link encap:IPv6-in-IPv4
> NOARP MTU:1480 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
>
> venet0 Link encap:UNSPEC HWaddr
> 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
> UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
>
> veth101 Link encap:Ethernet HWaddr 52:54:00:52:C3:FF
> inet6 addr: fe80::5054:ff:fe52:c3ff/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
>
>
> The followings are python script and xml that I tested with.
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
> [root@node13 test]# cat test.py
> import libvirt
>
> conn = libvirt.open('openvz:///system')
> conn.networkDefineXML( file('net.xml').read() )
> conn.defineXML( file('test.xml').read() )
>
> net = conn.networkLookupByName('guestnet101')
> net.create()
>
> guest = conn.lookupByName('101')
> guest.create()
>
> [root@node13 test]# cat test.xml
> <domain type='openvz' id='101'>
> <name>101</name>
> <os>
> <type>exe</type>
> <init>/sbin/fakeinit.sh</init>
> </os>
> <memory>524288</memory>
> <devices>
> <filesystem type='template'>
> <source name='fedora-10-x86_64'/>
> <target dir='/'/>
> </filesystem>
> <console type='pty'/>
> <interface type='bridge'>
> <mac address="52:54:00:00:01:01" />
<source bridge='guestnet101'/>
>
<target dev='veth101'/>
> </interface>
>
> </devices>
> </domain>
>
> [root@node13 test]# cat net.xml
> <network>
> <name>guestnet101</name>
> <bridge name="br101" stp="off" />
> <forward mode="nat"/>
> <ip address="10.0.1.1" netmask="255.255.255.240">
> <dhcp>
> <range start="10.0.1.2" end="10.0.1.2" />
> </dhcp>
> </ip>
> </network>
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
>
>
> [2] -------------------------------------------------
> I guess "type" in domain must be 'openvz' but virsh dumpxml returns
> it as 'qemu'.
> ( The configuration of VE 101 remains in [1] )
>
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
> [root@node13 test]# virsh dumpxml 101
> <domain type='qemu' id='101'>
> <name>101</name>
> <uuid>dedee02b-b74f-6e43-f5ec-27050986efa8</uuid>
> <memory>0</memory>
> <currentMemory>0</currentMemory>
> <vcpu>1</vcpu>
> <os>
> <type>exe</type>
> <init>/sbin/init</init>
> </os>
> <clock offset='utc'/>
> <on_poweroff>destroy</on_poweroff>
> <on_reboot>destroy</on_reboot>
> <on_crash>destroy</on_crash>
> <devices>
> <filesystem type='template'>
> <source name='fedora-10-x86_64'/>
> <target dir='/'/>
> </filesystem>
> <interface type='bridge'>
> <mac address='52:54:00:00:01:01'/>
<source bridge='guestnet101'/>
>
<target dev='veth101'/>
> </interface>
> </devices>
> </domain>
>
> [root@node13 test]# virsh net-dumpxml guestnet101
> <network>
> <name>guestnet101</name>
> <uuid>5462e7a5-2048-3067-af9d-b134381a3f8a</uuid>
> <forward mode='nat'/>
> <bridge name='br101' stp='off' forwardDelay='0' />
> <ip address='10.0.1.1' netmask='255.255.255.240'>
> <dhcp>
> <range start='10.0.1.2' end='10.0.1.2' />
> </dhcp>
> </ip>
> </network>
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
>
> Regards.
>
> -----
> Yuji Nishida
> nishidy(a)nict.go.jp