[libvirt-users] Designing libvirt client

Eric Blake eblake at redhat.com
Wed May 15 02:30:23 UTC 2013


On 05/14/2013 06:17 PM, arvind viswanathan wrote:
> Hi,
> I have a VMM application using a homegrown client for communicating with
> hypervisor.
> I am planning to migrate to libvirt because of the blocking nature of the
> calls.
> After going over the architecture, I would like to have a few doubts
> clarified
> 1) Should my application be necessarily multi-threaded in order to make use
> of the non-blocking calls in libvirt. [Are overlapping methods mainly used
> by multithreaded clients].

That's up to you; but virsh is our canonical example, and it is
multi-threaded in order to allow Ctrl-C to interrupt long-running tasks
cleanly.

> 2) I was wondering if there was any way to provide a callback along with
> the methods  to achieve non-blocking.[My application has event library so
> it can receive events]

Yes, the event API requires that you register a callback to be invoked
any time you want to receive notifications of events.  You don't have to
use events, but if you do, the examples/domain-events/ directory in
libvirt.git shows how to use them in both C and Python bindings.

> 3) Is the libvirt RPC client multi-threaded. [i.e., does it internally use
> multiple threads to dispatch requests to server and return response to the
> application]

Yes, and the number of worker threads is configured by
/etc/libvirt/libvirtd.conf max_workers.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20130514/f7905337/attachment.sig>


More information about the libvirt-users mailing list