TVD: make security group logging more robust

Ensure that DVS security groups (which do not have this extension)
do not cause exceptions

Change-Id: I1a318347f92d6d793768dd20d653c872a3f75da3
This commit is contained in:
Gary Kotton 2018-01-21 01:53:27 -08:00 committed by garyk
parent 6268a1f313
commit 8960282459
2 changed files with 2 additions and 2 deletions
vmware_nsx/plugins

@ -561,7 +561,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
# If the section/sg is already logged, then no action is
# required.
for sg in [sg for sg in self.get_security_groups(context)
if sg[sg_logging.LOGGING] is False]:
if sg.get(sg_logging.LOGGING) is False]:
if sg.get(sg_policy.POLICY):
# Logging is not relevant with a policy
continue

@ -667,7 +667,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
fields=['id',
sg_logging.LOGGING])
for sg in [sg for sg in secgroups
if sg[sg_logging.LOGGING] is False]:
if sg.get(sg_logging.LOGGING) is False]:
nsgroup_id, section_id = nsx_db.get_sg_mappings(
context.session, sg['id'])
if section_id: