diff --git a/nova/block_device.py b/nova/block_device.py index ecb78efb6ac4..c6f1d1c773dd 100644 --- a/nova/block_device.py +++ b/nova/block_device.py @@ -541,7 +541,9 @@ def instance_block_mapping(instance, bdms): # Right now sort by device name for deterministic # result. if ebs_devices: - ebs_devices.sort() + # NOTE(claudiub): python2.7 sort places None values first. + # this sort will maintain the same behaviour for both py27 and py34. + ebs_devices = sorted(ebs_devices, key=lambda x: (x is not None, x)) for nebs, ebs in enumerate(ebs_devices): mappings['ebs%d' % nebs] = ebs diff --git a/nova/cells/utils.py b/nova/cells/utils.py index e196470e1393..f3d2619c6d37 100644 --- a/nova/cells/utils.py +++ b/nova/cells/utils.py @@ -123,7 +123,9 @@ class ServiceProxy(_CellProxy): # ComputeNode object that consumers of this Proxy don't use, we can # safely remove it from what's returned raise AttributeError - return getattr(self._obj, key) + # NOTE(claudiub): needed for py34 compatiblity. + # get self._obj first, without ending into an infinite recursion. + return getattr(self.__getattribute__("_obj"), key) def get_instances_to_sync(context, updated_since=None, project_id=None, diff --git a/nova/utils.py b/nova/utils.py index 6a34b2cfd791..d775e579aa2f 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -732,7 +732,7 @@ def temporary_mutation(obj, **kwargs): do_something_that_needed_deleted_objects() """ def is_dict_like(thing): - return hasattr(thing, 'has_key') + return hasattr(thing, 'has_key') or isinstance(thing, dict) def get(thing, attr, default): if is_dict_like(thing): diff --git a/nova/virt/block_device.py b/nova/virt/block_device.py index 41eef7a9d028..b68f61544ea8 100644 --- a/nova/virt/block_device.py +++ b/nova/virt/block_device.py @@ -508,7 +508,8 @@ def attach_block_devices(block_device_mapping, *attach_args, **attach_kwargs): bdm.attach(*attach_args, **attach_kwargs) - map(_log_and_attach, block_device_mapping) + for device in block_device_mapping: + _log_and_attach(device) return block_device_mapping diff --git a/tests-py3.txt b/tests-py3.txt index e31c6a992784..540247a46483 100644 --- a/tests-py3.txt +++ b/tests-py3.txt @@ -32,11 +32,6 @@ nova.tests.unit.api.openstack.compute.test_volumes.BootFromVolumeTest nova.tests.unit.api.openstack.compute.test_volumes.VolumeApiTestV21 nova.tests.unit.api.test_compute_req_id.RequestIdTest nova.tests.unit.compute.test_compute.ComputeAPITestCase.test_create_with_base64_user_data -nova.tests.unit.compute.test_compute.ComputeTestCase.test_finish_resize_with_volumes -nova.tests.unit.compute.test_compute.ComputeVolumeTestCase.test_boot_volume_serial -nova.tests.unit.compute.test_compute.ComputeVolumeTestCase.test_poll_bandwidth_usage_not_implemented -nova.tests.unit.compute.test_compute.ComputeVolumeTestCase.test_prep_block_device_over_quota_failure -nova.tests.unit.compute.test_compute.ComputeVolumeTestCase.test_prep_block_device_with_blanks nova.tests.unit.compute.test_compute_cells.CellsComputeAPITestCase.test_create_with_base64_user_data nova.tests.unit.compute.test_compute_mgr.ComputeManagerUnitTestCase.test_run_pending_deletes nova.tests.unit.compute.test_host_api.ComputeHostAPICellsTestCase