1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

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

This commit is contained in:
Vlastimil Holer 2020-05-11 19:04:17 +02:00 committed by GitHub
parent 4c77119fce
commit 203094ddd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 2 deletions

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
(

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