Merge "[API Replay] Fail fast by default"

This commit is contained in:
Zuul 2021-11-17 12:11:22 +00:00 committed by Gerrit Code Review
commit 5d96c1dac7
2 changed files with 14 additions and 4 deletions

View File

@ -64,7 +64,8 @@ class ApiReplayCli(object):
vif_ids_map=args.vif_ids_map,
logfile=args.logfile,
max_retry=args.max_retry,
cert_file=args.cert_file)
cert_file=args.cert_file,
ignore_errors=args.ignore_errors)
def _setup_argparse(self):
parser = argparse.ArgumentParser()
@ -206,7 +207,12 @@ class ApiReplayCli(object):
"--enable-barbican",
default=False,
action='store_true',
help="Meh")
help="Enable barbican connection for Octavia certificates")
parser.add_argument(
"--ignore-errors",
action='store_true',
default=False,
help="Continuing executing API replay even upon errors")
# NOTE: this will return an error message if any of the
# require options are missing.

View File

@ -58,7 +58,7 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
octavia_os_tenant_name, octavia_os_tenant_domain_id,
octavia_os_password, octavia_os_auth_url,
neutron_conf, ext_net_map, net_vni_map, int_vni_map,
vif_ids_map, logfile, max_retry, cert_file):
vif_ids_map, logfile, max_retry, cert_file, ignore_errors):
# Init config and logging
if neutron_conf:
@ -168,6 +168,7 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
self.n_errors = 0
self.errors = []
self.ignore_errors = ignore_errors
LOG.info("Starting NSX migration to %s.", self.dest_plugin)
# Migrate all the objects
@ -277,8 +278,11 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
return False
def add_error(self, msg):
self.n_errors = self.n_errors + 1
LOG.error(msg)
if not self.ignore_errors:
LOG.error("Error occurred during API replay: exiting")
sys.exit(1)
self.n_errors = self.n_errors + 1
self.errors.append(msg)
def migrate_quotas(self):