[libvirt] How do I get the progress of a long operation

Dear Libvirt: How do I get the progress of a long operation (such as Snapshot take and recover )through libvirt API? Thankyou.

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

Hi All: In recent days, I have studied the libvirt event model, but found nothing I wanted. In my requirement, I want to get the progress of long operations,especially snapshot taking and revcovering. Today, I studied how virsh migrate command realised, I found that the process of migration is getted by job infomation. But when i taking snapshot the domain's control state is VIR_DOMAIN_CONTROL_OCCUPIED, not expected VIR_DOMAIN_CONTROL_JOB status, So i can't get any job information(all values are zero). Are there any other methods to get the progress of long operation? Thank you ! ------------------ 原始邮件 ------------------ 发件人: "380372671";<380372671@qq.com>; 发送时间: 2014年11月7日(星期五) 晚上9:24 收件人: "libvir-list"<libvir-list@redhat.com>; 主题: How do I get the progress of a long operation Dear Libvirt: How do I get the progress of a long operation (such as Snapshot take and recover )through libvirt API? Thankyou.

On 11/10/2014 09:37 AM, windy wrote:
Hi All:
[please don't top-post on technical lists; also, please configure your mailer to wrap long lines]
In recent days, I have studied the libvirt event model, but found nothing I wanted. In my requirement, I want to get the progress of long operations,especially snapshot taking and revcovering.
I already told you that we don't have very good job support for some long-running jobs, and that one such long-running job is that of taking an internal snapshot. Patches are welcome.
Today, I studied how virsh migrate command realised, I found that the process of migration is getted by job infomation. But when i taking snapshot the domain's control state is VIR_DOMAIN_CONTROL_OCCUPIED, not expected VIR_DOMAIN_CONTROL_JOB status,
Yes, because we don't yet have the ability to interrupt a snapshot creation task. Job control can only be probed for jobs that have been wired up to the asynchronous job framework, and taking an internal snapshot does not yet fit that framework (and it is more than just libvirt that needs patching; qemu itself does not have a way to interrupt the HMP 'savevm' command, and does not have a QMP counterpart command).
So i can't get any job information(all values are zero). Are there any other methods to get the progress of long operation?
It depends on the job you want to interrupt. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
windy