DESCRIPTION.
During the deletion of a port with a QoS policy and a DSCP rule, an exception is trown. That happens because the port information passed to the function doesn't have the "vif_port" information; this port was already deleted before.
HOW TO REPRODUCE.
- Create a VM with a port.
- Create a QoS policy.
- Create a QoS rule, DSCP.
- Assign this QoS rule to the port.
- Delete the port (the VM).
--> the error will be thrown.
POSSIBLE SOLUTION.
This function needs to reed the "in_port" to delete the flows. When the port is deleted, the QoS Agent is called only with the port UUID. But QosAgentExtension stores all port info in self.policy_map.
- If this port is stored, retrieve the in_port info and return it in
def _process_reset_port(self, port):
try:
<NEW PORT INFO> = self.policy_map.clean_by_port(port)
self.qos_driver.delete(port)
- If the port is not stored, no QoS was applied and no clean action is needed.
ERROR LOG.
2016-07-15 14:23:03.285 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent [req-5c858304-88a8-427b-aae4-7dd7616db182 None None] Error while processing VIF ports
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent Traceback (most recent call last):
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent File "/opt/stack/neutron/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py", line 2038, in rpc_loop
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent port_info, ovs_restarted)
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 147, in wrapper
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent return f(*args, **kwargs)
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent File "/opt/stack/neutron/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py", line 1658, in process_network_ports
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent port_info['removed'])
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 147, in wrapper
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent return f(*args, **kwargs)
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent File "/opt/stack/neutron/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py", line 1585, in treat_devices_removed
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent self.ext_manager.delete_port(self.context, {'port_id': device})
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent File "/opt/stack/neutron/neutron/agent/l2/extensions/manager.py", line 80, in delete_port
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent extension.obj.delete_port(context, data)
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent File "/opt/stack/neutron/neutron/agent/l2/extensions/qos.py", line 316, in delete_port
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent self._process_reset_port(port, delete=True)
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent File "/opt/stack/neutron/neutron/agent/l2/extensions/qos.py", line 337, in _process_reset_port
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent self.qos_driver.delete(port)
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent File "/opt/stack/neutron/neutron/agent/l2/extensions/qos.py", line 120, in delete
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent self._exec_action_rules("delete", port, rule_type)
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent File "/opt/stack/neutron/neutron/agent/l2/extensions/qos.py", line 140, in _exec_action_rules
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent handler(port)
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent File "/opt/stack/neutron/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py", line 118, in delete_dscp_marking
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent port_name = port['vif_port'].port_name
2016-07-15 14:23:03.285 TRACE neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent KeyError: 'vif_port'
Fix proposed to branch: master /review. openstack. org/345915
Review: https:/