From 4dcbab843d2d3ad2905229023b35548dcdcd5c7d Mon Sep 17 00:00:00 2001 From: asarfaty Date: Sun, 29 Nov 2020 12:13:18 +0200 Subject: [PATCH] MP2P migration: no retry & long wait for rollbacks Change-Id: I23d9c92492193dee35371124cf1fc4250426b90a --- .../shell/admin/plugins/nsxv3/resources/migration.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vmware_nsx/shell/admin/plugins/nsxv3/resources/migration.py b/vmware_nsx/shell/admin/plugins/nsxv3/resources/migration.py index 7046255fec..cf82bda98c 100644 --- a/vmware_nsx/shell/admin/plugins/nsxv3/resources/migration.py +++ b/vmware_nsx/shell/admin/plugins/nsxv3/resources/migration.py @@ -113,9 +113,12 @@ def send_migration_request(nsxlib, body): return nsxlib.client.url_post("migration/mp-to-policy", body) -def send_rollback_request(nsxlib, body): +def send_rollback_request(body): #TODO(asarfaty): Rollback can take very long, especially for firewall # sections. In this case backup-restore might be better + + # Using a new nsxlib instance to avoid retries, and add a long timeout + nsxlib = _get_nsxlib_from_config(verbose=True, for_end_api=True) return nsxlib.client.url_post("migration/mp-to-policy/rollback", body) @@ -1273,8 +1276,8 @@ def migrate_t_resources_2_p(nsxlib, nsxpolicy, plugin): global ROLLBACK_DATA if ROLLBACK_DATA: LOG.info("Rolling migration back %s", ROLLBACK_DATA) - send_rollback_request(nsxlib, - {'migration_data': ROLLBACK_DATA}) + send_rollback_request({'migration_data': ROLLBACK_DATA}) + LOG.info("Roll back done.") # Finalize the migration (Also needed after rollback) end_migration_process() # Stop the migration service