Bug 1336333 - libvirt-1.2.21 virDomainBlockJobInfoPtr should add ready flag in the structure
Summary: libvirt-1.2.21 virDomainBlockJobInfoPtr should add ready flag in the structure
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-16 08:17 UTC by Michael Liu
Modified: 2016-05-16 08:44 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-16 08:44:44 UTC


Attachments (Terms of Use)

Description Michael Liu 2016-05-16 08:17:21 UTC
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.

Comment 1 Peter Krempa 2016-05-16 08:44:44 UTC
(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.


Note You need to log in before you can comment on or make changes to this bug.