sts/ruby-openvz

vzdeploy: failure when adding bridge devices

Opened this issue · 1 comments

Commit 86a237a introduced a regression:

[root@vh02 ~]# vzdeploy --bridge br_bond_v240 --interface vlan240 12004 fe-int3.<redacted> 10.<redacted>
[..]
* Adding interface ctid: 12004, bridge: br_bond_v240, vlanid: 240, ifname: vlan240/veth12004.vlan240
/usr/lib/ruby/gems/1.8/gems/openvz-1.5.5/lib/openvz/util.rb:54:in `execute': Cannot execute: '/usr/sbin/vzctl set 12004 --save --netif_add vlan240,E2:01:20:04:02:40,veth12004.vlan240,F2:01:20:04:02:40,br_bond_v240'. Return code: 21. Stderr: Bad parameter for --netif_add: vlan240,E2:01:20:04:02:40,veth12004.vlan240,F2:01:20:04:02:40,br_bond_v240 (RuntimeError)

The same command worked fine in earlier versions.

This was apparently caused by interface names limited to 16 characters.

I would ask you to either skip generating ct0 device names on your own and rely on vzctl's approach or offer a device name generator mode that mimicks vzctl's.

vzctl always creates devices named like:

veth$VEID.$NUMBERS_IN_CONTAINER_DEVICE_NAME

e.g.
ctid 13000, container device: eth3 -> veth13000.3
ctid 14000, container device vlan300 -> veth14000.300

This way, device names are short enough for Linux and still give you a hint what the devices in the guest are called.

For reference, see http://git.openvz.org/?p=vzctl;a=blob;f=src/lib/config.c;hb=HEAD#l1494 and http://git.openvz.org/?p=vzctl;a=blob;f=include/veth.h;hb=HEAD#l32