Bug 738487

Summary: Fix termination by signal with -no-shutdown
Product: Red Hat Enterprise Linux 6 Reporter: Dave Allan <dallan>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.2CC: acathrow, chayang, ehabkost, juzhang, leiwang, michen, mkenneth, mkrcmari, tburke, virt-maint, wanghb8
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.192.el6 Doc Type: Bug Fix
Doc Text:
Cause: When shutting down due to qemu-kvm SIGTERM request, qemu-kvm didn't terminated if -no-shutdown was used. Consequence: SIGTERM couldn't be used to terminate qemu-kvm properly, forcing libvirt to use SIGKILL (see libvirt bug 734773) and potential disk corruption. Change: The SIGTERM handler was changed so qemu-kvm terminates properly after shutdown even if -no-shutdown was used. Result: SIGTERM can now be used to terminate qemu-kvm even if -no-shutdown is used, and libvirt doesn't need to use SIGKILL anymore (libvirt bug 734773).
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 16:03:22 UTC Type: ---
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:    
Bug Blocks: 734773, 743047    

Description Dave Allan 2011-09-14 23:40:29 UTC
Multiple customers have requested qemu support for graceful reboot using the libvirt API, functionality which works under Xen.  Libvirt implemented graceful reboot using the no-shutdown qemu option, but the result is data corruption under certain circumstances, and we are reverting the libvirt changes pending resolution of this BZ.  From our perspective, it doesn't really matter whether the solution is to implement a graceful reboot monitor command or to fix no-shutdown, although since we've implemented based on no-shutdown and IIUC graceful reboot was rejected by qemu upstream, I'd somewhat prefer fixing no-shutdown.

Comment 3 Dor Laor 2011-09-15 13:58:01 UTC
*** Bug 738273 has been marked as a duplicate of this bug. ***

Comment 5 Chao Yang 2011-09-21 09:47:28 UTC
Reproduced this issue with following steps on qemu-kvm-0.12.1.2-2.190.el6.x86_64
Steps:
1. boot a VM with -no-shutdown
2. send SIGTERM signal by 'kill -15 `pidof qemu-kvm`' during booting
3. issue 'cont', click on shutdown button after VM boot up
4. issue 'system_reset' then 'cont' in monior
5. click on shutdown button after VM boot up
6. send SIGTERM signal by 'kill -15 `pidof qemu-kvm`'

Actual Result:
after step 2, VM stopped,
(qemu) info status
VM status: paused
after step 3, VM stopped,
(qemu) info status
VM status: paused
after step 5, VM stopped,
-----> step 3,5 have reproduced bz728464
(qemu) info status 
after step 6, VM still stopped.
-----> step 2, 6 has reproduced this issue

Verified with same steps mentioned above on qemu-kvm-0.12.1.2-2.192.el6.x86_64, need re-launch a VM after step 2

Actual Result:
after step 2, VM quitted, ps -axu | grep qemu couldn't output qemu-kvm process
after step 3, VM stopped,
(qemu) handle_dev_input: stop
(qemu) info status
VM status: paused
after step 5, VM stopped
-----> this proved that this fix wouldn't cause problem like bz728464
after step 6, VM quitted, ps -axu | grep qemu couldn't output qemu-kvm process


CLI:
# /usr/libexec/qemu-kvm -M rhel6.2.0 -enable-kvm -m 4096 -smp 4,sockets=1,cores=4,threads=1 -name RHEL6.1_64 -uuid `uuidgen` -rtc base=utc,clock=host,driftfix=slew -boot menu=on -drive file=/home/rhel6.1.z-x86_64.qcow2,if=none,id=drive-virtio-0-0,media=disk,format=qcow2,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,drive=drive-virtio-0-0,id=virt0-0-0,bootindex=1 -netdev tap,id=hostnet1,vhost=on -device virtio-net-pci,netdev=hostnet1,id=net1,mac=64:31:50:41:e1:c3 -usb -device usb-tablet,id=input1,bus=usb.0,port=1  -spice port=7000,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864 -monitor stdio -balloon none -no-shutdown
                                                                    ^^^^^^^^^^^^


-----Conclusion:
Based on above, I think  this issue has been fixed correctly.

Comment 8 Eduardo Habkost 2011-11-22 13:33:43 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: When shutting down due to qemu-kvm SIGTERM request, qemu-kvm didn't terminated if -no-shutdown was used.

Consequence: SIGTERM couldn't be used to terminate qemu-kvm properly, forcing libvirt to use SIGKILL (see libvirt bug 734773) and potential disk corruption.

Change: The SIGTERM handler was changed so qemu-kvm terminates properly after shutdown even if -no-shutdown was used.

Result: SIGTERM can now be used to terminate qemu-kvm even if -no-shutdown is used, and libvirt doesn't need to use SIGKILL anymore (libvirt bug 734773).

Comment 9 errata-xmlrpc 2011-12-06 16:03:22 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-2011-1531.html