yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #49801
[Bug 1527274] Re: Neutron-metering-agent failed to add rule on router without gateway
Reviewed: https://review.openstack.org/307122
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=f73dae0a65a6b63cffae5c5e3c2f98d4f0e35ccf
Submitter: Jenkins
Branch: master
commit f73dae0a65a6b63cffae5c5e3c2f98d4f0e35ccf
Author: Sergey Belous <sbelous@xxxxxxxxxxxx>
Date: Mon Apr 18 14:39:45 2016 +0300
Add check that external gw port exist when metering-agent adds a rule
If router has no gateway port when metering-agent wants to add
a metering-label-rule method _process_metering_label_rules() fails
with error "cannot concatenate 'str' and 'NoneType' objects"
because there is no check that router has an external gateway port.
This patch adds this check and adds some unit test.
Closes-bug: #1527274
Change-Id: Ic9f626db41bfb6343187742e209402dd7d5232d1
** Changed in: neutron
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1527274
Title:
Neutron-metering-agent failed to add rule on router without gateway
Status in neutron:
Fix Released
Bug description:
If we trying to create meter-label-rule and there is a router without
external gateway, then the metering agent will raise an error:
2015-12-17 08:56:44.659 ERROR oslo_messaging.rpc.dispatcher [req-732f65fb-9a4e-4883-b545-3cb080c8cdae admin f8267bb3db654ca2a26a07d9757ec280] Exception during message handling: cannot concatenate 'str' and 'NoneType' objects
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher Traceback (most recent call last):
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 142, in _dispatch_and_reply
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher executor_callback))
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 186, in _dispatch
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher executor_callback)
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 129, in _do_dispatch
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher result = func(ctxt, **new_args)
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/neutron/neutron/services/metering/agents/metering_agent.py", line 222, in add_metering_label_rule
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher 'add_metering_label_rule')
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_concurrency/lockutils.py", line 271, in inner
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/neutron/neutron/services/metering/agents/metering_agent.py", line 176, in _invoke_driver
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher return getattr(self.metering_driver, func_name)(context, meterings)
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_log/helpers.py", line 46, in wrapper
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher return method(*args, **kwargs)
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/neutron/neutron/services/metering/drivers/iptables/iptables_driver.py", line 259, in add_metering_label_rule
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher self._add_metering_label_rule(router)
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/neutron/neutron/services/metering/drivers/iptables/iptables_driver.py", line 272, in _add_metering_label_rule
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher self._process_metering_rule_action(router, 'create')
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/neutron/neutron/services/metering/drivers/iptables/iptables_driver.py", line 281, in _process_metering_rule_action
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher ext_dev = self.get_external_device_name(rm.router['gw_port_id'])
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/neutron/neutron/services/metering/drivers/iptables/iptables_driver.py", line 132, in get_external_device_name
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher return (EXTERNAL_DEV_PREFIX + port_id)[:self.driver.DEV_NAME_LEN]
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher TypeError: cannot concatenate 'str' and 'NoneType' objects
2015-12-17 08:56:44.659 TRACE oslo_messaging.rpc.dispatcher
Steps to reproduce:
1. Create internal net, subnet, router. Add interface to router for created net. Boot vm in created net.
2. Create neutron-meter-label
3. Try to create meter-label-rule
4. Rule not appear in iptables on router-namespace and after that we can see traces in neutron-meter-agent's logs like above.
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1527274/+subscriptions
References