Bug 906644 - Libvirt should enhance check for domain status before doing suspend and resume
Libvirt should enhance check for domain status before doing suspend and resume
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.4
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: John Ferlan
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-01 00:44 EST by Alex Jia
Modified: 2013-04-16 08:03 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-04-16 08:03:39 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alex Jia 2013-02-01 00:44:03 EST
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 13:23:30 EDT
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 08:03:39 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.