← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1622574] Re: Metering-agent failed with TypeError to add/remove rule on router without gateway

 

I cannot reproduce this on master with commit
38434dfbc14a1d5d2f4a7985b31f0cf5b0a0ccdb(Oct 26).

My reproducing steps:
=================
1. neutron router-create test
2. neutron net-create test
3. neutron subnet-create test 192.168.1.0/24
4. neutron router-interface-add test <UUID of subnet in 3.>
5. neutron meter-label-create test
6. neutron meter-label-rule-create <UUID of meter label in 4.> 0.0.0.0/1

No errors found in the log file after step 6, instead I saw function
_add_metering_label_rule is called without failure. No iptables rule was
added which is expected as the router has no gateway.

With some more investigation I think this problem is already solved by
[1] which aimed at bug #1506567 as a side effect.

If a patch of unit tests improvement to prevent future regression is
worthy than I would like to help submitting one.

[1] https://review.openstack.org/#/c/377108/


** Changed in: neutron
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1622574

Title:
  Metering-agent failed with TypeError to add/remove rule on router
  without gateway

Status in neutron:
  Invalid

Bug description:
  Assuming that, there are routers that don't have gateway in tenant.
  When we try to add/remove meter label rule for the tenant,
  process in metering-agent failed with Type Error.
  Meter rules among other routers in the tenant won't be updated because of error above.

  Part of this bug is reported and fixed in following bug report.
  https://bugs.launchpad.net/neutron/+bug/1527274

  How to reproduce
  =================
  1.neutron router-create test
  2.neutron net-create test
  3.neutron subnet-create test 192.168.1.0/24
  4.neutron meter-label-create test
  5.neutron meter-label-create <UUID of meter label in 4.>

  After procedure 5, following error trace can be outputted.

  
  trace in metering-agent
  =======================
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server [req-5265cc49-4c97-4996-af45-2cacba64de84 da7194b4e98b4c8badc5912bbcd7aea4 9384ef06bc9d4af08a384692c92761ce
   - - -] Exception during message handling
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server Traceback (most recent call last):
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/server.py", line 133, in _process_incomin
  g
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     res = self.dispatcher.dispatch(message)
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 150, in dispatch
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     return self._do_dispatch(endpoint, method, ctxt, args)
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 121, in _do_dispatch
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     result = func(ctxt, **new_args)
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/usr/local/lib/python2.7/dist-packages/osprofiler/profiler.py", line 154, in wrapper
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     return f(*args, **kwargs)
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/opt/stack/neutron/neutron/services/metering/agents/metering_agent.py", line 212, in add_metering_l
  abel_rule
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     'add_metering_label_rule')
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/usr/local/lib/python2.7/dist-packages/oslo_concurrency/lockutils.py", line 271, in inner
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     return f(*args, **kwargs)
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/opt/stack/neutron/neutron/services/metering/agents/metering_agent.py", line 166, in _invoke_driver
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     return getattr(self.metering_driver, func_name)(context, meterings)
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/usr/local/lib/python2.7/dist-packages/oslo_log/helpers.py", line 48, in wrapper
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     return method(*args, **kwargs)
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/opt/stack/neutron/neutron/services/metering/drivers/iptables/iptables_driver.py", line 264, in add
  _metering_label_rule
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     self._add_metering_label_rule(router)
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/opt/stack/neutron/neutron/services/metering/drivers/iptables/iptables_driver.py", line 277, in _ad
  d_metering_label_rule
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     self._process_metering_rule_action(router, 'create')
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/opt/stack/neutron/neutron/services/metering/drivers/iptables/iptables_driver.py", line 286, in _process_metering_rule_action
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     ext_dev = self.get_external_device_name(rm.router['gw_port_id'])
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server   File "/opt/stack/neutron/neutron/services/metering/drivers/iptables/iptables_driver.py", line 133, in get_external_device_name
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server     return (EXTERNAL_DEV_PREFIX + port_id)[:self.driver.DEV_NAME_LEN]
  2016-09-12 11:09:12.629 4205 ERROR oslo_messaging.rpc.server TypeError: cannot concatenate 'str' and 'NoneType' objects

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1622574/+subscriptions


References