Merge "V2T migration: Create security group rules in bulk" into stable/train

This commit is contained in:
Zuul 2021-02-15 09:19:00 +00:00 committed by Gerrit Code Review
commit a852ce2990
1 changed files with 10 additions and 7 deletions

View File

@ -359,14 +359,17 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
{'sg': sg, 'e': e})
n_errors = n_errors + 1
# Note - policy security groups will have no rules, and will
# be created on the destination with the default rules only
for sg_rule in sg_rules:
try:
# Use bulk rules creation for the rules of the SG
if sg_rules:
rules = []
for sg_rule in sg_rules:
body = self.prepare_security_group_rule(sg_rule)
rule = self.dest_neutron.create_security_group_rule(
{'security_group_rule': body})
LOG.debug("created security group rule %s", rule['id'])
rules.append({'security_group_rule': body})
try:
rules = self.dest_neutron.create_security_group_rule(
{'security_group_rules': rules})
LOG.debug("created %s security group rules for SG %s",
len(rules), sg['id'])
except Exception:
# NOTE(arosen): when you create a default
# security group it is automatically populated