Bug 821622 - doc improvement for "virsh shutdown"
doc improvement for "virsh shutdown"
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
x86_64 Linux
low Severity low
: rc
: 6.3
Assigned To: Libvirt Maintainers
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2012-05-15 03:00 EDT by EricLee
Modified: 2012-05-16 09:56 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-05-16 09:56:25 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description EricLee 2012-05-15 03:00:32 EDT
Description of problem:
"man virsh" should write shutdown command will not effect until the acpi daemon started in the guest and "virsh shutdown" should give error info when acpid is not available with the option "--mode acpi"

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Guest OS is greater than RHEL6(have acpi pkg installed).
# virsh start raw
Domain raw started

run the command ASAP (before the acpi daemon started):
# virsh shutdown --mode acpi raw 
Domain raw is being shutdown
But it will not effect(guest will still running).

After a moment(after the acpi daemon started), rerun the command:
# virsh shutdown --mode acpi raw
Domain raw is being shutdown
And it start to shutdown the guest gracefully.

# man virsh
       shutdown domain-id [--mode acpi|agent]
           Gracefully shuts down a domain.  This coordinates with the domain OS to perform graceful
           shutdown, so there is no guarantee that it will succeed, and may take a variable length of
           time depending on what services must be shutdown in the domain.

           The exact behavior of a domain when it shuts down is set by the on_shutdown parameter in the
           domain’s XML definition.

           If domain-id is transient, then the metadata of any snapshots will be lost once the guest
           stops running, but the snapshot contents still exist, and a new domain with the same name
           and UUID can restore the snapshot metadata with snapshot-create.

           By default the hypervisor will try to pick a suitable shutdown method. To specify an
           alternative method, the --mode parameter can specify "acpi" or "agent".

Another environment :
Login to the guest, stop the acpid service:
#service acpid stop

Then rerun command:
# virsh shutdown raw
Domain raw is being shutdown

Actual results:
As below.

Expected results:
Could see something about this circumstances in "man virsh".

When acpid is stoped, the shutdown command should fail with error info like: "error: QEMU guest acpid is not available", but no effect with info "Domain raw is being shutdown" .

Additional info:
just like "--mode agent", when it was not configured shutdown will failed:
# virsh shutdown --mode agent qcow2
error: Failed to shutdown domain qcow2
error: argument unsupported: QEMU guest agent is not configured
Comment 2 Dave Allan 2012-05-16 09:56:25 EDT
The problem here is that libvirt doesn't know what's running in the guest.  It would be possible to hack qemu-ga to provide this information, but IMO that's not worth doing, since if you have qemu-ga, you can call it to shutdown the guest and avoid acpi entirely.  Since the virsh man page already documents that shutdown requires cooperation with the guest OS and is not guaranteed to succeed, I don't think there's anything that can be done here.

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