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