'Terminate the volume connection.
Optionally remove volume from volume access group.
If the VAG is empty then the VAG is also removed.'

def _sf_terminate_connection(self, volume, properties, force):

    if self.configuration.sf_enable_vag:
        iqn = properties['initiator']
        vag = self._get_vags_by_name(iqn)
        provider_id = volume['provider_id']
        vol_id = int(provider_id.split()[0])
        if (vag and (not volume['multiattach'])):
            vag = vag[0]
            vag_id = vag['volumeAccessGroupID']
            if ([vol_id] == vag['volumes']):
                self._remove_vag(vag_id)
            elif (vol_id in vag['volumes']):
                self._remove_volume_from_vag(vol_id, vag_id)
    return super(SolidFireISCSI, self).terminate_connection(volume, properties, force=force)
