Bug 808527

Summary: Check for guest agent presence when issuing command
Product: Red Hat Enterprise Linux 6 Reporter: Michal Privoznik <mprivozn>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: acathrow, ajia, dallan, dyasny, dyuan, mzhan, rwu, veillard, whuang, zhwang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.9.10-11.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:51:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Privoznik 2012-03-30 15:39:40 UTC
Description of problem:
Libvirt added support for qemu GA just recently. However, it is possible to stuck an API and therefore tear down whole daemon because when issuing GA command libvirt waits endlessly for its response.


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


How reproducible:
100%

Steps to Reproduce:
1. start guest with GA
2. kill GA within guest
3. issue any API involving GA, e.g.:
    virsh shutdown --mode agent DOMAIN
    virsh snapshot-create --disk-only --quiesce DOMAIN
  
Actual results:
virsh hangs

Expected results:
virsh should print error message

Additional info:
This bug has emerged from Bug 767333 and Bug 804210 because the functionality those two are requesting has been added. However, this bug covers problem one can hit in both of them.

Comment 4 dyuan 2012-04-06 08:35:07 UTC
Verified PASS with libvirt-0.9.10-10.el6.

# time virsh shutdown --mode agent rhel6
error: Failed to shutdown domain rhel6
error: internal error Guest agent not available for now


real	0m4.978s
user	0m0.007s
sys	0m0.007s

# virsh snapshot-create --disk-only --quiesce xp
error: argument unsupported: QEMU guest agent is not configured

Comment 5 dyuan 2012-04-06 09:33:56 UTC
For the comment 4, the snapshot-create is tested with windows guest xp without GA configured.

When I re-check it with a rhel guest with qemu-ga, but the guest is paused or stop qemu-ga in guest, the error msg doesn't make sense. Is that the expected result ?

pause the guest, then issue snapshot-create:
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 2     rhel6-q                        paused

# virsh snapshot-create --disk-only --quiesce rhel6-q
error: An error occurred, but the cause is unknown


stop qemu-ga in guest, then issue snapshot-create:
# virsh snapshot-create --disk-only --quiesce rhel6-q
error: An error occurred, but the cause is unknown

Comment 6 Michal Privoznik 2012-04-06 10:01:02 UTC
No it is not. However, since this is restricted to snapshot-create only, I think we should leave this VERIFIED and re-open bug 804210 so I can post patch.

Comment 7 dyuan 2012-04-06 10:14:17 UTC
(In reply to comment #6)
> No it is not. However, since this is restricted to snapshot-create only, I
> think we should leave this VERIFIED and re-open bug 804210 so I can post patch.

Confirmed with assignee on irc.

The snapshot is rejected for the paused guest in bug 804210, I'll keep it as VERIFIED.
For this bug, I re-assign it for the better msg should be returned when check for guest agent presence.

Comment 8 Michal Privoznik 2012-04-06 11:02:47 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2012-April/msg00252.html

Comment 10 dyuan 2012-04-12 07:16:16 UTC
Verified PASS with libvirt-0.9.10-11.el6.

# virsh snapshot-create --disk-only --quiesce rhel6-q
error: internal error Guest agent not available for now

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 2     rhel6-q                        running

# virsh suspend rhel6-q
Domain rhel6-q suspended

# virsh snapshot-create --disk-only --quiesce rhel6-q

error: internal error Guest agent not available for now

# virsh list 
 Id    Name                           State
----------------------------------------------------
 2     rhel6-q                        paused

# virsh resume rhel6-q
Domain rhel6-q resumed

Comment 11 dyuan 2012-04-28 08:14:24 UTC
I just add comment in this bug because the comm 53 in bug 766958 is related to this bug. Too many comments there but it's okay for us to track the following issue in both 2 bugs.

The issue in comm 48 of bug 766958:

start the qemu-ga via # service qemu-ga start, dompmsuspend will fail.

# virsh dompmsuspend rhel6-q mem
error: Domain rhel6-q could not be suspended
error: internal error unable to execute QEMU command 'guest-suspend-ram': unknown QEMU command error

start the qemu-ga via # /usr/bin/qemu-ga start, dompmsuspend is okay.

# virsh dompmsuspend rhel6-q mem
Domain rhel6-q successfully suspended

For qemu-kvm, if you send 'guest-ping' first and then send 'guest-suspend-ram', it will be okay. Please refer to bug 816893.

Comment 13 errata-xmlrpc 2012-06-20 06:51:41 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/RHSA-2012-0748.html

Comment 14 zhenfeng wang 2012-12-25 08:47:00 UTC
Now, in pkg qemu-guest-agent-win32-0.12.1.2-2.346.el6.x86_64.rpm  we can do the s3/s4 in windows guest based the windows guest agent supported commands list
supported commands:
"guest-info"
"guest-ping"
"guest-sync-delimited"
"guest-sync"
"guest-shutdown" (include shutdown,reboot,halt)
"guest-suspend-disk"
"guest-suspend-ram"
Since there was a bug 888716 over there ,so the command "guest-susend-disk "not work well so far