Wait for the migration to finish

This commit is contained in:
Alarig Le Lay 2019-01-25 11:15:48 +01:00
parent 5dc278405f
commit ab830f2694
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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