On Wed, Jan 04, 2017 at 07:16:03PM +0200, Ala Hino wrote:
I understand that libvirt provides async events that are triggered
once the
block job reaches ready state and successfully pivots as it is reported by
qemu.
Whats the event that is triggered and what's the handler that we have to
implement?
The exact event is: BLOCK_JOB_READY
Also, as Peter Krempa once pointed out, the above is exposed via XML:
Libvirt expose the state of the copy job in the XML and forward the
READY event from qemu to the users.
A running copy job exposes itself in the xml as:
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source
file='/var/lib/libvirt/images/systemrescuecd-x86-4.8.0.iso'/>
<backingStore/>
<mirror type='file' file='/tmp/ble.img' format='raw'
job='copy'>
<format type='raw'/>
<source file='/tmp/ble.img'/>
</mirror>
[...]
</disk>
While the ready copy job is exposed as:
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source
file='/var/lib/libvirt/images/systemrescuecd-x86-4.8.0.iso'/>
<backingStore/>
<mirror type='file' file='/tmp/ble.img' format='raw'
job='copy' ready='yes'>
<format type='raw'/>
<source file='/tmp/ble.img'/>
</mirror>
[...]
</disk>
To be more specific, I am looking for the onEVENT callback method
that is
invoked when the event is fired.
Afraid, I don't know the exact callback you have to implement. Perhaps
Peter or Eric Blake can say.
But some more related context (lots of reading), as the issue is a bit
more complicated.
You might also want to look at the below two bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=1382165 --
virDomainGetBlockJobInfo: Adjust job reporting based on QEMU stats &
the "ready" field of `query-block-jobs`
And (now fixed):
https://bugzilla.redhat.com/show_bug.cgi?id=1372613 -- Improve live
block device job status reporting via virDomainBlockJobInfo()
And may want to go through this entire thread:
https://www.redhat.com/archives/libvir-list/2016-October/msg00217.html
-- RFC: Exposing "ready" bool (of `query-block-jobs`) or QMP
BLOCK_JOB_READY event
[...]
--
/kashyap