[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Update event loop example programs to demonstrate best practice



On Wed, Mar 23, 2011 at 09:31:56AM -0600, Eric Blake wrote:
> On 03/23/2011 09:24 AM, Daniel P. Berrange wrote:
> > The example C event loop code is a nasty hack and not compliant
> > with the require API semantics. Delete this, so that developers
> > don't mistakenly copy it. Instead call the new public event loop
> > APIs.
> > 
> > Update the python event loop example, so that it can optionally
> > use the public event APIs, as an alternative to the pure python
> > code. The pure python event code is a good working example, so
> > don't delete it.
> > 
> > * examples/domain-events/events-c/event-test.c: Replace event
> >   loop code with use of public APIs
> > * examples/domain-events/events-python/event-test.py: Allow
> >   optional use of new public event APIs
> > ---
> >  examples/domain-events/events-c/event-test.c       |  163 +------------------
> >  examples/domain-events/events-python/event-test.py |   29 ++++-
> >  2 files changed, 36 insertions(+), 156 deletions(-)
> 
> ACK with nits addressed.
> 
> > @@ -386,17 +279,12 @@ int main(int argc, char **argv)
> >  
> >      action_stop.sa_handler = stop;
> >  
> > -    if(argc > 1 && STREQ(argv[1],"--help")) {
> > +    if (argc > 1 && STREQ(argv[1],"--help")) {
> 
> As long as you are respacing this line, s/,"--help/, "--help/
> 
> >  
> > -    vc = libvirt.open(uri)
> > +    vc = libvirt.openReadOnly(uri)
> 
> Why this change?

Event monitoring doesn't need a read-write connection, so switching
this avoids the password prompts if run non-root.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]