ovsfw: Load vlan tag from other_config

OVS agent stores vlan tag only to other_config before
setup_port_filter() is called [1], leaving 'tag' column empty. This
patch loads tag from correct place and modifies functional tests
accordingly.

Closes-Bug: 1566934
[1] 1efed3a532/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py (L821)

Change-Id: Iaae46ce7362fedfc53af958600d6d712eb382e9f
(cherry picked from commit dabd969090)
This commit is contained in:
Jakub Libosvar 2016-04-07 10:09:13 +00:00
parent a2d1c46fe7
commit 2e2d75cbc2
2 changed files with 14 additions and 4 deletions

View File

@ -16,7 +16,7 @@
import netaddr
from oslo_log import log as logging
from neutron._i18n import _, _LE
from neutron._i18n import _, _LE, _LW
from neutron.agent import firewall
from neutron.agent.linux.openvswitch_firewall import constants as ovsfw_consts
from neutron.agent.linux.openvswitch_firewall import rules
@ -245,9 +245,14 @@ class OVSFirewallDriver(firewall.FirewallDriver):
raise OVSFWPortNotFound(port_id=port_id)
try:
port_vlan_id = int(self.int_br.br.db_get_val(
'Port', ovs_port.port_name, 'tag'))
except TypeError:
other_config = self.int_br.br.db_get_val(
'Port', ovs_port.port_name, 'other_config')
port_vlan_id = int(other_config['tag'])
except (KeyError, TypeError):
LOG.warning(_LW("Can't get tag for port %(port_id)s from its "
"other_config: %(other_config)s"),
port_id=port_id,
other_config=other_config)
port_vlan_id = ovs_consts.DEAD_VLAN_TAG
of_port = OFPort(port, ovs_port, port_vlan_id)
self.sg_port_map.create_port(of_port, port)

View File

@ -357,6 +357,11 @@ class OVSConnectionTester(ConnectionTester):
def set_tag(self, port_name, tag):
self.bridge.set_db_attribute('Port', port_name, 'tag', tag)
other_config = self.bridge.db_get_val(
'Port', port_name, 'other_config')
other_config['tag'] = tag
self.bridge.set_db_attribute(
'Port', port_name, 'other_config', other_config)
def set_vm_tag(self, tag):
self.set_tag(self._vm.port.name, tag)