From b3e0907e3adc9b5350edc05f3b87ab3d4da40d80 Mon Sep 17 00:00:00 2001 From: Aaron Rosen Date: Tue, 5 Apr 2016 13:42:41 -0700 Subject: [PATCH] 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 --- vmware_nsx/plugins/nsx_v3/plugin.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vmware_nsx/plugins/nsx_v3/plugin.py b/vmware_nsx/plugins/nsx_v3/plugin.py index 7a69ac52d4..d0bc5a6771 100644 --- a/vmware_nsx/plugins/nsx_v3/plugin.py +++ b/vmware_nsx/plugins/nsx_v3/plugin.py @@ -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,