RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1196711 - block job status is missing when zero-length copy job is in mirroring phase
Summary: block job status is missing when zero-length copy job is in mirroring phase
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-26 15:08 UTC by Shanzhi Yu
Modified: 2016-11-03 18:13 UTC (History)
8 users (show)

Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:13:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Shanzhi Yu 2015-02-26 15:08:20 UTC
Description of problem:

block job status is missing when there is blockjob

Version-Release number of selected component (if applicable):

libvirt-1.2.8-16.el7.x86_64

How reproducible:

100%

Steps to Reproduce:

1. Prepare a transient guest
# virsh create r7.xml 
Domain r7 created from r7.xml

2. Do blockcopy job
# virsh blockcopy r7 vda /var/lib/libvirt/images/r7.clone --verbose --wait 

Now in mirroring phase

3. Check job status by blockjob
# virsh blockjob r7 vda 

4. Do another blockcopy 
# virsh blockcopy r7 vda /var/lib/libvirt/images/r7.clone-1 --verbose --wait 
error: block copy still active: disk 'vda' already in active block job


Actual results:


Expected results:

blockjob status should show in step 3


Additional info:

Comment 1 Shanzhi Yu 2015-03-09 06:45:38 UTC
Well, after some debug, seem this is a qemu issue. 
When guest is in mirror phase, 

# rpm -q qemu-kvm-rhev libvirt
qemu-kvm-rhev-2.2.0-5.el7.x86_64
libvirt-1.2.8-16.el7_1.1.x86_64

# virsh qemu-monitor-command test '{"execute":"query-block-jobs"}' 
{"return":[{"io-status":"ok","device":"drive-virtio-disk0","busy":false,"len":0,"offset":0,"paused":false,"speed":0,"ready":true,"type":"mirror"}],"id":"libvirt-10"}

Both len and offset is 0, which means both info.end and info.cur is 0. 
so vshPrintJobProgress will print nothing out.

..
        vshPrintJobProgress(vshDomainBlockJobToString(info.type),
                            info.end - info.cur, info.end);
..
static void
vshPrintJobProgress(const char *label, unsigned long long remaining,
                    unsigned long long total)
{
    int progress;

    if (total == 0)
        /* migration has not been started */
        return;
..

Try with qemu directly


{"execute":"drive-mirror","arguments":{"device":"drive-virtio-disk0","mode":"absolute-paths","format":"qcow2","target":"/var/lib/libvirt/images/test.copy","sync":"full"}}
{"return": {}}
{"timestamp": {"seconds": 1425882693, "microseconds": 587594}, "event": "BLOCK_JOB_READY", "data": {"device": "drive-virtio-disk0", "len": 0, "offset": 0, "speed": 0, "type": "mirror"}}


{"execute":"query-block-jobs"}
{"return": [{"io-status": "ok", "device": "drive-virtio-disk0", "busy": false, "len": 0, "offset": 0, "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}

(qemu) info block
drive-virtio-disk0: /var/lib/libvirt/images/vm3.img (qcow2)

{"execute": "block-job-complete", "arguments": { "device": "drive-virtio-disk0"}}
{"return": {}}
{"timestamp": {"seconds": 1425883294, "microseconds": 349647}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "drive-virtio-disk0", "len": 0, "offset": 0, "speed": 0, "type": "mirror"}}


{"execute":"query-block-jobs"}
{"return": []}

(qemu) info block
drive-virtio-disk0: /var/lib/libvirt/images/test.copy (qcow2)

Comment 2 Shaolong Hu 2015-03-09 08:46:01 UTC
Test with qemu-kvm-rhev-2.2.0-5.el7.x86_64 on my local host, did not hit the problem, the most common mirror works correctly:

{ "execute": "drive-mirror", "arguments": { "device": "drive-virtio-disk0", "target": "/root/sn1", "format": "qcow2", "mode": "absolute-paths", "sync": "full" } }
{"return": {}}


{ "execute" : "query-block-jobs", "arguments" : {} }
{"return": [{"io-status": "ok", "device": "drive-virtio-disk0", "busy": true, "len": 5136515072, "offset": 147718144, "paused": false, "speed": 0, "ready": false, "type": "mirror"}]}

{ "execute" : "query-block-jobs", "arguments" : {} }
{"return": [{"io-status": "ok", "device": "drive-virtio-disk0", "busy": true, "len": 5136711680, "offset": 695599104, "paused": false, "speed": 0, "ready": false, "type": "mirror"}]}

after steady state, block_job_complete, guest works correctly.

Comment 4 Shanzhi Yu 2015-03-17 09:19:47 UTC
Please notice, I use empty qcow2 format file for guest

Comment 5 Eric Blake 2015-03-19 21:13:53 UTC
I think I've dabbled with patching this upstream (although the conversation has died down with me still not committing anything yet...):

https://www.redhat.com/archives/libvir-list/2015-February/msg00053.html

Comment 6 Peter Krempa 2015-04-16 11:42:20 UTC
Re-assigning to Eric since he already posted a patch for this.

Comment 7 Eric Blake 2015-07-28 15:57:07 UTC
I'll have to see if the situation is still present after Peter's work at:
 commit faa143912381aa48e33839b194b32cc14d574589
Author: Peter Krempa <pkrempa>
Date:   Mon Jul 13 17:04:49 2015 +0200

    virsh: Refactor block job waiting in cmdBlockCopy
    
    Similarly to the refactor of cmdBlockCommit in a previous commit this
    does the same change for cmdBlockCopy.

If so, I'll try and revive my earlier patch.

Comment 8 Shanzhi Yu 2015-08-06 10:02:59 UTC
(In reply to Eric Blake from comment #7)
> I'll have to see if the situation is still present after Peter's work at:
>  commit faa143912381aa48e33839b194b32cc14d574589
> Author: Peter Krempa <pkrempa>
> Date:   Mon Jul 13 17:04:49 2015 +0200
> 
>     virsh: Refactor block job waiting in cmdBlockCopy
>     
>     Similarly to the refactor of cmdBlockCommit in a previous commit this
>     does the same change for cmdBlockCopy.
> 
> If so, I'll try and revive my earlier patch.

Eric,

This still happen with v1.2.18-33-g6da3b69. So need your earlier patch.

Comment 9 Peter Krempa 2015-09-11 19:23:59 UTC
It's still not fixed since the bug is only in the percentage display function in virsh which wasn't touched. The function expects some progress to display the state so we will need to work it around.

Comment 11 Peter Krempa 2015-09-23 13:12:45 UTC
commit 7acfb940f712980415e82a46a7de7adb11163a10
Author: Peter Krempa <pkrempa>
Date:   Fri Sep 11 21:34:24 2015 +0200

    virsh: Fix job status indicator for 0 length block jobs
    
    Although 0 length block jobs aren't entirely useful, the output of virsh
    blockjob is empty due to the condition that suppresses the output for
    migration jobs that did not start. Since the only place that actually
    uses the condition that suppresses the output is in migration, let's
    move the check there and thus add support for 0 of 0 equaling to 100%.

Comment 14 Yang Yang 2016-02-25 08:45:44 UTC
Verified on libvirt-1.3.1-1.el7.x86_64

Steps
1. Prepare a transient guest
# virsh create r7.xml 
Domain r7 created from r7.xml

2. Do blockcopy job
# virsh blockcopy r7 vda /var/lib/libvirt/images/r7.clone --verbose --wait 

Now in mirroring phase

Note: vda is an empty disk

3. Check job status by blockjob
# virsh blockjob r7 vda 
Block Copy: [100 %]

Comment 17 errata-xmlrpc 2016-11-03 18:13:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2577.html


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