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

Michal Privoznik mprivozn at redhat.com
Wed Mar 27 13:44:18 UTC 2019


On 3/27/19 2:19 PM, Bjoern Walk wrote:
> 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?

This is a file that's used in 'make check' and you need pdwtags to run 
it. If you don't have it installed the test is skipped.

Michal




More information about the libvir-list mailing list