'block device mapping over quota failure test.
Make sure when we\'re over volume quota according to Cinder client, the
appropriate exception is raised and the instances to ERROR state,
cleaning the task state.'

@mock.patch('nova.compute.manager.ComputeManager._prep_block_device', side_effect=exception.OverQuota(overs='volumes'))
def test_setup_block_device_over_quota_fail(self, mock_prep_block_dev):

    instance = self._create_fake_instance_obj()
    self.compute.build_and_run_instance(self.context, instance=instance, request_spec={}, filter_properties={}, requested_networks=[], injected_files=None, admin_password=None, node=None, block_device_mapping=[], image={})
    self._assert_state({'vm_state': vm_states.ERROR, 'task_state': None})
    self.compute.periodic_tasks(context.get_admin_context())
    self._assert_state({'vm_state': vm_states.ERROR, 'task_state': None})
    self.assertTrue(mock_prep_block_dev.called)
