Merge "NSX|V do not update SG logging if SG has a policy"

This commit is contained in:
Jenkins 2016-11-15 22:44:48 +00:00 committed by Gerrit Code Review
commit c8b566329a

View File

@ -421,6 +421,10 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
# required. # required.
for sg in [sg for sg in self.get_security_groups(context) for sg in [sg for sg in self.get_security_groups(context)
if sg[sg_logging.LOGGING] is False]: if sg[sg_logging.LOGGING] is False]:
if sg.get(sg_policy.POLICY):
# Logging is not relevant with a policy
continue
section_uri = self._get_section_uri(context.session, section_uri = self._get_section_uri(context.session,
sg['id']) sg['id'])
if section_uri is None: if section_uri is None:
@ -440,8 +444,9 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
section_uri, section_uri,
self.nsx_sg_utils.to_xml_string(section), h) self.nsx_sg_utils.to_xml_string(section), h)
except Exception as exc: except Exception as exc:
LOG.error(_LE('Unable to update section for logging. ' LOG.error(_LE('Unable to update security group %(sg)s '
'%s'), exc) 'section for logging. %(e)s'),
{'e': exc, 'sg': sg['id']})
c_utils.spawn_n(process_security_groups_rules_logging) c_utils.spawn_n(process_security_groups_rules_logging)