vz-net_add: fix a long-standing bug processing the list of network interfaces

Before commit 1cb8182a5e3cbc697996bca4445384764281c572, function
vz_get_local_dev (which is now vz_get_neighbour_devs) was called to get
the list of interfaces to send APR requests on, and the caller checked
its return code. Now that check is no more, which revealed the following bug.

vz_get_neighbour_devs use vzwarning to print a warning in case $NETDEVICES
is empty. When it's not empty, it should print a list of interfaces. The
problem is vzwarning also prints to stdout, which can lead to this
bacchanalia of warnings and errors:

 # vzctl set 101 --ipadd 10.0.0.101 --save
 Adding IP address(es): 10.0.0.101
 arpsend: unknown iface vps-net_add : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -D -e 10.0.0.101 vps-net_add FAILED
 arpsend: unknown iface WARNING: : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -D -e 10.0.0.101 WARNING: FAILED
 arpsend: unknown iface Device : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -D -e 10.0.0.101 Device FAILED
 arpsend: unknown iface list : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -D -e 10.0.0.101 list FAILED
 arpsend: unknown iface is : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -D -e 10.0.0.101 is FAILED
 arpsend: unknown iface empty : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -D -e 10.0.0.101 empty FAILED
 arpsend: unknown iface vps-net_add : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -U -i 10.0.0.101 -e 10.0.0.101 vps-net_add FAILED
 arpsend: unknown iface WARNING: : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -U -i 10.0.0.101 -e 10.0.0.101 WARNING: FAILED
 arpsend: unknown iface Device : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -U -i 10.0.0.101 -e 10.0.0.101 Device FAILED
 arpsend: unknown iface list : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -U -i 10.0.0.101 -e 10.0.0.101 list FAILED
 arpsend: unknown iface is : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -U -i 10.0.0.101 -e 10.0.0.101 is FAILED
 arpsend: unknown iface empty : No such device
 vps-net_add WARNING: arpsend -c 1 -w 1 -U -i 10.0.0.101 -e 10.0.0.101 empty FAILED
 SIOCADDRT: No such process
 Saved parameters for VE 101

As you can see, caller sees the warning message instead of a list of devices.

Fix that in a KISS manner by redirecting vzerror, vzwarning and vzdebug
output to stderr. This might also fix some other similar bugs (hopefully
not introducing other bugs).

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed