qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: "libvir-list@redhat.com" <libvir-list@redhat.com>,
	Paul Brook <paul@codesourcery.com>,
	qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] Re: [libvirt] Supporting hypervisor specific APIs in libvirt
Date: Thu, 25 Mar 2010 08:55:42 -0500	[thread overview]
Message-ID: <4BAB6B5E.5040101@codemonkey.ws> (raw)
In-Reply-To: <20100325102309.5119918c@redhat.com>

On 03/25/2010 08:23 AM, Luiz Capitulino wrote:
> On Wed, 24 Mar 2010 16:40:18 -0500
> Anthony Liguori<anthony@codemonkey.ws>  wrote:
>
>    
>>>> We need to have a common management interface for third party tools.
>>>>
>>>>          
>>>    QMP? :-)
>>>        
>> Only if QMP is compatible with libvirt.  I don't want a user to have to
>> choose between QMP and libvirt.
>>      
>   Why not? If all they want is a simple qemu session, they can use
> QMP directly, on the other hand if what they want is more complex,
> what's the problem of using a management API like libivrt?
>    

My point is that libvirt should not be a separate management API but 
effectively an add-on API that provides higher level features, better 
integration with Linux host services, etc.
You mentioned dynamic dispatch, but this is useful only for C clients right?

>>> If so, what C clients you expected beyond libvirt?
>>>        
>> Users want a C API.  I don't agree that libvirt is the only C interface
>> consumer out there.
>>      
>   Actually, I do agree. Maybe, we don't have other C consumers because they
> weren't crazy enough to parse the crap of the user Monitor (or they do,
> but for simple things).
>
>   One possible future client is perf, for example.
>
>   Here is my solution (actually it's not mine, you have suggested
> it some time ago): let's provide a convenient way for C clients to
> use QMP. That is, let's have an overly simple library which takes
> QDitcs, sends them to qemu through QMP and returns others QDicts.
>
>   Something like the _sketch_ below:
>
> // Open a connection
> int qmp_open(..., QDict **greeting);
>
> // Register a callback for async messages, BUT note that the async message
> // object is passed verbatim
> void qmp_async_mes_handler(..., void (*async_mes_handler)(QDict *mes));
>
> // Send a QMP command
> int qmp_send(..., const char *command, QDict *params, QDict **res);
>    

Yes, this is the core API.  It's missing a mechanism to create a 
QMPContext.  I'll also argue that we want a set of auto generated 
wrappers like:

QError *qmp_last_error(QMPContext *context);
int qmp_set_link(QMPContext *context, const char *name, bool up);

That's a thin wrapper around qmp_send().  You can autogenerate this 
fairly easy with an IDL like:

None:qmp_set_link:String:name,Boolean:up

Which is fairly easy to output using introspection on a QMP session.

>   Obviously that we'll need a QMPContext and maybe additional functions,
>    

And for a QMPContext, we need functions like:

/* use qemu's default advertisement mechanism to find a guest */
QMPContext *qmp_context_new_by_uuid(uuid_t uuid);
QMPContext *qmp_context_new_by_name(const char *name);

/* connect to an already established QMP session */
QMPContext *qmp_context_new_by_fd(int fd);
QMPContext *qmp_context_new_by_iops(QMPIOOps *ops);

libvirt could use qmp_context_new_by_iops() to implement a 
virQemuGetQMP().  It can support this either by having a second QMP 
connection or even by parsing the QMP traffic and relaying commands over 
it QMP session (which gives it a chance to snoop on anything it's 
interested in).  I think the former approach is less difficult technically.

We can certainly make it easier to create dynamic QMP sessions.

> but the two main ideas are:
>
> 1. We don't do management
>    

I really believe we need to stop thinking this way.  I'm not saying that 
qemu-devel is the place where we design virt-manager, but we ought to 
consider the whole stack as part of "we".

>> I really think what we want is for a libvirt user to be able to call
>> libqemu functions directly.  There shouldn't have to be libvirt specific
>> functions for every operation we expose.
>>      
>   Not sure if this is too crazy but, considering this user wants to
> use qemu features not implemented by libvirt yet, what about using both
> libqmp (above) and libvirt at the same time?
>    

Yes, that's *exactly* what I want.  Except I want to call it libqemu 
because qmp is an implementation detail.

Regards,

Anthony Liguori

  reply	other threads:[~2010-03-25 13:55 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-22 19:25 [Qemu-devel] Supporting hypervisor specific APIs in libvirt Anthony Liguori
2010-03-22 20:10 ` [Qemu-devel] Re: [libvirt] " Daniel P. Berrange
2010-03-22 21:33   ` Gerd Hoffmann
2010-03-22 21:53     ` Anthony Liguori
2010-03-23  8:54       ` Jes Sorensen
2010-03-23 10:25         ` Gerd Hoffmann
2010-03-23 10:31           ` Jes Sorensen
2010-03-23 10:58             ` Gerd Hoffmann
2010-03-22 23:36     ` Cole Robinson
2010-03-22 21:49   ` Anthony Liguori
2010-03-23  7:35     ` Alexander Graf
2010-03-23 23:25       ` Jamie Lokier
2010-03-24  0:55         ` Anthony Liguori
2010-03-24 10:05           ` Markus Armbruster
2010-03-24 12:25             ` Paul Brook
2010-03-24 12:48               ` Anthony Liguori
2010-03-25  2:43                 ` Jamie Lokier
2010-03-23 11:33     ` Daniel P. Berrange
2010-03-24 10:23     ` Daniel P. Berrange
2010-03-22 20:25 ` [Qemu-devel] " Daniel P. Berrange
2010-03-23 10:06 ` [Qemu-devel] " Juan Quintela
2010-03-23 10:41   ` Gerd Hoffmann
2010-03-23 10:50     ` Juan Quintela
2010-03-23 11:08       ` Daniel P. Berrange
2010-03-23 12:19         ` Juan Quintela
2010-03-23 23:13     ` Jamie Lokier
2010-03-24  7:59       ` Gerd Hoffmann
2010-03-24 13:52         ` Cole Robinson
2010-03-24 14:00           ` Gerd Hoffmann
2010-03-23 23:19   ` Jamie Lokier
2010-03-24  2:22   ` Andi Kleen
2010-03-24  8:49     ` Juan Quintela
     [not found] ` <20100323145105.GV16253@redhat.com>
2010-03-23 15:05   ` [Qemu-devel] Re: [libvirt] " Anthony Liguori
2010-03-23 15:57     ` Paul Brook
2010-03-23 16:06       ` Anthony Liguori
2010-03-23 18:00         ` Avi Kivity
2010-03-23 18:23           ` [libvirt] [Qemu-devel] " Daniel P. Berrange
2010-03-24  1:05             ` Anthony Liguori
2010-03-24  4:48             ` Avi Kivity
2010-03-23 19:28           ` [Qemu-devel] Re: [libvirt] " Anthony Liguori
2010-03-23 23:09             ` Jamie Lokier
2010-03-24  5:17           ` Avi Kivity
2010-03-24 10:36             ` Daniel P. Berrange
2010-03-24 10:42               ` Avi Kivity
2010-03-24 12:23                 ` Anthony Liguori
2010-03-24 12:29                   ` Avi Kivity
2010-03-24 12:32                     ` Anthony Liguori
2010-03-24 12:33                       ` Avi Kivity
2010-03-25  0:28                         ` Jamie Lokier
2010-03-24 16:42                 ` Luiz Capitulino
2010-03-24 19:49                   ` Avi Kivity
2010-03-24 20:12                     ` Luiz Capitulino
2010-03-24 20:32                       ` Anthony Liguori
2010-03-24 20:54                         ` Alexander Graf
2010-03-24 21:33                           ` Luiz Capitulino
2010-03-25  7:49                             ` Alexander Graf
2010-03-24 21:25                         ` Luiz Capitulino
2010-03-24 21:40                           ` Anthony Liguori
2010-03-25  8:26                             ` Vincent Hanquez
2010-03-25  8:49                               ` Avi Kivity
2010-03-25 12:33                               ` Anthony Liguori
2010-03-25 12:37                                 ` Avi Kivity
2010-03-25 13:44                                   ` Anthony Liguori
2010-03-25 13:48                                     ` Avi Kivity
2010-03-25 13:57                                       ` Anthony Liguori
2010-03-25 14:09                                         ` Luiz Capitulino
2010-03-25 15:59                                           ` Anthony Liguori
2010-03-26  2:11                                             ` Jamie Lokier
2010-03-25 14:21                                         ` Avi Kivity
2010-03-25 14:22                                         ` Vincent Hanquez
2010-03-25 16:50                                     ` Markus Armbruster
2010-03-25 17:40                                       ` Anthony Liguori
2010-03-26  7:37                                         ` Markus Armbruster
2010-03-26  9:26                                           ` [libvirt] [Qemu-devel] " Paolo Bonzini
2010-03-26  9:51                                           ` [Qemu-devel] Re: [libvirt] " Avi Kivity
2010-03-26 12:53                                             ` Anthony Liguori
2010-03-26 13:53                                           ` Anthony Liguori
2010-03-25 13:37                                 ` Gildas Le Nadan
2010-03-25 13:59                               ` Daniel P. Berrange
2010-03-25 14:56                                 ` Vincent Hanquez
2010-03-25 15:07                                   ` Daniel P. Berrange
2010-03-25 15:14                                     ` Vincent Hanquez
2010-03-25 15:16                                       ` Daniel P. Berrange
2010-03-25 16:01                                         ` Anthony Liguori
2010-03-25 16:30                                           ` Alexander Graf
2010-03-26  2:18                                           ` Jamie Lokier
2010-03-25 13:23                             ` Luiz Capitulino
2010-03-25 13:55                               ` Anthony Liguori [this message]
2010-03-26 12:52                                 ` Luiz Capitulino
2010-03-25  6:37                         ` Avi Kivity
2010-03-25  8:18                           ` Alexander Graf
2010-03-26 16:01                             ` Avi Kivity
2010-03-24 12:19             ` Anthony Liguori
2010-03-24 12:27               ` Avi Kivity
2010-03-24 12:30                 ` Anthony Liguori
2010-03-24 12:32                   ` Avi Kivity
2010-03-23 18:07         ` Daniel P. Berrange
2010-03-23 19:24           ` Anthony Liguori
2010-03-24  5:49             ` Avi Kivity
2010-03-24 12:30               ` Paul Brook
2010-03-24 12:34                 ` Avi Kivity
2010-03-24 13:03                   ` Paul Brook
2010-03-24 15:55                     ` Markus Armbruster
2010-03-24 16:12                       ` Paul Brook
2010-03-23 23:22         ` Jamie Lokier
2010-03-23 17:57 ` [Qemu-devel] " Avi Kivity
2010-03-23 19:31   ` Anthony Liguori
2010-03-24  4:53     ` Avi Kivity
2010-03-26  2:31       ` 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=4BAB6B5E.5040101@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=paul@codesourcery.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 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).