'Fetch the image from image_service and write it to the volume.'

@utils.trace_method
def copy_image_to_volume(self, context, volume, image_service, image_id):

    copy_success = False
    try:
        (major, minor) = self.zapi_client.get_ontapi_version()
        col_path = self.configuration.netapp_copyoffload_tool_path
        cache_result = self._find_image_in_cache(image_id)
        if cache_result:
            copy_success = self._copy_from_cache(volume, image_id, cache_result)
            if copy_success:
                LOG.info('Copied    image    %(img)s    to    volume    %(vol)s    using    local    image    cache.', {'img': image_id, 'vol': volume['id']})
        if ((not copy_success) and col_path and (major == 1) and (minor >= 20)):
            LOG.debug('No    result    found    in    image    cache')
            self._copy_from_img_service(context, volume, image_service, image_id)
            LOG.info('Copied    image    %(img)s    to    volume    %(vol)s    using    copy    offload    workflow.', {'img': image_id, 'vol': volume['id']})
            copy_success = True
    except Exception:
        LOG.exception('Copy    offload    workflow    unsuccessful.')
    finally:
        if (not copy_success):
            super(NetAppCmodeNfsDriver, self).copy_image_to_volume(context, volume, image_service, image_id)
