summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-05-29 16:04:16 -0400
committerRussell Bryant <rbryant@redhat.com>2012-06-06 21:16:14 -0400
commit8db54f3bd590e71c6c6e383c928aa82fc28b3379 (patch)
tree20d349ec1fc8823adb3302f5800bc5bdf0db2192 /nova/api
parent7b7febb02b37420c759eab59b07c7e3e2de9bab1 (diff)
downloadnova-8db54f3bd590e71c6c6e383c928aa82fc28b3379.tar.gz
nova-8db54f3bd590e71c6c6e383c928aa82fc28b3379.tar.xz
nova-8db54f3bd590e71c6c6e383c928aa82fc28b3379.zip
Don't query nova-network on startup.
Fix bug 999698. nova-compute requested network info for each instance on startup via rpc. If all services get (re)started at the same time, nova-network may not be available to take this request, resulting in a lost request. To combat this issue, get the network info from the cache in the database on startup. If by some chance this information is not correct, it will get fixed up by a periodic task. Change-Id: I0bbd475e078ac2a67c99c2be4711e86d617c609a
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/common.py10
-rw-r--r--nova/api/openstack/compute/contrib/cloudpipe.py4
2 files changed, 4 insertions, 10 deletions
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py
index 3756f91a8..93b5a36ab 100644
--- a/nova/api/openstack/common.py
+++ b/nova/api/openstack/common.py
@@ -26,11 +26,11 @@ from xml.dom import minidom
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova.compute import task_states
+from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova import exception
from nova import flags
from nova import log as logging
-from nova.network import model as network_model
from nova import quota
@@ -321,12 +321,6 @@ def get_networks_for_instance_from_nw_info(nw_info):
return networks
-def get_nw_info_for_instance(context, instance):
- info_cache = instance['info_cache'] or {}
- cached_nwinfo = info_cache.get('network_info') or []
- return network_model.NetworkInfo.hydrate(cached_nwinfo)
-
-
def get_networks_for_instance(context, instance):
"""Returns a prepared nw_info list for passing into the view builders
@@ -338,7 +332,7 @@ def get_networks_for_instance(context, instance):
{'addr': '172.16.2.1', 'version': 4}]},
...}
"""
- nw_info = get_nw_info_for_instance(context, instance)
+ nw_info = compute_utils.get_nw_info_for_instance(instance)
return get_networks_for_instance_from_nw_info(nw_info)
diff --git a/nova/api/openstack/compute/contrib/cloudpipe.py b/nova/api/openstack/compute/contrib/cloudpipe.py
index b0d17ff14..1d4c63da0 100644
--- a/nova/api/openstack/compute/contrib/cloudpipe.py
+++ b/nova/api/openstack/compute/contrib/cloudpipe.py
@@ -16,13 +16,13 @@
import os
-from nova.api.openstack import common
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova.auth import manager
from nova.cloudpipe import pipelib
from nova import compute
+from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova import db
from nova import exception
@@ -91,7 +91,7 @@ class CloudpipeController(object):
return rv
rv['instance_id'] = instance['uuid']
rv['created_at'] = utils.isotime(instance['created_at'])
- nw_info = common.get_nw_info_for_instance(elevated, instance)
+ nw_info = compute_utils.get_nw_info_for_instance(instance)
if not nw_info:
return rv
vif = nw_info[0]