Skip to content

Commit

Permalink
Fix for bug 901459
Browse files Browse the repository at this point in the history
Fix cut and paste error: change project_id to p['id'] as project_id
doesn't exist in this scope.

Also added project creation to the unit test which would have caught
this.

Change-Id: I1bd53265e3d622a59969eb286c3fbde471374c73
  • Loading branch information
Brad Hall committed Dec 7, 2011
1 parent 9985d1f commit 35782f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nova/network/quantum/manager.py
Expand Up @@ -100,7 +100,7 @@ def get_all_networks(self):
projects = db.project_get_all(admin_context)
for p in projects:
networks.extend(self.ipam.get_project_networks(admin_context,
project_id))
p['id']))
return networks

def create_networks(self, context, label, cidr, multi_host, num_networks,
Expand Down
11 changes: 11 additions & 0 deletions nova/tests/test_quantum.py
Expand Up @@ -193,6 +193,12 @@ class QuantumNovaTestCase(test.TestCase):
def setUp(self):
super(QuantumNovaTestCase, self).setUp()

# Create an actual project -- with this we will touch more of
# the code in QuantumManager (related to fetching networks, etc)
for x in ['fake_project1', 'fake_project2']:
values = {'id': x, 'name': x}
project = db.project_create(context.get_admin_context(), values)

self.net_man = quantum_manager.QuantumManager(
ipam_lib="nova.network.quantum.nova_ipam_lib",
q_conn=FakeQuantumClientConnection())
Expand All @@ -214,6 +220,11 @@ def setUp(self):
for fip_ref in result:
session.delete(fip_ref)

def tearDown(self):
# Clean up our projects
db.project_delete(context.get_admin_context(), 'fake_project1')
db.project_delete(context.get_admin_context(), 'fake_project2')

def _create_network(self, n):
ctx = context.RequestContext('user1', n['project_id'])
nwks = self.net_man.create_networks(
Expand Down

0 comments on commit 35782f2

Please sign in to comment.