From 85d4c5f1327a3f951c6ba283e34993bbb33ea5bd Mon Sep 17 00:00:00 2001 From: catborise Date: Wed, 21 Oct 2020 12:08:58 +0300 Subject: [PATCH] fix to prevent not opened connection close error --- instances/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/instances/utils.py b/instances/utils.py index c4f20b8..7624bab 100644 --- a/instances/utils.py +++ b/instances/utils.py @@ -144,7 +144,10 @@ def migrate_instance( compress, postcopy, ) + finally: + conn_migrate.close() + try: conn_new = wvmInstance( new_compute.hostname, new_compute.login, @@ -156,7 +159,6 @@ def migrate_instance( if autostart: conn_new.set_autostart(1) finally: - conn_migrate.close() conn_new.close() instance.compute = new_compute