Bug 889635

Summary: 'virsh shutdown' is broken if guest-agent isn't responsive
Product: Red Hat Enterprise Linux 6 Reporter: Eric Blake <eblake>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4CC: acathrow, cwei, dallan, dyuan, eblake, juzhang, lnovich, mzhan, qzhang, tzheng
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-19.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 08:36:08 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 Eric Blake 2012-12-22 02:17:57 UTC
Description of problem:
Use of 'virsh shutdown --mode=agent' obviously requires both host and guest setup (a <channel> in the XML on the host side, and qemu-guest-agent installed and running in the guest).  But 'virsh shutdown' with no explicit --mode argument is a request to use driver-preferred shutdown technology.  In my case, I was running a guest where the host had the <channel> set up, but the guest was not running the agent; when I did 'virsh shutdown' with no mode argument, libvirt tried to do an agent shutdown, but that failed; and there was no fallback to acpi shutdown.  As a result, I was only able to shutdown the guest with an explicit 'virsh shutdown --mode=acpi'.  But this could be termed a regression over RHEL 6.0, where there was no --mode argument, and acpi shutdown was the default.

Version-Release number of selected component (if applicable):
libvirt-0.10.2-13.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. set up a guest with an agent <channel> in the XML, but with the guest agent not installed and running in the guest
2. in the host, issue unadorned 'virsh shutdown $guest'
3.
  
Actual results:
# virsh shutdown fedora-local
error: Failed to shutdown domain fedora-local
error: Guest agent is not responding: Guest agent not available for now


Expected results:
If the agent isn't responsive to a simple echo test, and --mode wasn't specified, then the qemu driver should fall back to an acpi shutdown instead of giving up immediately.

Additional info:

Comment 1 Michal Privoznik 2013-02-25 17:56:10 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2013-February/msg01406.html

Comment 2 Michal Privoznik 2013-02-27 08:27:46 UTC
Patch has been accepted upstream:

https://www.redhat.com/archives/libvir-list/2013-February/msg01450.html

However, the upsream is currently short before release so it's being discussed upstream it the patch is well understood and thus safe to push now or whether it should be postponed until after the release.

Comment 3 Michal Privoznik 2013-03-01 08:10:45 UTC
Moving to POST:

commit b8e25c35d7f80a2fadc0e51e95318e39db3d1687
Author:     Michal Privoznik <mprivozn>
AuthorDate: Mon Feb 25 18:52:12 2013 +0100
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Feb 28 12:24:34 2013 +0100

    qemu: Don't fail to shutdown domains with unresponsive agent
    
    Currently, qemuDomainShutdownFlags() chooses the agent method of
    shutdown whenever the agent is configured. However, this
    assumption is not enough as the guest agent may be unresponsive
    at the moment. So unless guest agent method has been explicitly
    requested, we should fall back to the ACPI method.


v1.0.3-rc2-11-gb8e25c3

Comment 12 tingting zheng 2013-07-10 05:40:18 UTC
I can reproduce this bug with:
libvirt-0.10.2-13.el6.x86_64

Steps:
1. set up a guest with an agent <channel> in the XML, but with the guest agent not installed and running in the guest

2. in the host, execute command:
# virsh shutdown demo
error: Failed to shutdown domain demo
error: Guest agent is not responding: Guest agent not available for now

Tested with:
libvirt-0.10.2-19.el6.x86_64

# virsh shutdown demo
Domain demo is being shutdown

Refer to the above comments,move the bug to VERIFIED.

Comment 14 errata-xmlrpc 2013-11-21 08:36:08 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-2013-1581.html