From 27dfb6f12dda752902d5ecea79489961dc2d1a40 Mon Sep 17 00:00:00 2001 From: "pulsar89.5" Date: Tue, 16 May 2023 21:29:28 +0200 Subject: [PATCH] =?UTF-8?q?[EVO]=20G=C3=A9rer=20les=20machines=20redond?= =?UTF-8?q?=C3=A9es=20(finissant=20par=20une=20lettre)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- balance-containers/run.bash | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/balance-containers/run.bash b/balance-containers/run.bash index 03d0d5e..a547d78 100755 --- a/balance-containers/run.bash +++ b/balance-containers/run.bash @@ -24,9 +24,16 @@ show_usage() { } move_ct() { - echo -n " move: " - lxc move --target $target $ct 2> /dev/null - [[ $? -eq 0 ]] && echo "success" || echo "failed" + # SI la machine est redondée (nom finissant par un charactère) + if [[ "$(lxc list --columns Ln --format csv $ct | awk '/[0-9][a-z]$/')" == "${ct}" ]]; then + echo " move: skipped" + else + echo " move: pending" + lxc move --target $target $ct 2> /dev/null + lxc_move_result=$? + echo -n " move: " + [[ $? -eq 0 ]] && echo "success" || echo "failed" + fi } migrate_ct() {