'Create a cache volume from an image.
Returns name of the cache volume.'

def _create_cache_volume(self, context, img_meta, img_service, cachevol_props):

    lcfg = self.configuration
    cache_dir = ('%s/' % lcfg.zfssa_cache_directory)
    cache_vol = Volume()
    cache_vol.provider_location = self.mount_path
    cache_vol._name_id = cachevol_props['id']
    cache_vol.size = cachevol_props['size']
    cache_vol_name = (cache_dir + cache_vol.name)
    LOG.debug('Creating    cache    volume    %s', cache_vol_name)
    try:
        self.create_volume(cache_vol)
        LOG.debug('Copying    image    data:')
        super(ZFSSANFSDriver, self).copy_image_to_volume(context, cache_vol, img_service, img_meta['id'])
        self.zfssa.webdavclient.request(src_file=cache_vol.name, dst_file=cache_vol_name, method='MOVE')
    except Exception as exc:
        exc_msg = (_('Fail    to    create    cache    volume    %(volume)s.    Error:    %(err)s'), {'volume': cache_vol_name, 'err': six.text_type(exc)})
        LOG.error(exc_msg)
        self.zfssa.delete_file(cache_vol_name)
        raise exception.VolumeBackendAPIException(data=exc_msg)
    cachevol_meta = {'updated_at': cachevol_props['updated_at'], 'image_id': cachevol_props['image_id']}
    cachevol_meta.update({'numclones': '0'})
    self.zfssa.set_file_props(cache_vol_name, cachevol_meta)
    return cache_vol_name
