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

Eric Blake eblake at redhat.com
Wed Mar 23 15:31:56 UTC 2011


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?

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110323/24c9a227/attachment-0001.sig>


More information about the libvir-list mailing list