[libvirt] [PATCH v3 38/48] remote: open secondary drivers via remote driver if needed

Andrea Bolognani abologna at redhat.com
Tue Jul 30 15:06:20 UTC 2019


On Mon, 2019-07-29 at 18:11 +0100, Daniel P. Berrangé wrote:
> +++ b/src/remote/remote_daemon_dispatch.c
> @@ -1941,6 +1941,33 @@ static void remoteClientCloseFunc(virNetServerClientPtr client)
> +    VIR_DEBUG("Opening driver %s", uri);
> +    if (readonly)
> +        *conn = virConnectOpenReadOnly(uri);
> +    else
> +        *conn = virConnectOpen(uri);
> +    if (!*conn)
> +        return -1;
> +    VIR_DEBUG("Opened driver %p", *conn);

Empty line here.

> @@ -1962,10 +1989,10 @@ remoteGetInterfaceConn(virNetServerClientPtr client)
>      struct daemonClientPrivate *priv =
>          virNetServerClientGetPrivateData(client);
>  
> -    if (!priv->interfaceConn) {
> -        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("hypervisor connection not open"));
> +    if (remoteOpenConn(priv->interfaceURI,
> +                       priv->readonly,
> +                       &priv->interfaceConn) < 0)
>          return NULL;
> -    }

Our coding style guidelines allow this, but personally I think it's
less readable and in this specific case also happens to make the diff
unnecessarily bigger, so I would suggest keeping the curly braces. If
you prefer not making this change, though, that's alright too :)

> @@ -2095,20 +2125,88 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
> +#endif /* !LIBVIRTD */
> +        VIR_DEBUG("Pointing secondary drivers to primary");
> +        priv->interfaceConn = virObjectRef(priv->conn);
> +        priv->networkConn = virObjectRef(priv->conn);
> +        priv->nodedevConn = virObjectRef(priv->conn);
> +        priv->nwfilterConn = virObjectRef(priv->conn);
> +        priv->secretConn = virObjectRef(priv->conn);
> +        priv->storageConn = virObjectRef(priv->conn);

I thought we agreed to have at least a comment explaining that this
is necessary to support the virtproxyd use case?

With the comment added,

  Reviewed-by: Andrea Bolognani <abologna at redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list