[QoS][DSCP] 'delete_dscp_marking' function raises exception, 'vif_port' not present

Bug #1603443 reported by Rodolfo Alonso
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
David Shaughnessy

Bug Description

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'

Tags: qos
Changed in neutron:
assignee: nobody → David Shaughnessy (david-shaughnessy)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/345915

Changed in neutron:
status: New → In Progress
Changed in neutron:
status: In Progress → Confirmed
tags: added: qos
Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/345915
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=af8ca1bca6657f7152eeb0ca55bc7f3a0aea2301
Submitter: Jenkins
Branch: master

commit af8ca1bca6657f7152eeb0ca55bc7f3a0aea2301
Author: David Shaughnessy <email address hidden>
Date: Fri Aug 19 17:29:44 2016 +0100

    Retain port info from DSCP rule creation.

    When a VM is deleted all info except the port number is removed.
    delete_dscp_marking requires the ofport to be present.
    This results in an exception being thrown when a port with
    the DSCP_Marking rule attached is deleted.

    This patch:
    - Stores the port info when the dscp_marking rule is updated
      or created.
    - Pops the stored info when the dscp_marking rule is removed
      from the port or the port is deleted.
    - Expands existing unit tests for the QoS Open vswitch driver
      to cover this scenario.

    Change-Id: I77f632fdc7d612267af9a4a3bf0f74288696332b
    Closes-bug: #1603443

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 9.0.0.0rc1

This issue was fixed in the openstack/neutron 9.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.