nsx_v3: Allow security group rule id to be specified

This is will be leverages in api-replay-mode for migrating neutron
deployments to nsx-v3. This patch allows us to preserve the same
security-group-rule-id.

Depends-On: Id4906cbdebd820d3349a4a3211ebb34491516c68
Change-Id: I0f5b48c2fc63c1bf8308f25d2fc7b0876eaeaf7f
This commit is contained in:
Aaron Rosen 2016-04-05 13:42:41 -07:00
parent c0e629a6b1
commit b3e0907e3a

View File

@ -1873,6 +1873,12 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
sg_rules = security_group_rules['security_group_rules']
for r in sg_rules:
self._check_local_ip_prefix(context, r['security_group_rule'])
# Generate id for security group rule or use one sepecified,
# if specified we are running in api-replay as server doesn't
# allow id to be specified by default
r['security_group_rule']['id'] = (
r['security_group_rule'].get('id') or
uuidutils.generate_uuid())
with context.session.begin(subtransactions=True):
rules_db = (super(NsxV3Plugin,