[metering agent] Failed to get any traffic data if the first chain is missing

Bug #1421037 reported by Feilong Wang
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Feilong Wang

Bug Description

Based on current implement, if there is any reason caused the chain of metering label is missing, the whole function of iptables_driver.get_traffic_counters() will be broken, see https://github.com/openstack/neutron/blob/master/neutron/services/metering/drivers/iptables/iptables_driver.py#L275

2015-02-03 22:47:25.486 6384 ERROR neutron.services.metering.agents.metering_agent [req-47dbfc00-1812-423a-9f68-ce26dc54243a None] Driver neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver:get_traffic_counters runtime error
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent Traceback (most recent call last):
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent File "/usr/lib/python2.7/dist-packages/neutron/services/metering/agents/metering_agent.py", line 177, in _invoke_driver
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent return getattr(self.metering_driver, func_name)(context, meterings)
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent File "/usr/lib/python2.7/dist-packages/neutron/common/log.py", line 34, in wrapper
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent return method(*args, **kwargs)
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent File "/usr/lib/python2.7/dist-packages/neutron/services/metering/drivers/iptables/iptables_driver.py", line 275, in get_traffic_counters
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent chain, wrap=False, zero=True)
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/iptables_manager.py", line 627, in get_traffic_counters
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent root_helper=self.root_helper))
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent File "/usr/lib/python2.7/dist-packages/neutron/agent/linux/utils.py", line 82, in execute
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent raise RuntimeError(m)
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent RuntimeError:
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent Command: ['sudo', 'neutron-rootwrap', '/etc/neutron/rootwrap.conf', 'ip', 'netns', 'exec', 'qrouter-a9123cfe-9277-49ea-a2c5-1c9581e277d2', 'iptables', '-t', 'filter', '-L', 'neutron-meter-l-c760740b-33a', '-n', '-v', '-x', '-Z']
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent Exit code: 1
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent Stdout: ''
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent Stderr: 'iptables: No chain/target/match by that name.\n'
2015-02-03 22:47:25.486 6384 TRACE neutron.services.metering.agents.metering_agent

Tags: metering
Feilong Wang (flwang)
Changed in neutron:
assignee: nobody → Fei Long Wang (flwang)
status: New → In Progress
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/156198

Feilong Wang (flwang)
description: updated
Kyle Mestery (mestery)
Changed in neutron:
milestone: none → kilo-3
importance: Undecided → Medium
tags: added: metering
Kyle Mestery (mestery)
Changed in neutron:
milestone: kilo-3 → kilo-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

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

commit c3b7f1b2ae7af995f4815e3571c9828683dc0db7
Author: Fei Long Wang <email address hidden>
Date: Tue Feb 17 00:58:45 2015 +1300

    Fix metering agent failure when chain missing

    The metering agent will fail if one of the iptables chains
    is missing, which will cause errors extracting data from
    all the other chains. Add a simple try/except to let the
    loop continue.

    Closes-Bug: #1421037

    Change-Id: I370ee0e2cc58ca7e1c5ef9bf4dbcce5abf7545a1

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: kilo-rc1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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