Description of problem: The function of virDomainGetBlockJobInfo is to get the block job status.But the virDomainBlockJobInfoPtr structure which is geted by virDomainGetBlockJobInfo only has cur and end member.Users can only be based on these two values are equal to judge whether the block job is completed.But in fact, the block job maybe don't finish yet although cur and end are equal.For example,the job is doing flush operation. The structure of qemuMonitorBlockJobInfo which is used by qemu and libvirt has ready flag.This flag is signed when the block job is complete finished.I don't know why virDomainBlockJobInfoPtr does't has this member. Version-Release number of selected component (if applicable): libvirt-1.2.21 How reproducible: Migrate virtual disk from disk array to lvm with virDomainBlockRebase.Then get block job status with virDomainGetBlockJobInfo. Actual results: The cur and end which are the members of virDomainBlockJobInfoPtr are equal.But the block job does not complete.
(In reply to Michael Liu from comment #0) > Description of problem: > > The function of virDomainGetBlockJobInfo is to get the block job status.But > the virDomainBlockJobInfoPtr structure which is geted by > virDomainGetBlockJobInfo only has cur and end member.Users can only be based > on these two values are equal to judge whether the block job is Public API structures can't be changed since it would break ABI. > completed.But in fact, the block job maybe don't finish yet although cur and > end are equal.For example,the job is doing flush operation. That's true. This was the reason why libvirt added VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 event which fires after the block job completes. The event contains field called 'status' which returns the following data: enum virConnectDomainEventBlockJobStatus { VIR_DOMAIN_BLOCK_JOB_COMPLETED = 0 VIR_DOMAIN_BLOCK_JOB_FAILED = 1 VIR_DOMAIN_BLOCK_JOB_CANCELED = 2 VIR_DOMAIN_BLOCK_JOB_READY = 3 VIR_DOMAIN_BLOCK_JOB_LAST = 4 } VIR_DOMAIN_BLOCK_JOB_READY is the appropriate event you want to wait for. > The structure of qemuMonitorBlockJobInfo which is used by qemu and libvirt > has ready flag.This flag is signed when the block job is complete finished.I > don't know why virDomainBlockJobInfoPtr does't has this member. > Version-Release number of selected component (if applicable): > libvirt-1.2.21 > > How reproducible: > Migrate virtual disk from disk array to lvm with virDomainBlockRebase.Then > get block job status with virDomainGetBlockJobInfo. This is incorrect approach as described above. > > Actual results: > The cur and end which are the members of virDomainBlockJobInfoPtr are > equal.But the block job does not complete.