diff options
-rw-r--r-- | nova/compute/api.py | 2 | ||||
-rw-r--r-- | nova/tests/compute/test_compute.py | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 601b75e86..9e5971862 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1419,7 +1419,7 @@ class API(base.Base): if cinfo and 'serial' not in cinfo: cinfo['serial'] = bdm['volume_id'] bdmap = {'connection_info': cinfo, - 'mount_device': bdm['volume_id'], + 'mount_device': bdm['device_name'], 'delete_on_termination': bdm['delete_on_termination']} block_device_mapping.append(bdmap) except TypeError: diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 9abca178f..8a5ced502 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -3441,14 +3441,14 @@ class ComputeAPITestCase(BaseTestCase): 'preserved': 'preserve this!'}) db.instance_destroy(self.context, instance['uuid']) - def _stub_out_reboot(self, volume_id): + def _stub_out_reboot(self, device_name): def fake_reboot_instance(rpcapi, context, instance, block_device_info, network_info, reboot_type): self.assertEqual( block_device_info['block_device_mapping'][0]['mount_device'], - volume_id) + device_name) self.assertEqual(network_info[0]['network']['bridge'], 'fake_br1') self.stubs.Set(nova.compute.rpcapi.ComputeAPI, 'reboot_instance', fake_reboot_instance) @@ -3462,8 +3462,9 @@ class ComputeAPITestCase(BaseTestCase): self.compute.run_instance(self.context, instance=instance) volume_id = 'fake' + device_name = '/dev/vdc' volume = {'instance_uuid': instance['uuid'], - 'device_name': '/dev/vdc', + 'device_name': device_name, 'delete_on_termination': False, 'connection_info': '{"foo": "bar"}', 'volume_id': volume_id} @@ -3473,7 +3474,7 @@ class ComputeAPITestCase(BaseTestCase): self.assertEqual(inst_ref['task_state'], None) reboot_type = "SOFT" - self._stub_out_reboot(volume_id) + self._stub_out_reboot(device_name) self.compute_api.reboot(self.context, inst_ref, reboot_type) inst_ref = db.instance_get_by_uuid(self.context, inst_ref['uuid']) @@ -3487,8 +3488,9 @@ class ComputeAPITestCase(BaseTestCase): self.compute.run_instance(self.context, instance=instance) volume_id = 'fake' + device_name = '/dev/vdc' volume = {'instance_uuid': instance['uuid'], - 'device_name': '/dev/vdc', + 'device_name': device_name, 'delete_on_termination': False, 'connection_info': '{"foo": "bar"}', 'volume_id': volume_id} @@ -3498,7 +3500,7 @@ class ComputeAPITestCase(BaseTestCase): self.assertEqual(inst_ref['task_state'], None) reboot_type = "HARD" - self._stub_out_reboot(volume_id) + self._stub_out_reboot(device_name) self.compute_api.reboot(self.context, inst_ref, reboot_type) inst_ref = db.instance_get_by_uuid(self.context, inst_ref['uuid']) |