Raise a shade exception on broken volumes
Some clouds don't have volumes and bomb out here, which is a bad place to bomb out. A later patch will add an active check for service existence, but we still should catch and throw here so that we're not leaking python-*client exceptions. Change-Id: I1f768dcd6ad6f54fb1b5638e9486653ee07965ef
This commit is contained in:
parent
3b64ee66e4
commit
2c4d909111
@ -839,9 +839,16 @@ class OpenStackCloud(object):
|
||||
if not cache:
|
||||
warnings.warn('cache argument to list_volumes is deprecated. Use '
|
||||
'invalidate instead.')
|
||||
return meta.obj_list_to_dict(
|
||||
self.manager.submitTask(_tasks.VolumeList())
|
||||
)
|
||||
try:
|
||||
return meta.obj_list_to_dict(
|
||||
self.manager.submitTask(_tasks.VolumeList())
|
||||
)
|
||||
except Exception as e:
|
||||
self.log.debug(
|
||||
"cinder could not list volumes: {message}".format(
|
||||
message=str(e)),
|
||||
exc_info=True)
|
||||
raise OpenStackCloudException("Error fetching volume list")
|
||||
|
||||
@_cache_on_arguments()
|
||||
def list_flavors(self):
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
import six
|
||||
|
||||
from shade import exc
|
||||
|
||||
NON_CALLABLES = (six.string_types, bool, dict, int, list, type(None))
|
||||
|
||||
|
||||
@ -126,10 +128,13 @@ def get_hostvars_from_server(cloud, server, mounts=None):
|
||||
server_vars['image'].pop('links', None)
|
||||
|
||||
volumes = []
|
||||
for volume in cloud.get_volumes(server):
|
||||
# Make things easier to consume elsewhere
|
||||
volume['device'] = volume['attachments'][0]['device']
|
||||
volumes.append(volume)
|
||||
try:
|
||||
for volume in cloud.get_volumes(server):
|
||||
# Make things easier to consume elsewhere
|
||||
volume['device'] = volume['attachments'][0]['device']
|
||||
volumes.append(volume)
|
||||
except exc.OpenStackCloudException:
|
||||
pass
|
||||
server_vars['volumes'] = volumes
|
||||
if mounts:
|
||||
for mount in mounts:
|
||||
|
Loading…
x
Reference in New Issue
Block a user