From f3eeb6e2eb750f1b896da75c8198d474df94bd62 Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Mon, 10 Jan 2022 10:33:38 +0000 Subject: [PATCH] move the node_count definition If there are mods in the configs, then the node_count would not be initialised correctly. Moving to the read_configs function fixes this --- configs/default.config | 7 ------- functions.sh | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/configs/default.config b/configs/default.config index 31f3cd6..ec32a03 100644 --- a/configs/default.config +++ b/configs/default.config @@ -34,13 +34,6 @@ node_start=1 node_cpus=2 node_ram=4096 -# Dynamically generate the node count -# The amount of memory add on 10% then divide by node_ram then add 1 -# For a 32GB machine we'll get 10 VMs altogether -# 1 x 4GB juju, 1 x 8GB controler, 8 x 4GB compute -# The juju VM is not included in the count -node_count=$(( (( `cat /proc/meminfo | grep -i memtotal | awk '{print $2}'` - ( ${control_count} * ${control_ram} * 1024 )) * 11 / 10) / 1024 / ${node_ram} + (7*7/10) )) - # Disks to create on each VM disks=() disks+=(150) diff --git a/functions.sh b/functions.sh index 23f6c42..5e84a0f 100644 --- a/functions.sh +++ b/functions.sh @@ -223,6 +223,13 @@ read_configs() for config in $configs ; do read_config $config done + + # Dynamically generate the node count + # The amount of memory add on 10% then divide by node_ram then add 1 + # For a 32GB machine we'll get 10 VMs altogether + # 1 x 4GB juju, 1 x 8GB controler, 8 x 4GB compute + # The juju VM is not included in the count + node_count=$(( (( `cat /proc/meminfo | grep -i memtotal | awk '{print $2}'` - ( ${control_count} * ${control_ram} * 1024 )) * 11 / 10) / 1024 / ${node_ram} + (7*7/10) )) } read_config()