-update_pxe_network() {
- local -n vnode_networks=$1
- if virsh net-info "${vnode_networks[0]}" >/dev/null 2>&1; then
- # set static ip address for salt master node, only if managed via virsh
- # NOTE: below expr assume PXE network is always the first in domiflist
- virsh net-update "${vnode_networks[0]}" add ip-dhcp-host \
- "<host mac='$(virsh domiflist cfg01 | awk '/network/ {print $5; exit}')' name='cfg01' ip='${SALT_MASTER}'/>" --live
- fi
+update_mcpcontrol_network() {
+ # set static ip address for salt master node, MaaS node
+ # shellcheck disable=SC2155
+ local cmac=$(virsh domiflist cfg01 2>&1| awk '/mcpcontrol/ {print $5; exit}')
+ # shellcheck disable=SC2155
+ local amac=$(virsh domiflist mas01 2>&1| awk '/mcpcontrol/ {print $5; exit}')
+ virsh net-update "mcpcontrol" add ip-dhcp-host \
+ "<host mac='${cmac}' name='cfg01' ip='${SALT_MASTER}'/>" --live
+ [ -z "${amac}" ] || virsh net-update "mcpcontrol" add ip-dhcp-host \
+ "<host mac='${amac}' name='mas01' ip='${MAAS_IP}'/>" --live