]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Router is not unscheduled when the last port is deleted
authorStephen Ma <stephen.ma@hp.com>
Tue, 24 Feb 2015 23:31:33 +0000 (23:31 +0000)
committerStephen Ma <stephen.ma@hp.com>
Fri, 10 Apr 2015 01:12:01 +0000 (01:12 +0000)
commitedbade486102a219810137d1c6b916e87475d477
treea1e74fff212d1ecfb09da9f46c80c98c34386400
parent483de6313fab5913f9e68eb24afe65c36bd9b623
Router is not unscheduled when the last port is deleted

When checking for ports that are still in use on a DVR router,
the L3 agent scheduler makes the assumption that a port's
network must be owned by the same tenant. This isn't always
true as the admin could have created a shared network that
other tenants may use. The result of this assumption is that
the router associated with the shared network may not be
unscheduled from a VM host when the last VM (created by a
non-admin tenant) using the shared network is deleted from
the compute node.

The owner of a VM may not own all the ports of a shared
network.  Other tenants may have VMs using the same shared
network running on the same compute node. Also the VM owner
may not own the router ports. In order to check whether a
router can be unscheduled from a node has to be run with
admin context so all the ports associated with router are
returned from database queries.

This patch fixes this problem by using the admin context to
make the queries needed for the DVR scheduler to make the
correct unschedule decision.

Change-Id: I45477713d7ce16f2451fa6fbe04c610388b06867
Closes-bug: #1424096
neutron/db/l3_dvrscheduler_db.py
neutron/tests/unit/scheduler/test_l3_agent_scheduler.py