Raise an exception if starting neutron-l3-agent without creating a router

Bug #1226366 reported by Xiang Hui
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Xiang Hui

Bug Description

Version : Havana
OS : RHEL
Running Neutron services : neutron-server, neutron-openvswitch-agent, neutron-l3-agent
No routers being created, then the following exception will be raised.

2013-09-16 08:51:32.820 23737 ERROR neutron.openstack.common.rpc.amqp [-] Exception during message handling
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp Traceback (most recent call last):
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp File "/usr/lib/python2.6/site-packages/neutron/openstack/common/rpc/amqp.py", line 438, in _process_data
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp **args)
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp File "/usr/lib/python2.6/site-packages/neutron/common/rpc.py", line 44, in dispatch
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp neutron_ctxt, version, method, namespace, **kwargs)
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp File "/usr/lib/python2.6/site-packages/neutron/openstack/common/rpc/dispatcher.py", line 172, in dispatch
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp result = getattr(proxyobj, method)(ctxt, **kwargs)
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp File "/usr/lib/python2.6/site-packages/neutron/db/l3_rpc_base.py", line 54, in sync_routers
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp l3plugin.auto_schedule_routers(context, host, router_ids)
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp File "/usr/lib/python2.6/site-packages/neutron/db/l3_agentschedulers_db.py", line 241, in auto_schedule_routers
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp self, context, host, router_ids)
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp File "/usr/lib/python2.6/site-packages/neutron/scheduler/l3_agent_scheduler.py", line 113, in auto_schedule_routers
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp context.session.add(binding)
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/session.py", line 449, in __exit__
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp self.commit()
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/session.py", line 361, in commit
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp self._prepare_impl()
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/session.py", line 340, in _prepare_impl
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp self.session.flush()
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp File "/usr/lib/python2.6/site-packages/neutron/openstack/common/db/sqlalchemy/session.py", line 542, in _wrap
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp raise exception.DBError(e)
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp DBError: (IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`ovs_neutron`.`routerl3agentbindings`, CONSTRAINT `routerl3agentbindings_ibfk_1` FOREIGN KEY (`router_id`) REFERENCES `routers` (`id`) ON DELETE CASCADE)') 'INSERT INTO routerl3agentbindings (id, router_id, l3_agent_id) VALUES (%s, %s, %s)' ('28570d41-e7ab-4ca5-bed5-922bfbc154fc', '', '0214005e-8876-4bb1-a3b5-68f629b6e987')
2013-09-16 08:51:32.820 23737 TRACE neutron.openstack.common.rpc.amqp

The root cause is that the router_ids transferred is defined as [''], which is not None, but have an invalid empty value, the DB can't take this value in.

Xiang Hui (xianghui)
Changed in neutron:
assignee: nobody → Xiang Hui (xianghui)
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/46863

Changed in neutron:
status: New → In Progress
Revision history for this message
Salvatore Orlando (salvatore-orlando) wrote :

This looks to me a duplicate of https://bugs.launchpad.net/neutron/+bug/1210877

In that case, thanks for fixing two bugs with one patch!

Revision history for this message
Xiang Hui (xianghui) wrote :

Thanks Salvatore, I have missed this bug before.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/46863
Committed: http://github.com/openstack/neutron/commit/96e0eb23a458f068f540d98132ee261053c45585
Submitter: Jenkins
Branch: master

commit 96e0eb23a458f068f540d98132ee261053c45585
Author: Hui HX Xiang <email address hidden>
Date: Mon Sep 16 19:38:56 2013 -0700

    Raise an exception if no router_id provided

    IF both service neutron-l3-agent and neutron-server are up,
    but no router id configured in /etc/neutron/l3_agent.ini, an
    exception will be raised on DB as "DBError: IntegrityError",
    because the variable router_ids has a default '' value that
    doesn't match the DB grammar.

        * Check router id is specified in _init_() of l3 when
          not using namespace.
        * Move part of checking config params actions to new function
          _check_config_params()
        * Add corresponding unit tests.

    Closes-Bug: #1226366

    Change-Id: I905f8a4061c5b250782e025681dfefcc41c8c03c

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: havana-rc1 → 2013.2
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.