'Verify the rescheduling logic gets called when there is an error
during prep_resize.'

@mock.patch.object(db, 'migration_create')
@mock.patch.object(compute_manager.ComputeManager, '_reschedule_resize_or_reraise')
def test_reschedule_resize_or_reraise_called(self, mock_res, mock_mig):

    inst_obj = self._create_fake_instance_obj()
    mock_mig.side_effect = test.TestingException('Original')
    self.compute.prep_resize(self.context, image=None, instance=inst_obj, instance_type=self.instance_type, reservations=[], request_spec={}, filter_properties={}, node=None, clean_shutdown=True)
    mock_mig.assert_called_once_with(mock.ANY, mock.ANY)
    mock_res.assert_called_once_with(mock.ANY, None, inst_obj, mock.ANY, self.instance_type, {}, {})
