'Create a cache volume from an image.
Returns names of the cache volume and its snapshot.'

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

    lcfg = self.configuration
    cachevol_size = int(cachevol_props['size'])
    lunsize = ('%sg' % six.text_type(cachevol_size))
    lun_props = {'custom:image_id': img_meta['id'], 'custom:updated_at': six.text_type(img_meta['updated_at'].isoformat())}
    lun_props.update(specs)
    cache_vol = {'name': cachevol_props['cache_name'], 'id': img_meta['id'], 'size': cachevol_size}
    LOG.debug('Creating    cache    volume    %s.', cache_vol['name'])
    try:
        self.zfssa.create_lun(lcfg.zfssa_pool, lcfg.zfssa_cache_project, cache_vol['name'], lunsize, lcfg.zfssa_target_group, lun_props)
        super(ZFSSAISCSIDriver, self).copy_image_to_volume(context, cache_vol, img_service, img_meta['id'])
        self.zfssa.create_snapshot(lcfg.zfssa_pool, lcfg.zfssa_cache_project, cache_vol['name'], cachevol_props['snap_name'])
    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_lun(lcfg.zfssa_pool, lcfg.zfssa_cache_project, cache_vol['name'])
        raise exception.VolumeBackendAPIException(data=exc_msg)
    return (cachevol_props['cache_name'], cachevol_props['snap_name'])
