labs: pass vm_name as arg to _vbox_configure_ifs

_vbox_configure_ifs should no longer use the environment variable
NODE_NAME as the name of the node VM. It gets replaced by the correct
value passed as an argument.

Change-Id: I9d36420bcf56bbabe2f47cee2d7eb2ad824bf5d1
This commit is contained in:
Roger Luethi 2014-08-31 13:49:05 +02:00
parent 6a0b7777da
commit 946114eb30

View File

@ -2,6 +2,7 @@
# Configure VirtualBox network interfaces
function _vbox_configure_ifs {
local vm_name=$1
# Iterate over all NET_IF_? variables
local net_ifs=( "${!NET_IF_@}" )
local net_if=""
@ -9,13 +10,13 @@ function _vbox_configure_ifs {
local if_num=${net_if##*_}
if [ "${!net_if}" = "nat" ]; then
echo "interface $if_num: NAT"
vm_nic_nat "$NODE_NAME" "$if_num"
vm_nic_nat "$vm_name" "$if_num"
else
# Host-only network: net_if is net name (e.g. API_NET)
# Use corresponding VirtualBox interface (e.g. API_NET_IF)
local host_if="${!net_if}_IF"
echo "interface $if_num: host-only ${!host_if}"
vm_nic_hostonly "$NODE_NAME" "$if_num" "${!host_if}"
vm_nic_hostonly "$vm_name" "$if_num" "${!host_if}"
fi
done
}
@ -47,7 +48,7 @@ function vm_init_node {
# Set VM_CPUS in config/config.NODE_NAME to override
vm_cpus "$vm_name" "${VM_CPUS:-1}"
_vbox_configure_ifs
_vbox_configure_ifs "$vm_name"
# Port forwarding
if [ -n "${VM_SSH_PORT:-}" ]; then