Bug 1135442

Summary: Output messages are not accurate after blockpull job is aborted
Product: Red Hat Enterprise Linux 7 Reporter: Yang Yang <yanyang>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.1CC: dyuan, rbalakri, shyu, xuzhang, yanyang, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.13-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:47:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yang Yang 2014-08-29 10:35:40 UTC
Description of problem:
The messages output by virsh command blockpull are not accurate after blockpull job is aborted

Version-Release number of selected component (if applicable):
libvirt-1.2.7-2.el7.x86_64
qemu-kvm-rhev-2.1.0-3.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create 4 disk-only snapshots
# virsh snapshot-list test1
 Name                 Creation Time             State
------------------------------------------------------------
 s1                   2014-08-29 17:06:33 +0800 disk-snapshot
 s2                   2014-08-29 17:06:33 +0800 disk-snapshot
 s3                   2014-08-29 17:06:34 +0800 disk-snapshot
 s4                   2014-08-29 17:06:35 +0800 disk-snapshot

2. Do blockpull
# virsh blockpull test1 hda --wait --verbose
Block Pull: [  4 %]

3. Abort the job before it is completed in another terminal
# virsh blockjob test1 hda --abort

4. check the blockpull terminal
# virsh blockpull test1 hda --wait --verbose
Block Pull: [100 %]
Pull complete


Actual results:
in step 4, return with messages:
Block Pull: [100 %]
Pull complete

Expected results:
in step4, should report message like this:
Block Pull: [10 %]
Pull aborted

Additional info:

Comment 2 Erik Skultety 2014-11-20 12:43:11 UTC
Fixed upstream:

commit a74819d8be25d971e3902f6c4fa26e2c90fbd61c
Author: Erik Skultety <eskultet>
Date:   Thu Nov 13 13:01:04 2014 +0100

    virsh: Fix msg: blockjob is aborted from another client
    
    When a block{pull, copy, commit} is aborted via keyboard interrupt,
    the job is properly canceled followed by proper error message.
    However, when the job receives an abort from another client connected
    to the same domain, the error message incorrectly indicates that
    a blockjob has been finished successfully, though the abort request
    took effect. This patch introduces a new blockjob abort handler, which
    is registered when the client calls block{copy,commit,pull} routine,
    providing its caller the status of the finished blockjob.

v1.2.10-137-ga74819d

Comment 4 Yang Yang 2015-04-30 08:44:14 UTC
Verified on libvirt-1.2.14-1.el7.x86_64

Steps
1. create 3 external snapshots
# virsh snapshot-create-as testvm3 s1 --disk-only --no-metadata
Domain snapshot s1 created
# virsh snapshot-create-as testvm3 s2 --disk-only --no-metadata
Domain snapshot s2 created
# virsh snapshot-create-as testvm3 s3 --disk-only --no-metadata
Domain snapshot s3 created

2. terminate the blockpull job by ctrl+c
# virsh blockpull testvm3 vda --wait --verbose
Block Pull: [ 10 %]^C
Pull aborted
# virsh blockjob testvm3 vda
No current block job for vda

3. abort the job from another terminal

in terminal 1
# virsh blockpull testvm3 vda --wait --verbose
Block Pull: [ 24 %]
Pull aborted

in terminal 2
# virsh blockjob testvm3 vda --info
Block Pull: [ 21 %]

# virsh blockjob testvm3 vda --abort

4. terminate the blockcommit job by ctrl+c
# virsh blockcommit testvm3 vda --wait --verbose --active
Block Commit: [ 19 %]^C
Commit aborted

5. terminate the blockcommit job from another terminal
in terminal 1
# virsh blockcommit testvm3 vda --wait --verbose --active
Block Commit: [ 19 %]
Commit aborted

in terminal 2
# virsh blockjob testvm3 vda --abort

6. terminate the blockcopy job by ctrl+c
# virsh blockcopy testvm3 vda /var/lib/libvirt/images/copy --wait --verbose
Block Copy: [  4 %]^C
Copy aborted

7. terminate the blockcopy job from another terminal
in terminal 1
# virsh blockcopy testvm3 vda /var/lib/libvirt/images/copy --wait --verbose --reuse-external
Block Copy: [  6 %]
Copy aborted

in terminal 2
# virsh blockjob testvm3 vda --abort

Comment 6 Yang Yang 2015-05-18 03:22:16 UTC
According comment #4, mark it as verified.

Comment 8 errata-xmlrpc 2015-11-19 05:47:59 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/RHBA-2015-2202.html