Skip to content

Commit

Permalink
cluster: polising tools
Browse files Browse the repository at this point in the history
  • Loading branch information
JanSkalny committed Nov 2, 2024
1 parent a272c00 commit 9b5e98c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cluster/files/cluster-balance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ wait_for_healthy_cluster
# balance VMs for each service group
for GROUP in $( grep service_group /var/lib/virtual/conf/*.xml | cut -d '>' -f 2 | cut -d '<' -f 1 | sort | uniq ); do

echo ""
echo "Solving service group $GROUP..."

VM_CNT=0
Expand All @@ -59,10 +60,15 @@ for GROUP in $( grep service_group /var/lib/virtual/conf/*.xml | cut -d '>' -f 2

echo "- $NAME ($VM) running on $ACTIVE_NODE"
UNUSED_NODES=($( echo "${UNUSED_NODES[@]}" | tr ' ' '\n' | grep -v $ACTIVE_NODE) )
#XXX: this produces empty strings in array :/
#XXX: this produces empty strings in array :/
#UNUSED_NODES=("${UNUSED_NODES[@]/$ACTIVE_NODE}")
done

if [ ${#UNUSED_NODES[@]} -eq 0 ]; then
warn "No valid migrations tagrets. Ignored group $GROUP!"
continue
fi

echo "Valid migration targets are:"
for NODE in "${UNUSED_NODES[@]}"; do
echo "- $NODE"
Expand Down Expand Up @@ -120,7 +126,6 @@ for GROUP in $( grep service_group /var/lib/virtual/conf/*.xml | cut -d '>' -f 2
echo -n " $i"
sleep 1
done
echo ""
fi

if [[ "$SIMULATE" == true ]]; then
Expand All @@ -140,7 +145,6 @@ for GROUP in $( grep service_group /var/lib/virtual/conf/*.xml | cut -d '>' -f 2
wait_for_healthy_cluster
fi
done
echo ""
done

# make sure cluster is clean when we're done
Expand Down

0 comments on commit 9b5e98c

Please sign in to comment.