'Tests that when attach_block_devices raises an Exception, the
re-raised InvalidBDM has the original error message which contains
the actual details of the failure.'

@mock.patch('nova.virt.block_device.attach_block_devices', side_effect=exception.VolumeNotCreated('oops!'))
def test_prep_block_device_maintain_original_error_message(self, mock_attach):

    bdms = objects.BlockDeviceMappingList(objects=[fake_block_device.fake_bdm_object(self.context, dict(source_type='image', destination_type='volume', boot_index=0, image_id=uuids.image_id, device_name='/dev/vda', volume_size=1))])
    ex = self.assertRaises(exception.InvalidBDM, self.compute._prep_block_device, self.context, self.instance, bdms)
    self.assertEqual('oops!', six.text_type(ex))
