NSX-V3: Fix security-group logging

Change-Id: I60da1de7ded89b34d2f83da73c3c366cd7571566
This commit is contained in:
Roey Chen 2016-11-16 06:42:01 -08:00
parent ec6763f3c9
commit 262105bb9d
1 changed files with 15 additions and 0 deletions

View File

@ -50,8 +50,23 @@ def get_values():
sa.Column('logging', sa.Boolean(),
nullable=False))
secgroup_table = sa.Table('securitygroups',
sa.MetaData(),
sa.Column('id', sa.String(36)))
# If we run NSX-V plugin then we want the current values for security-group
# logging, taken from the section mapping table.
for row in session.query(section_mapping_table).all():
values.append({'security_group_id': row.neutron_id,
'logging': row.logging})
# If we run NSX-V3 plugin then previous table is empty, since
# security-group logging isn't supported on previous versions, we set the
# current value to false (the default).
if not values:
for row in session.query(secgroup_table).all():
values.append({'security_group_id': row.id,
'logging': False})
session.commit()
return values