[libvirt] [PATCH v2 4/7] remote: implement remoteDomainGetStateParams

Bjoern Walk bwalk at linux.ibm.com
Wed Mar 27 13:19:32 UTC 2019


Michal Privoznik <mprivozn at redhat.com> [2019-03-27, 02:05PM +0100]:
> On 3/25/19 9:04 AM, Bjoern Walk wrote:
> > diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> > index 5c4dd412..e0962014 100644
> > --- a/src/remote/remote_driver.c
> > +++ b/src/remote/remote_driver.c
> > @@ -8131,6 +8131,49 @@ remoteStorageVolGetInfoFlags(virStorageVolPtr vol,
> >       return rv;
> >   }
> > +static int
> > +remoteDomainGetStateParams(virDomainPtr domain,
> > +                           int *state,
> > +                           int *reason,
> > +                           virTypedParameterPtr *params,
> > +                           int *nparams,
> > +                           unsigned int flags)
> > +{
> > +    int rv = -1;
> > +    remote_domain_get_state_params_args args;
> > +    remote_domain_get_state_params_ret ret;
> > +    struct private_data *priv = domain->conn->privateData;
> > +
> > +    remoteDriverLock(priv);
> > +
> > +    make_nonnull_domain(&args.dom, domain);
> > +    args.flags = flags;
> > +
> > +    memset(&ret, 0, sizeof(ret));
> > +    if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_STATE_PARAMS,
> > +             (xdrproc_t) xdr_remote_domain_get_state_params_args, (char *) &args,
> > +             (xdrproc_t) xdr_remote_domain_get_state_params_ret, (char *) &ret) == -1)
> > +        goto done;
> > +
> > +    *state = ret.state;
> > +    *reason = ret.reason;
> 
> Neither @state nor @reason is required to be non-NULL. I mean, based on
> checks from 3/7 it's just fine to call virDomaingetStateParams(dom, NULL,
> NULL, ..);

Yepp, correct. Missed that.

> > diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
> > index 768189c5..670164de 100644
> > --- a/src/remote_protocol-structs
> > +++ b/src/remote_protocol-structs
> > @@ -2162,6 +2162,18 @@ struct remote_domain_get_state_ret {
> >           int                        state;
> >           int                        reason;
> >   };
> > +struct remote_domain_get_state_params_args {
> > +        remote_nonnull_domain      dom;
> > +        u_int                      flags;
> > +};
> > +struct remote_domain_get_state_params_ret {
> > +        int                        state;
> > +        int                        reason;
> > +        struct {
> > +                u_int              params_len;
> > +                remote_typed_param * params_val;
> > +        } params;
> > +};
> >   struct remote_domain_migrate_begin3_args {
> >           remote_nonnull_domain      dom;
> >           remote_string              xmlin;
> > 
> 
> This is missing REMOTE_PROC_DOMAIN_GET_STATE_PARAMS = 404, at EOF :-)

Huh? Never even noticed. And yet it compiles and runs just fine. Where
are those definitions used?

> 
> Michal
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 902 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190327/83295a95/attachment-0001.sig>


More information about the libvir-list mailing list