Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 906644

Summary: Libvirt should enhance check for domain status before doing suspend and resume
Product: Red Hat Enterprise Linux 6 Reporter: Alex Jia <ajia>
Component: libvirtAssignee: John Ferlan <jferlan>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, dyasny, dyuan, eblake, mzhan, rwu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-16 12:03:39 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 Alex Jia 2013-02-01 05:44:03 UTC
Description of problem:
I can repeat to run virsh suspend or resume for a running or paused guest, and also can get the same result "Domain XXX suspended" and "Domain XXX resumed" each time, I have never thought it's a question before, but if a guest is paused status then I'm successfully suspending a paused status guest? I think libvirt should check if a guest is paused status before doing suspend, if so, it should raise a friendly message to users such as "error: Domain is already paused", similarly, "error: Domain is already active" for virsh resume a running guest.


Version-Release number of selected component (if applicable):
# rpm -q libvirt
libvirt-0.10.2-18.el6.x86_64


How reproducible:
always

Steps to Reproduce:
1. virsh start <domain>
2. virsh suspend <domain>
3. repeat 2
4. virsh resume <domain>
5. repeat 4
  
Actual results:

# virsh list
 Id    Name                           State
----------------------------------------------------
 133   foo                            running

# virsh suspend foo
Domain foo suspended

# virsh list
 Id    Name                           State
----------------------------------------------------
 133   foo                            paused

# virsh suspend foo
Domain foo suspended

# virsh list
 Id    Name                           State
----------------------------------------------------
 133   foo                            paused

# virsh resume foo
Domain foo resumed

# virsh list
 Id    Name                           State
----------------------------------------------------
 133   foo                            running

# virsh resume foo
Domain foo resumed

# virsh list
 Id    Name                           State
----------------------------------------------------
 133   foo                            running


Expected results:
To raise "error: Domain is already paused" for a paused guest for virsh suspend, similarly, "error: Domain is already active" for virsh resume a running guest.

Additional info:

Comment 2 Eric Blake 2013-04-15 17:23:30 UTC
Upstream pointed out that any rejection of a state change (because the state is already correct) would have to come from libvirtd, not virsh, in order to avoid races.  But doing that would require the addition of a new flag, which in turn would require a new virDomainSuspendFlags() and virDomainResumeFlags() API.
https://www.redhat.com/archives/libvir-list/2013-April/msg01131.html

Comment 3 John Ferlan 2013-04-16 12:03:39 UTC
As upstream notes - the state checks don't belong in virsh and the drivers make the final determination of whether to pause or resume based on properly locked and sequenced checks.