diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-02-11 00:05:30 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-02-11 00:05:30 +0000 |
| commit | 600314f6cfcdf3f858f76df7b047732ecf314339 (patch) | |
| tree | f8efe7b06d6114e166216b5bf93db9c1dcaa63f5 /nova/api | |
| parent | 8e1ef669640f575bf44e69b9b58634bfc78a4fe3 (diff) | |
| parent | 58f8f93b52e7de2d3751dd3291427a65a3c1079b (diff) | |
| download | nova-600314f6cfcdf3f858f76df7b047732ecf314339.tar.gz nova-600314f6cfcdf3f858f76df7b047732ecf314339.tar.xz nova-600314f6cfcdf3f858f76df7b047732ecf314339.zip | |
Merge "Handle network api failures more gracefully"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/common.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py index 903649c02..e5231c483 100644 --- a/nova/api/openstack/common.py +++ b/nova/api/openstack/common.py @@ -27,6 +27,7 @@ from nova.api.openstack import wsgi from nova.api.openstack import xmlutil from nova.compute import vm_states from nova.compute import task_states +from nova import exception from nova import flags from nova import log as logging from nova import network @@ -334,10 +335,16 @@ def get_networks_for_instance(context, instance): # sqlalchemy FK (KeyError, AttributeError) # fail fall back to calling out the the # network api - network_api = network.API() + pass + network_api = network.API() + + try: nw_info = network_api.get_instance_nw_info(context, instance) - return get_networks_for_instance_from_nw_info(nw_info) + except exception.InstanceNotFound: + nw_info = [] + + return get_networks_for_instance_from_nw_info(nw_info) def raise_http_conflict_for_instance_invalid_state(exc, action): |
