[libvirt] OpenVZ : cannot assign bridge to any interface

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@nict.go.jp

On Wed, Jul 22, 2009 at 02:55:59PM +0900, 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"
sounds a serious bug
[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'>
I was able to reproduce it, I'm still puzzled as where it comes from, basically virsh run that way as root does not call the daemon, it just looks up in the openvz driver, that driver is initialized and has a domain list, (gdb) p driver->domains $9 = {count = 1, objs = 0x734dc0} (gdb) p driver->domains->objs[0] $10 = (virDomainObjPtr) 0x734b10 (gdb) p *driver->domains->objs[0]->def $12 = {virtType = 0, id = -1, uuid = "A�\030�̮\025\v\236n�\027\036&\001u", name = 0x734850 "101", memory = 0, maxmem = 0, vcpus = 1, cpumasklen = 0, The domain object definition present is half complete, the virtType is zero, which translates to a qemu type. One more reason why I dislike the enum current impleemntation which are based on a significant 0 first value, this should have raised an error when converting to the string value. I have been unable to find out where the driver domain list is being initialized, breakpoints in virDomainLoadAllConfigs or virDomainObjNew fail to work, I have no idea yet where those half backed values come from. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Wed, Jul 22, 2009 at 02:55:59PM +0900, Yuji NISHIDA wrote:
Hi,
I'm bit confuing between 2 problems with libvirt-0.6.5 for OpenVZ.
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()
[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'>
This is a bug in the openvzLoadDomains() method, with it forgetting to fill in the virtType field. It shouldn't impact functional behaviour of the driver though. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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@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@nict.go.jp
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Yuji NISHIDA