kvm-host: revert remote DRBD role on migration error (untested)
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2625|0|2625|0|:zzz:
gitea/ansible-roles/pipeline/head This commit looks good

This commit is contained in:
Jérémy Lecour 2023-10-14 07:26:51 +02:00 committed by Jérémy Lecour
parent 3e55768c49
commit c194e6c664
Signed by: jlecour
SSH key fingerprint: SHA256:h+5LgHRKwN9lS0SsdVR5yZPeFlJE4Mt+8UtL4CcP8dY

View file

@ -299,6 +299,12 @@ migrate_to() {
if is_vm_running_locally "${vm}"; then
migrate_vm_to "${vm}" "${remote_ip}"
retcode=$?
if [ ${retcode} != 0 ]; then
echo "An error occured while migrating ${vm}: ${retval}" >&2
set_drbd_role secondary "${resource}" "${remote_ip}"
exit 1
fi
else
echo "${vm} is not running locally, so it won't be started on ${remote_host}"
fi