All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 3/3] qga: implement qmp_guest_set_vcpus() for Linux with sysfs
Date: Thu, 07 Mar 2013 00:55:25 +0100	[thread overview]
Message-ID: <5137D76D.8030603@redhat.com> (raw)
In-Reply-To: <5137CF38.50301@redhat.com>

On 03/07/13 00:20, Eric Blake wrote:
> On 03/06/2013 02:59 PM, Laszlo Ersek wrote:
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>  qga/commands-posix.c |   38 ++++++++++++++++++++++++++++++++------
>>  1 files changed, 32 insertions(+), 6 deletions(-)
>>
>>  
>> +int64_t qmp_guest_set_vcpus(GuestLogicalProcessorList *vcpus, Error **errp)
>> +{
>> +    int64_t processed;
>> +    Error *local_err = NULL;
>> +
>> +    processed = 0;
>> +    while (vcpus != NULL) {
>> +        transfer_vcpu(vcpus->value, false, &local_err);
>> +        if (local_err != NULL) {
>> +            break;
>> +        }
>> +        ++processed;
>> +        vcpus = vcpus->next;
>> +    }
>> +
>> +    if (local_err != NULL) {
>> +        if (processed == 0) {
>> +            error_propagate(errp, local_err);
> 
> Do we need to set processed to -1 here, to flag to the caller that we
> propagated an error?  I'm not sure enough of the mechanics of the call
> chain, so maybe this already works even if you leave things as returning 0.

In general,

error set  output value
on output  would appear valid  what to do
---------  ------------------  --------------------------
yes        yes                 error short-circuits value
yes        no                  error short-circuits value
no         yes                 use value
no         no                  should not happen normally, exceptional
                                 cases exist (when it communicates
                                 something different from error=set),
                                 they need documentation

In particular qemu-ga follows suit; from the generated
qmp_marshal_input_guest_set_vcpus() function
[qga/qapi-generated/qga-qmp-marshal.c]:

    retval = qmp_guest_set_vcpus(vcpus, errp);
    if (!error_is_set(errp)) {
        qmp_marshal_output_guest_set_vcpus(retval, ret, errp);
    }

Also, I tested all branches that are reachable without hacking the
kernel or poking into the process with gdb. I fed qga JSON from a
terminal (using
<http://wiki.libvirt.org/page/Qemu_guest_agent#Configure_guest_agent_without_libvirt_interference>
and <http://wiki.qemu.org/Features/QAPI/GuestAgent>), and errors and
retvals are mutually exclusive.

> Depending on that answer, you can add:
> Reviewed-by: Eric Blake <eblake@redhat.com>
> if I didn't find a reason for a respin.

Yay!

Thanks
Laszlo

      reply	other threads:[~2013-03-06 23:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06 21:59 [Qemu-devel] [PATCH v2 0/3] qga/Linux: online/offline/query VCPUs via guest sysfs Laszlo Ersek
2013-03-06 21:59 ` [Qemu-devel] [PATCH v2 1/3] qga: introduce guest-get-vcpus / guest-set-vcpus with stubs Laszlo Ersek
2013-03-06 22:32   ` Eric Blake
2013-03-06 22:48     ` Laszlo Ersek
2013-03-06 23:24       ` mdroth
2013-03-06 21:59 ` [Qemu-devel] [PATCH v2 2/3] qga: implement qmp_guest_get_vcpus() for Linux with sysfs Laszlo Ersek
2013-03-06 23:15   ` Eric Blake
2013-03-06 23:40     ` Laszlo Ersek
2013-03-06 21:59 ` [Qemu-devel] [PATCH v2 3/3] qga: implement qmp_guest_set_vcpus() " Laszlo Ersek
2013-03-06 23:20   ` Eric Blake
2013-03-06 23:55     ` Laszlo Ersek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5137D76D.8030603@redhat.com \
    --to=lersek@redhat.com \
    --cc=eblake@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.