Bug 795656

Summary: destroyFlags should raise exception with proper error code
Product: Red Hat Enterprise Linux 6 Reporter: Igor Lvovsky <ilvovsky>
Component: libvirtAssignee: Eric Blake <eblake>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: high    
Version: 6.3CC: acathrow, crobinso, dallan, danken, dyuan, eblake, gsun, lpeer, mzhan, rwu, xen-maint
Target Milestone: rc   
Target Release: 6.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.9.10-3.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:48:51 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:

Description Igor Lvovsky 2012-02-21 07:50:50 UTC
Description of problem:

For now destroyFlags(VIR_DOMAIN_DESTROY_GRACEFUL) raise libvirt.libvirtError
exception when failed.
In this case error code is VIR_ERR_INTERNAL_ERROR and message is "failed to kill qemu process with SIGTERM".

The problem is that  VIR_ERR_INTERNAL_ERROR is too general.
Please consider to change it to something more meaningful


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


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Eric Blake 2012-02-22 18:50:32 UTC
Upstream patch proposed:
https://www.redhat.com/archives/libvir-list/2012-February/msg00940.html

Comment 2 Eric Blake 2012-02-23 16:01:49 UTC
Bare minimum backport in POST:

http://post-office.corp.redhat.com/archives/rhvirt-patches/2012-February/msg01316.html

However, we have the bigger question of whether we should also be backporting graceful destroy.

Comment 3 Eric Blake 2012-02-24 16:36:29 UTC
Upstream has a graceful timeout on destroy, which is the probably primary reason that you would hit this error in the first place.  Should we widen the scope of this bug to also include backporting the VIR_DOMAIN_DESTROY_GRACEFUL flag and implementation?

Comment 4 Dan Kenigsberg 2012-02-26 16:02:15 UTC
In my opinion, there is no need to backport VIR_DOMAIN_DESTROY_GRACEFUL to rhel-6.2 unless we receive a clear customer request. RHEV-3.0 has its guest-agent-assisted graceful destruction; if it was not used, the customer probably care less about his data.

Comment 7 Wayne Sun 2012-03-01 04:14:36 UTC
# rpm -q libvirt qemu-kvm
libvirt-0.9.10-3.el6.x86_64
qemu-kvm-0.12.1.2-2.225.el6.x86_64

1. prepare a running domain
# virsh list 
 Id    Name                           State
----------------------------------------------------
 2     rhel6u2                        running

2. hung the domain process
# pidof qemu-kvm
25933

# kill -STOP 25933

3. destroy domain with graceful
# virsh destroy rhel6u2 --graceful
error: Failed to destroy domain rhel6u2
error: operation failed: failed to kill qemu process with SIGTERM

In libvirtd.log
2012-03-01 04:06:39.889+0000: 21282: warning : qemuProcessKill:3592 : Timed out waiting after SIGTERM to process 25933
2012-03-01 04:06:39.889+0000: 21282: error : qemuDomainDestroyFlags:1796 : operation failed: failed to kill qemu process with SIGTERM

So this is fixed.

Comment 8 Wayne Sun 2012-03-01 04:20:52 UTC
check with python
# python
Python 2.6.6 (r266:84292, Sep 12 2011, 14:03:14) 
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open(None)
>>> dom = conn.lookupByName("rhel6u2")
>>> dom.destroyFlags(1)
libvir: QEMU error : operation failed: failed to kill qemu process with SIGTERM
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 683, in destroyFlags
    if ret == -1: raise libvirtError ('virDomainDestroyFlags() failed', dom=self)
libvirt.libvirtError: operation failed: failed to kill qemu process with SIGTERM

Comment 10 errata-xmlrpc 2012-06-20 06:48:51 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-2012-0748.html