summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Lee <aaron.lee@rackspace.com>2012-02-23 14:24:38 -0600
committerAaron Lee <aaron.lee@rackspace.com>2012-02-23 14:24:38 -0600
commit695fa6ca4467e0cddb8964a4b9cd10a69ec83161 (patch)
treec949beabdc8c84020044a554a7b9cfd2c7b58df4
parentd4199375078311961c2d65bb575556adf669e40f (diff)
downloadnova-695fa6ca4467e0cddb8964a4b9cd10a69ec83161.tar.gz
nova-695fa6ca4467e0cddb8964a4b9cd10a69ec83161.tar.xz
nova-695fa6ca4467e0cddb8964a4b9cd10a69ec83161.zip
Fixes error if Melange returns no networks
If melange returns no networks for the tenant the loop that loads instance from the DB will not run, causing an error. This loop also loads the same instance every iteration, which is inefficient. This small change fixes that. Change-Id: I34d410fae3919e9e3f268d98efd01eecd2ed0a3f
-rw-r--r--nova/network/quantum/manager.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/nova/network/quantum/manager.py b/nova/network/quantum/manager.py
index 79f278401..c6132056e 100644
--- a/nova/network/quantum/manager.py
+++ b/nova/network/quantum/manager.py
@@ -287,6 +287,7 @@ class QuantumManager(manager.FloatingIP, manager.FlatManager):
project_id = kwargs['project_id']
LOG.debug(_("network allocations for instance %s"), project_id)
requested_networks = kwargs.get('requested_networks')
+ instance = db.instance_get(context, instance_id)
net_proj_pairs = self.ipam.get_project_and_global_net_ids(context,
project_id)
@@ -315,7 +316,6 @@ class QuantumManager(manager.FloatingIP, manager.FlatManager):
project_id)
# talk to Quantum API to create and attach port.
- instance = db.instance_get(context, instance_id)
nova_id = self._get_nova_id(instance)
# Tell the ipam library to allocate an IP
ips = self.ipam.allocate_fixed_ips(context, project_id,