From 2567ff0cf3c66f42551b1db847685010ad05b4c1 Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Sun, 27 Dec 2020 10:12:42 +0000 Subject: [PATCH] Add option to update all networks --- manage-maas-nodes.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/manage-maas-nodes.sh b/manage-maas-nodes.sh index 365997b..9c1e095 100755 --- a/manage-maas-nodes.sh +++ b/manage-maas-nodes.sh @@ -55,6 +55,24 @@ wipe_vms() { destroy_vms } +fix_networks() +{ + install_deps + maas_login + fix_maas_networks +} + +# Fixes all the networks on all the VMs +fix_maas_networks() { + for ((virt="$node_start"; virt<=node_count; virt++)); do + printf -v virt_node %s-%02d "$compute" "$virt" + system_id=$(maas_system_id ${virt_node}) + + maas_auto_assign_networks ${system_id} & + done + wait +} + # Creates the disks for all the nodes create_storage() { for ((virt="$node_start"; virt<=node_count; virt++)); do @@ -237,6 +255,9 @@ while getopts ":cwd" opt; do d) wipe_disks ;; + n) + fix_networks + ;; \?) printf "Unrecognized option: -%s. Valid options are:" "$OPTARG" >&2 show_help