Re: [PATCH 24/29] remote: open secondary drivers via remote driver if needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 12, 2019 at 15:37:12 +0200, Michal Privoznik wrote:
> On 7/11/19 6:05 PM, Daniel P. Berrangé wrote:
> > When the client has a connection to one of the hypervisor specific
> > daemons (eg virtqemud), the app may still expect to use the secondary
> > driver APIs (storage, network, etc). None of these will be registered in
> > the hypervisor daemon, so we must explicitly open a connection to each
> > of the daemons for the secondary drivers we need.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> > ---
> >   src/remote/remote_daemon_dispatch.c | 82 ++++++++++++++++++++++++-----
> >   1 file changed, 69 insertions(+), 13 deletions(-)
> > 
> > diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
> > index 856c5e48e7..c8a605c709 100644
> > --- a/src/remote/remote_daemon_dispatch.c
> > +++ b/src/remote/remote_daemon_dispatch.c
> > @@ -1954,6 +1954,9 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
> >       unsigned int flags;
> >       struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
> >       int rv = -1;
> > +#ifndef LIBVIRTD
> > +    const char *type = NULL;
> > +#endif
> >       VIR_DEBUG("priv=%p conn=%p", priv, priv->conn);
> >       virMutexLock(&priv->lock);
> > @@ -1972,20 +1975,73 @@ remoteDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
> >       if (virNetServerClientGetReadonly(client))
> >           flags |= VIR_CONNECT_RO;
> > -    priv->conn =
> > -        flags & VIR_CONNECT_RO
> > -        ? virConnectOpenReadOnly(name)
> > -        : virConnectOpen(name);
> > -
> > -    if (priv->conn == NULL)
> > -        goto cleanup;
> > +#define OPEN_DRIVER(var, uri) \
> > +    do {                                 \
> > +        VIR_DEBUG("Opening driver %s", uri); \
> > +        if (!(priv->var = flags & VIR_CONNECT_RO  \
> > +                    ? virConnectOpenReadOnly(uri) \
> > +                    : virConnectOpen(uri))) \
> > +          goto cleanup; \
> > +        VIR_DEBUG("Opened %p", priv->var); \
> > +    } while (0)
> 
> This breaks syntax-check.

Also I'd strongly suggest getting rid of the ternary operator and just
expand the code for readability.

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux