From 7d57cc16a6ab3b286e4fd3a479e5b40160980304 Mon Sep 17 00:00:00 2001 From: Joe Heck Date: Fri, 1 Jun 2012 21:51:48 +0000 Subject: defensive coding against None inside bdm resolves bug 1007615 Change-Id: If7afa4fb030b3c53a0b80737ff792e42cc4d3101 --- nova/compute/manager.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index d9f3ee14f..d6b836360 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -674,10 +674,15 @@ class ComputeManager(manager.SchedulerDependentManager): bdms = self._get_instance_volume_bdms(context, instance_uuid) block_device_mapping = [] for bdm in bdms: - cinfo = jsonutils.loads(bdm['connection_info']) - block_device_mapping.append({'connection_info': cinfo, - 'mount_device': - bdm['device_name']}) + try: + cinfo = jsonutils.loads(bdm['connection_info']) + block_device_mapping.append({'connection_info': cinfo, + 'mount_device': + bdm['device_name']}) + except TypeError: + # if the block_device_mapping has no value in connection_info + # (returned as None), don't include in the mapping + pass # NOTE(vish): The mapping is passed in so the driver can disconnect # from remote volumes if necessary return {'block_device_mapping': block_device_mapping} -- cgit