'Clone raw image then verify volume is in available state.'

@mock.patch('cinder.image.image_utils.check_available_space')
@mock.patch.object(cinder.image.glance, 'get_default_image_service')
def test_create_vol_from_image_status_available(self, mock_gdis, mock_check_space):

    def _mock_clone_image(context, volume, image_location, image_meta, image_service):
        return ({'provider_location': None}, True)
    with mock.patch.object(self.volume.driver, 'clone_image') as mock_clone_image:
        mock_clone_image.side_effect = _mock_clone_image
        with mock.patch.object(self.volume.driver, 'create_volume') as mock_create:
            with mock.patch.object(create_volume.CreateVolumeFromSpecTask, '_copy_image_to_volume') as mock_copy:
                self._create_volume_from_image('available', raw=True)
                self.assertFalse(mock_copy.called)
            self.assertTrue(mock_clone_image.called)
            self.assertFalse(mock_create.called)
            self.assertTrue(mock_gdis.called)
