Merge "labs: pass vm_name as arg to _vbox_configure_ifs"

This commit is contained in:
Jenkins 2014-09-01 19:34:22 +00:00 committed by Gerrit Code Review
commit f678c9ebe8

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