On 11/07/2014 02:24 PM, windy wrote:
Dear Libvirt: How do I get the progress of a long operation
(such as Snapshot take and recover )through libvirt API?
virsh exists as a sample of how to do this for several long-running APIs.
Some APIs are (currently) blocking-only; for those, you have to have a
second thread/process open a second connection to the hypervisor to
track ongoing progress (see how 'virsh migrate --verbose' does this).
Others are asynchronous by default, and require you to poll or wait for
an event for the end of the operation; so a single thread can also query
state in the middle of the operation (see how 'virsh blockpull --wait
--verbose' works).
And for some APIs, we just haven't yet implemented job reporting and
status of those jobs (sadly; 'virsh vol-download' is an example of
this); patches are welcome to help us improve these interfaces to use a
more generic job handling mechanism that can let us run multiple jobs in
parallel.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org