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.
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:
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
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.