Bug 727047

Summary: domjobabort works abnormal on libvirt-0.9.4-0rc2.el6
Product: Red Hat Enterprise Linux 6 Reporter: weizhang <weizhan>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 6.2CC: dallan, dyuan, jyang, mzhan, rwu, vbian, veillard
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.4-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 11:18:16 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 weizhang 2011-08-01 07:26:14 UTC
Description of problem:
domjobabort works abnormal on version libvirt-0.9.4-0rc2.el6, it seems give wrong error message
when just running a domain do
virsh domjobabort domain, it will report
error: Requested operation is not valid: domain is not running

when destroy this domain and do
virsh domjobabort domain, it will report
error: Requested operation is not valid: no job is active on the domain

seems the above 2 error message is reversed

when do save and domjobabort, it always failed
# virsh save domain domain.save
before above command finished, on other console do
# virsh domjobabort domain
it will report error:
error: Requested operation is not valid: domain is not running


Version-Release number of selected component (if applicable):
kernel-2.6.32-171.el6.x86_64
libvirt-0.9.4-0rc2.el6.x86_64
qemu-kvm-0.12.1.2-2.172.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. running a domain and then do
# virsh domjobabort domain
2. destroy the domain and then do
# virsh domjobabort domain
3. start a domain and save it
# virsh save domain domain.save 
before above command finished, on other console do
# virsh domjobabort domain
  
Actual results:
step 1 & 2 give wrong error message, step3 failed with wrong error message

Expected results:
step 1 & 2 give right error message, step3 should succeed.

Additional info:

Comment 1 weizhang 2011-08-01 07:27:43 UTC
it works well on libvirt-0.9.4-0rc1.el6.x86_64, so it is a regression bug

Comment 4 Osier Yang 2011-08-01 11:44:16 UTC
commit f362a99a53a7e916d4c957a8c5dea819e3481fbc
Author: Osier Yang <jyang>
Date:   Mon Aug 1 19:41:07 2011 +0800

    qemu: Fix a regression of domjobabort
    
    Introduced by f9a837da73a11ef, the condition is not changed after
    the else clause is removed. So now it quit with "domain is not
    running" when the domain is running. However, when the domain is
    not running, it reports "no job is active".
    
    How to reproduce:
    
    1)
    % virsh start $domain
    % virsh domjobabort $domain
    error: Requested operation is not valid: domain is not running
    
    2)
    % virsh destroy $domain
    % virsh domjobabort $domain
    error: Requested operation is not valid: no job is active on the domain
    
    3)
    % virsh save $domain /tmp/$domain.save
    
    Before above commands finished, try to abort job in another terminal
    
    % virsh domabortjob $domain
    error: Requested operation is not valid: domain is not running

Patch committed, move to POST.

Comment 6 dyuan 2011-08-04 06:52:01 UTC
Reproduced this bug with libvirt-0.9.4-0rc2.el6.

Verified PASS with libvirt-0.9.4-1.el6.
pkgs:
qemu-kvm-0.12.1.2-2.176.el6
kernel-2.6.32-176.el6

# virsh list --all
 Id Name                 State
----------------------------------
  - dom                  shut off

# virsh domjobabort dom
error: Requested operation is not valid: domain is not running

# virsh start dom
Domain dom started

# virsh domjobabort dom
error: Requested operation is not valid: no job is active on the domain

# virsh save dom /tmp/dom.save & sleep 2; virsh domjobabort dom
[1] 12034

# error: Failed to save domain dom to /tmp/dom.save
error: operation failed: domain save job: canceled by client

[1]+  Exit 1                  virsh save dom /tmp/dom.save

# virsh list --all
 Id Name                 State
----------------------------------
  1 dom                  running

Comment 7 errata-xmlrpc 2011-12-06 11:18:16 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/RHBA-2011-1513.html