'Driver entry point to terminate a connection for a volume.'

@utils.trace
def terminate_connection(self, volume, connector, **kwargs):

    lcfg = self.configuration
    project = lcfg.zfssa_project
    pool = lcfg.zfssa_pool
    if (connector is None):
        new_init_groups = []
    else:
        connector_init_groups = self.zfssa.get_initiator_initiatorgroup(connector['initiator'])
        if ((lcfg.zfssa_enable_local_cache is True) and volume['name'].startswith('os-cache-vol-')):
            project = lcfg.zfssa_cache_project
        lun = self.zfssa.get_lun(pool, project, volume['name'])
        new_init_groups = set(lun['initiatorgroup'])
        new_init_groups -= set(connector_init_groups)
    self.zfssa.set_lun_initiatorgroup(pool, project, volume['name'], sorted(list(new_init_groups)))
