Browse Source

Wait for the migration to finish

master
Alarig Le Lay 4 years ago
parent
commit
ab830f2694
  1. 6
      creationRoutesVM.sh
  2. 2
      inotify-triggered-vm-route-creation.sh

6
creationRoutesVM.sh

@ -175,6 +175,12 @@ for ID_RANGE_V4 in ${ID_RANGES_V4}; do
VM_IPV4=$(jq -r ".data[] | select(.custom_vm_id==\"${VM_ID}\") | .ip" ${CHEMIN_CACHE}/${ID_RANGE_V4})
# Wait for the migration to finish
sleep 5
while [ -f /run/qemu-server/${VM_ID}.migrate ]; do
sleep 1
done
# Si la valeur n'est pas vide et correspond à une IPV4
if [ -n "${VM_IPV4}" ]; then
# Ajout de la route associée

2
inotify-triggered-vm-route-creation.sh

@ -1,6 +1,6 @@
#!/bin/sh
inotifywait -q -m --format '%f' /run/qemu-server/ | while read -r vm; do
inotifywait -q -m --format '%f' -e create /run/qemu-server/ | while read -r vm; do
# Only act if the line is not empty
if [ ${vm} ] && [ "$(echo ${vm} | sed -E 's/[0-9]{3}(\..*)/\1/')" = ".qmp" ]; then
# The sed transforms 100.pid (or .whatever) to 100

Loading…
Cancel
Save