Update further

* Don't start the vm, as the commission/create of node will do
  that automatically
* Fix the maas node, if the mac address differ
This commit is contained in:
Arif Ali 2021-01-02 14:12:45 +00:00
parent 4edfca32ba
commit c17d888f45
Signed by: arif
GPG Key ID: 369608FBA1353A70
2 changed files with 9 additions and 5 deletions

View File

@ -139,13 +139,17 @@ maas_add_node()
maas_assign_networks ${system_id}
else
boot_int=$(maas ${maas_profile} machine read ${system_id} | jq ".boot_interface | {mac:.mac_address, int_d:.id}")
boot_int=$(maas ${maas_profile} machine read ${system_id} | jq ".boot_interface | {mac:.mac_address, int_id:.id}")
if [[ $mac_addr != "$(echo $boot_int | jq .mac | sed s/\"//g)" ]] ; then
maas $maas_profile interface update $(echo $boot_int | jq .int_id | sed s/\"//g) mac_addr=${mac_addr}
# A quick hack so that we can change the mac address of the interface.
# The machine needs to be broken, ready or allocated.
hack_commission=$(maas $maas_profile machine commission ${system_id})
hack_break=$(maas $maas_profile machine mark-broken ${system_id})
int_update=$(maas $maas_profile interface update ${system_id} $(echo $boot_int | jq .int_id | sed s/\"//g) mac_address=${mac_addr})
fi
maas ${maas_profile} machine update ${system_id} \
power_type=${power_type} ${power_params}
machine_power_update=$(maas ${maas_profile} machine update ${system_id} \
power_type=${power_type} ${power_params})
commission_node ${system_id}
fi

View File

@ -326,7 +326,7 @@ build_vms() {
virsh define "$virt_node.xml"
# Start the VM
virsh start "$virt_node" &
#virsh start "$virt_node" &
# Call the maas_add_node function, this will add the node to MAAS
maas_add_node ${virt_node} ${macaddr[0]} ${node_type} &