[libvirt PATCH v4 07/11] remote: extract logic for determining daemon to connect to