B #4695: Target host cleanup on failed KVM live migration (#4698)

This commit is contained in:
Vlastimil Holer authored and GitHub committed 2020-05-11 19:04:17 +02:00
1 parent 4c77119fce
commit 203094ddd0
2 files changed
+25 -2

No files matched your search

+13 -2
View File
@@ -33,8 +33,19 @@ for snap in $snaps; do
"Failed to delete snapshot $snap from $deploy_id"
done
exec_and_log "virsh --connect $LIBVIRT_URI migrate --live $MIGRATE_OPTIONS $deploy_id $QEMU_PROTOCOL://$dest_host/system" \
"Could not migrate $deploy_id to $dest_host"
# do live migration, but cleanup target host in case of error
virsh --connect $LIBVIRT_URI migrate --live $MIGRATE_OPTIONS $deploy_id $QEMU_PROTOCOL://$dest_host/system
RC=$?
if [ $RC -ne 0 ]; then
for CLEAN_OP in destroy undefine; do
virsh --connect $QEMU_PROTOCOL://$dest_host/system "${CLEAN_OP}" $deploy_id >/dev/null 2>&1
done
error_message "Could not migrate $deploy_id to $dest_host"
exit $RC
fi
if [ "$SYNC_TIME" = "yes" ]; then
(
+12
View File
@@ -34,9 +34,21 @@ for snap in $snaps; do
"Failed to delete snapshot $snap from $deploy_id"
done
# do live migration, but cleanup target host in case of error
virsh --connect $QEMU_PROTOCOL://$src_host/system \
migrate --live $deploy_id $MIGRATE_OPTIONS $QEMU_PROTOCOL://$dest_host/system
RC=$?
if [ $RC -ne 0 ]; then
for CLEAN_OP in destroy undefine; do
virsh --connect $QEMU_PROTOCOL://$dest_host/system "${CLEAN_OP}" $deploy_id >/dev/null 2>&1
done
error_message "Could not migrate $deploy_id to $dest_host"
exit $RC
fi
if [ "$SYNC_TIME" = "yes" ]; then
(
for i in $(seq 3); do