From d2074bf788e1b467114eb05d42181db9aec444ea Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Tue, 1 Nov 2022 08:05:28 +0000 Subject: [PATCH] Some updates to fix build fix typo for bridge_type fix network definitions for VMs remove the second disk from definition for asrock01 --- configs/asrock01.config | 2 +- manage-hypervisor-nodes.sh | 2 +- manage-vm-nodes.sh | 19 ++++++++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/configs/asrock01.config b/configs/asrock01.config index b11df65..8737f80 100644 --- a/configs/asrock01.config +++ b/configs/asrock01.config @@ -13,4 +13,4 @@ compute="as1-maas-node" disk_name=() disk_names+=(sda) disk_names+=(nvme0n1) -disk_names+=(nvme1n1) +#disk_names+=(nvme1n1) diff --git a/manage-hypervisor-nodes.sh b/manage-hypervisor-nodes.sh index c4d2a92..0c8a8ab 100755 --- a/manage-hypervisor-nodes.sh +++ b/manage-hypervisor-nodes.sh @@ -50,7 +50,7 @@ maas_assign_networks() fi # Check to see if the bridge interface already exists, otherwise create it bridge_int=$(maas ${maas_profile} interfaces read ${system_id} | jq --argjson vlan ${vlan} '.[] | select(.vlan.vid == $vlan) | select(.type == "bridge")') - [[ -z "${bridge_int}" ]] && bridge_int=$(maas ${maas_profile} interfaces create-bridge ${system_id} name=${bridges[$i]} vlan=$maas_vlan_id mac_address=${hypervisor_mac} parent=$vlan_int_id bridge_tyepe=${bridge_type}) + [[ -z "${bridge_int}" ]] && bridge_int=$(maas ${maas_profile} interfaces create-bridge ${system_id} name=${bridges[$i]} vlan=$maas_vlan_id mac_address=${hypervisor_mac} parent=$vlan_int_id bridge_type=${bridge_type}) bridge_int_id=$(echo $bridge_int | jq -r .id) cur_mode=$(echo $bridge_int | jq -r ".links[].mode") # If the mode is already set correctly, then move on diff --git a/manage-vm-nodes.sh b/manage-vm-nodes.sh index 5439825..c3132a3 100755 --- a/manage-vm-nodes.sh +++ b/manage-vm-nodes.sh @@ -350,13 +350,6 @@ build_vms() { net_type=(${networks[@]}) fi - # Now define the network definition - for ((net=0;net<${#net_type[@]};net++)); do - network_spec+=" --network=$net_prefix="${net_type[$net]}",model=$nic_model" - if [[ "${bridge_type}" == "ovs" ]] ; then - network_spec+=",virtualport_type=openvswitch" - fi - done if [[ $juju_total -le $juju_count ]] ; then printf -v virt_node %s-%02d "$hypervisor_name-juju" "$juju_total" @@ -365,7 +358,11 @@ build_vms() { vcpus="$juju_cpus" node_type="juju" + # Now define the network definition network_spec="--network=$net_prefix="${net_type[0]}",model=$nic_model" + if [[ "${bridge_type}" == "ovs" ]] ; then + network_spec+=",virtualport_type=openvswitch" + fi disk_spec="--disk path=$storage_path/$virt_node/$virt_node.img" disk_spec+=",format=$storage_format,size=${juju_disk},bus=$stg_bus,io=native,cache=directsync" @@ -391,6 +388,14 @@ build_vms() { disk_count=1 fi + # Now define the network definition + for ((net=0;net<${#net_type[@]};net++)); do + network_spec+=" --network=$net_prefix="${net_type[$net]}",model=$nic_model" + if [[ "${bridge_type}" == "ovs" ]] ; then + network_spec+=",virtualport_type=openvswitch" + fi + done + # Based on the disks array, it will create a definition to add these # disks to the VM disk_spec=""