summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoden R <bodenvmw@gmail.com>2017-06-15 08:06:07 -0700
committerBoden R <bodenvmw@gmail.com>2017-06-16 14:02:39 -0600
commit5e5b75c5ea76a6a0611e91191ad88e1528442d37 (patch)
treecbe2479670ee3ca3e136c5aa7589b4e09894f281
parent751a779ee0d78500e9ccb253ea8581a776364395 (diff)
Address OVO breakage
Commit af52d499a53f9dddacd8c9116d1bb0570e8f579c broke the plugin. Co-Authored-By: Boden R <bodenvmw@gmail.com> Change-Id: I348e43539bfd54b5093f41e62000252955c3adc8 Depends-On: I740da1ea65a0af9451701e3a40fd673fa82f0f5b
Notes
Notes (review): Code-Review+1: Ihar Hrachyshka <ihrachys@redhat.com> Code-Review+2: boden <bodenvmw@gmail.com> Verified+1: VMware NSX CI Code-Review+2: Anna Khmelnitsky <akhmelnitsky@vmware.com> Workflow+1: Anna Khmelnitsky <akhmelnitsky@vmware.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Sat, 17 Jun 2017 04:39:57 +0000 Reviewed-on: https://review.openstack.org/474608 Project: openstack/vmware-nsx Branch: refs/heads/master
-rw-r--r--vmware_nsx/db/extended_security_group.py22
-rw-r--r--vmware_nsx/plugins/nsx_v/plugin.py5
2 files changed, 11 insertions, 16 deletions
diff --git a/vmware_nsx/db/extended_security_group.py b/vmware_nsx/db/extended_security_group.py
index 732220c..2a1a48a 100644
--- a/vmware_nsx/db/extended_security_group.py
+++ b/vmware_nsx/db/extended_security_group.py
@@ -24,6 +24,7 @@ from neutron.db import _resource_extend as resource_extend
24from neutron.db import api as db_api 24from neutron.db import api as db_api
25from neutron.db.models import securitygroup as securitygroups_db 25from neutron.db.models import securitygroup as securitygroups_db
26from neutron.extensions import securitygroup as ext_sg 26from neutron.extensions import securitygroup as ext_sg
27from neutron.objects import securitygroup as sg_obj
27from neutron_lib.api.definitions import port as port_def 28from neutron_lib.api.definitions import port as port_def
28from neutron_lib.api import validators 29from neutron_lib.api import validators
29from neutron_lib.callbacks import events 30from neutron_lib.callbacks import events
@@ -96,19 +97,14 @@ class ExtendedSecurityGroupPropertiesMixin(object):
96 if not default_sg: 97 if not default_sg:
97 self._ensure_default_security_group(context, tenant_id) 98 self._ensure_default_security_group(context, tenant_id)
98 99
99 with db_api.autonested_transaction(context.session): 100 with db_api.context_manager.writer.using(context):
100 security_group_db = securitygroups_db.SecurityGroup( 101 sg = sg_obj.SecurityGroup(
101 id=s.get('id') or (uuidutils.generate_uuid()), 102 context, id=s.get('id') or uuidutils.generate_uuid(),
102 description=s.get('description', ''), 103 description=s.get('description', ''), project_id=tenant_id,
103 tenant_id=tenant_id, 104 name=s.get('name', ''), is_default=default_sg)
104 name=s.get('name', '')) 105 sg.create()
105 context.session.add(security_group_db) 106
106 if default_sg: 107 secgroup_dict = self._make_security_group_dict(sg)
107 context.session.add(securitygroups_db.DefaultSecurityGroup(
108 security_group=security_group_db,
109 tenant_id=tenant_id))
110
111 secgroup_dict = self._make_security_group_dict(security_group_db)
112 secgroup_dict[sg_policy.POLICY] = s.get(sg_policy.POLICY) 108 secgroup_dict[sg_policy.POLICY] = s.get(sg_policy.POLICY)
113 secgroup_dict[provider_sg.PROVIDER] = is_provider 109 secgroup_dict[provider_sg.PROVIDER] = is_provider
114 kwargs['security_group'] = secgroup_dict 110 kwargs['security_group'] = secgroup_dict
diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py
index bbe11c6..dd527a5 100644
--- a/vmware_nsx/plugins/nsx_v/plugin.py
+++ b/vmware_nsx/plugins/nsx_v/plugin.py
@@ -77,6 +77,7 @@ from neutron.extensions import multiprovidernet as mpnet
77from neutron.extensions import providernet 77from neutron.extensions import providernet
78from neutron.extensions import securitygroup as ext_sg 78from neutron.extensions import securitygroup as ext_sg
79from neutron.extensions import vlantransparent as ext_vlan 79from neutron.extensions import vlantransparent as ext_vlan
80from neutron.objects import securitygroup
80from neutron.plugins.common import utils 81from neutron.plugins.common import utils
81from neutron.quota import resource_registry 82from neutron.quota import resource_registry
82from neutron.services.flavors import flavors_plugin 83from neutron.services.flavors import flavors_plugin
@@ -4154,9 +4155,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
4154 "nsx-rule %(nsx_rule_id)s doesn't exist.", 4155 "nsx-rule %(nsx_rule_id)s doesn't exist.",
4155 {'id': id, 'nsx_rule_id': nsx_rule_id}) 4156 {'id': id, 'nsx_rule_id': nsx_rule_id})
4156 4157
4157 with db_api.context_manager.writer.using(context): 4158 securitygroup.SecurityGroupRule.delete_objects(context, id=id)
4158 rule_db = self._get_security_group_rule(context, id)
4159 context.session.delete(rule_db)
4160 4159
4161 def _remove_vnic_from_spoofguard_policy(self, session, net_id, vnic_id): 4160 def _remove_vnic_from_spoofguard_policy(self, session, net_id, vnic_id):
4162 policy_id = nsxv_db.get_spoofguard_policy_id(session, net_id) 4161 policy_id = nsxv_db.get_spoofguard_policy_id(session, net_id)