]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Fix error returned when an HA router is updated to DVR
authorAssaf Muller <amuller@redhat.com>
Mon, 12 Oct 2015 20:17:13 +0000 (16:17 -0400)
committerAssaf Muller <amuller@redhat.com>
Mon, 12 Oct 2015 21:04:41 +0000 (17:04 -0400)
commitc1f2df2f6b87b435039d4cb52ccb14c0d9c53adc
tree5810c86c63b84167e517edc2711a3fb16c9c40c9
parent0afd4d6c3994b5cc1876f59c18a24a800a80e8b3
Fix error returned when an HA router is updated to DVR

Before this patch, the code compares the 'ha' flag that
comes in from the user, and the current state of the 'distributed'
flag in the DB. This is wrong because if a router is currently
HA in the DB, and the update request contains only
{'distributed': True}, then the 'ha' flag from the request
is None and the error condition is never raised!

The reason the unit tests
(Specifically test_migrate_ha_router_to_distributed)
did not catch this issue is because
of another bug: The _update_router helper method in the L3 HA
unit tests had an 'ha' default value of True, when it should
have had a default value of None. Setting it to None fails
the unit test (Because it raises the wrong exception),
and the contents of the patch makes the unit test pass.

Change-Id: Ie979b6a8400490b578ded17dc6529529e9637b34
Closes-Bug: #1505375
neutron/db/l3_hamode_db.py
neutron/tests/unit/db/test_l3_hamode_db.py