Bug 845448

Summary: [blockcopy]sometimes Ctrl+C can't terminate blockcopy when use --wait with other options
Product: Red Hat Enterprise Linux 6 Reporter: zhpeng
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, cwei, dallan, dyasny, dyuan, eblake, mzhan, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-3.el6 Doc Type: Bug Fix
Doc Text:
Cause: SIGINT wasn't blocked during the call to virDomainGetBlockJobInfo in virsh. Consequence: Pressing Ctrl-C might only terminate virsh, without aborting the job. Fix: Block SIGINT for the duration of virDomainGetBlockJobInfo. Result: Block jobs with --wait can be aborted.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:20:38 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:
Bug Depends On: 837787    
Bug Blocks:    

Description zhpeng 2012-08-03 06:31:20 UTC
Description of problem:
sometimes Ctrl+C can't terminate blockcopy when use --wait with other options

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.297.el6.x86_64
libvirt-0.9.10-21.el6_3.3.x86_64


How reproducible:
30%-50%

Steps to Reproduce:
1, create a guest with a disk
# virsh create test.xml
Domain test created from test.xml
2, blockcopy with --wait and other option (example: --finish) before it finished press CTRL+C
# virsh  blockcopy test vda /var/lib/libvirt/images/bak --wait --finish
^Cerror: failed to query job for disk vda
 
# virsh blockjob test vda   -----> terminated
3, delete the copy file and do it again
# virsh  blockcopy test vda /var/lib/libvirt/images/bak --wait --finish
^Cerror: failed to query job for disk vda
error: poll on socket failed: Interrupted system call
# virsh blockjob test vda
Block Copy: [ 10 %]         -----> Job is not terminated


Actually results:
Some times Ctrl+C not works

Expected results:
Always works.

Additional info:
Because BZ 837583,so i don't test it with libvirt-0.9.13-3

Comment 4 Eric Blake 2012-10-12 03:12:36 UTC
'virsh blockpull' has the same issue, so you should be able to test with that sequence while still waiting for 'virsh blockcopy' and 'virsh blockcommit' to actually work with RHEL 6.4 qemu-kvm-rhev.

Fixed by this upstream commit:
commit 13fefaf37fd083ed2a928c414a983b16b0f2d5b7
Author: Ján Tomko <jtomko>
Date:   Thu Oct 11 17:12:13 2012 +0200

    virsh: block SIGINT while getting BlockJobInfo
    
    SIGINT hasn't been blocked, which could lead to losing it somewhere in
    virDomainGetBlockJobInfo and not aborting the job.

Comment 5 Ján Tomko 2012-10-12 14:58:50 UTC
Changing status to POST:

http://post-office.corp.redhat.com/archives/rhvirt-patches/2012-October/msg00624.html

Comment 9 zhe peng 2012-10-31 05:54:14 UTC
this bug can be reproduce with build:

libvirt-0.9.10-21.el6_3.3.x86_64

verify with:
libvirt-0.10.2-6.el6.x86_64

step:
1. create a guest with a disk
#cat vm1.xml
<domain type="kvm">
 <name>vm1</name>
 <memory>131072</memory>
 <devices>
   <disk device="disk" type="block">
      <source dev="/dev/vgtest1/lvleafimg1"/>
      <target bus="ide" dev="hda"/>
       <driver name="qemu" type="qcow2"/>
   </disk>
 </devices>
   <os>
     <type arch="x86_64" machine="pc">hvm</type>
   </os>
</domain>

# virsh create vm1.xml
Domain vm1 created from vm1.xml
2, blockcopy with --wait and other option (example: --finish) before it finished press CTRL+C
# virsh  blockcopy vm1 hda /var/lib/libvirt/images/bak --wait --finish
^Cerror: failed to query job for disk hda
 
# virsh blockjob test vda   -----> terminated
3, delete the copy file and do it again
# virsh  blockcopy test vda /var/lib/libvirt/images/bak --wait --finish
^Cerror: failed to query job for disk vda

# virsh blockjob test vda
no output
the job is terminated.
I try this several times, all worked well.
verification passed.

Comment 10 errata-xmlrpc 2013-02-21 07:20:38 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.

http://rhn.redhat.com/errata/RHSA-2013-0276.html