qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: chrisw@redhat.com, dlaor@redhat.com, qemu-devel@nongnu.org,
	rjones@redhat.com
Subject: [Qemu-devel] Re: Machine-readable or parseable qemu output
Date: Wed, 14 Jan 2009 13:28:40 +0200	[thread overview]
Message-ID: <496DCC68.4000509@redhat.com> (raw)
In-Reply-To: <20090114111005.GB31839@amit-x200.pnq.redhat.com>

Amit Shah wrote:
> Hello,
>
> Continuing from the thread at [1], building on Daniel's suggestions, I
> have jot down a few points as to how a libqemumonitor API could be
> developed.
>
> To recap, there has to be an interface to the qemu monitor in
> a way that wouldn't break even if the monitor output changes. This API
> will remain the same, so that consumers (libvirt, etc) can safely
> integrate with the monitor.
>
> Please see Dan's email at [1] to get the background details.
>
> [1] http://www.mail-archive.com/qemu-devel@nongnu.org/msg14615.html
>
> Here are some initial thoughts. Comments?
>
> - Have a libqemumonitor.so that will abstract out output from qemu and
>   provide a machine-readble output for the consumer
>
> - Registering with a particular qemu instance:
>   - qemu_instance = attach_to_qemu("/path/to/socket");
>   

qemu chrdev ("tcp:host:port", etc)

> - The strings in qemu monitor can change but the libqemumonitor has to
>   change accordingly as well to keep the API consistent.
>   

No, they can't.  The monitor client and qemu will be upgraded independently.

> - The API could be something like:
>   - execute_qemu_command(qemu_instance, command, args...);
>
>   

It'd much prefer

qemu_hotplug_nic(...);
qemu_migrate(..., callback);

> - In addition to the return value seen of the loglevel type from the
>   monitor, there can be additional return values that can be provided
>   based on the command executed. This can be queried by:
>   - get_info_on_prev_command(qemu_instance, &ret);
>   - This can give command-specific return values, like success,
>   invalid parameter, etc.
>   

No, the command handler should parse the output expected from executing 
the command.  If the command is asynchronous, the command handler should 
provide a callback.

> - The string generated by qemu monitor output should never be exposed to
>   the consumer
>   

Right.

> - Some monitor commands will generate some string that might be of use
>   to the consumer. Such a string will be passed to the consumer via some
>   other api, like
>   - get_string_from_last_command(qemu_instance, some_context);
>   

Output parameters will do fine.

> - There might be output that's asynchronous to the command. Finding the
>   correlation between the command and the output should not be the
>   library's job; an async_socket can be created per qemu instance and
>   the consumer can select() on this socket to poll for data. Whenever
>   some information becomes available, we can push it out. If the qemu
>   output would contain more information for async output, this can be
>   passed on to the consumer.
>   

You're moving the protocol handling out from the protocol parser...

-- 
error compiling committee.c: too many arguments to function

  parent reply	other threads:[~2009-01-14 11:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14 11:10 [Qemu-devel] Machine-readable or parseable qemu output Amit Shah
2009-01-14 11:23 ` [Qemu-devel] " Daniel P. Berrange
2009-01-15 20:27   ` Anthony Liguori
2009-01-15 20:58     ` Daniel P. Berrange
2009-01-15 21:30       ` Anthony Liguori
2009-01-15 21:48       ` Avi Kivity
2009-01-15 22:26         ` Anthony Liguori
2009-01-14 11:28 ` Avi Kivity [this message]
2009-01-15 20:28   ` Anthony Liguori
2009-01-14 11:29 ` Richard W.M. Jones
2009-01-14 11:31   ` Avi Kivity
2009-01-14 11:36     ` Richard W.M. Jones
2009-01-14 11:45   ` Daniel P. Berrange
2009-01-14 12:37     ` Dor Laor
2009-01-14 14:05     ` Avi Kivity
2009-01-15 20:31     ` Anthony Liguori
2009-01-14 16:56   ` Jamie Lokier

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=496DCC68.4000509@redhat.com \
    --to=avi@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=chrisw@redhat.com \
    --cc=dlaor@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).