Bug 1236924

Summary: "Guest agent disappeared while executing command" after logged into the graphical desktop of the guest.
Product: Red Hat Enterprise Linux 7 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: dyuan, fjin, marcandre.lureau, mzhan, rbalakri, zhwang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.17-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 06:47:11 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:
Attachments:
Description Flags
libvirtd log none

Description Fangge Jin 2015-06-30 02:48:57 UTC
Description:
 "Guest agent disappeared while executing command" after logged into the graphical desktop of the guest. Then "virsh shutdown <domain>" will lead the guest to suspended state.

Host Version:
libvirt-1.2.16-1.el7.x86_64
qemu-kvm-rhev-2.3.0-6.el7.x86_64
kernel-3.10.0-277.el7.x86_64

Guest Version:
qemu-guest-agent-2.3.0-1.el7.x86_64
kernel-3.10.0-229.el7.x86_64

How reproducible:
>70%

Steps to Reproduce:
0. Prepare a guest with graphical desktop and unix channel.

1. Start the guest.
# virsh start rhel7.0

2.Get the domtime of rhel7.0
# virsh domtime rhel7.0
Time: 1435631087

3.Launch virt-manager, log into the graphical desktop of rhel7.0.

4.Get the domtime of rhel7.0
# virsh domtime rhel7.0
error: Guest agent is not responding: Guest agent disappeared while executing command

5.Try to shutdown rhel7.0 with mode=agent
# virsh shutdown rhel7.0 --mode agent
error: Failed to shutdown domain rhel7.0
error: Guest agent is not responding: Guest agent disappeared while executing command

# virsh list
 Id    Name                           State
----------------------------------------------------
 64    rhel7.0                        running

6.Try to shutdown rhel7.0 without mode option
# virsh shutdown rhel7.0
Domain rhel7.0 is being shutdown

# virsh list
 Id    Name                           State
----------------------------------------------------
 64    rhel7.0                        pmsuspended

7.Check the libvirtd log, found:
2015-06-30 02:25:29.708+0000: 28793: error : qemuAgentCommand:1120 : Guest agent is not responding: Guest agent disappeared while executing command
2015-06-30 02:25:42.089+0000: 28790: error : qemuAgentCommand:1120 : Guest agent is not responding: Guest agent disappeared while executing command
2015-06-30 02:25:48.234+0000: 28791: error : qemuAgentCommand:1120 : Guest agent is not responding: Guest agent disappeared while executing command
2015-06-30 02:25:49.533+0000: 28789: debug : qemuProcessHandlePMSuspend:1221 : Transitioned guest rhel7.0 to pmsuspended state due to QMP suspend event


Actual results:
After log into the guest, as step4~6, guest agent disappeared. And in step6, "virsh shutdown rhel7.0" lead the guest to suspended state. Libvirtd.log attached.

Expected results:
After log into the guest, guest agent should work well as normal. And guest should not enter suspended state in step6.

Additional info:
A guest without graphical user interface doesn't have such problem.

Comment 3 Peter Krempa 2015-06-30 07:36:59 UTC
Please attach the libvirtd debug log. (as it looks like you forgot to do so)

Comment 4 Fangge Jin 2015-06-30 08:11:01 UTC
Created attachment 1044614 [details]
libvirtd log

Comment 5 Peter Krempa 2015-06-30 11:41:37 UTC
Fixed upstream:

commit f1caa42777ff5433fb15f05f62d2ff717876eeac
Author: Peter Krempa <pkrempa>
Date:   Tue Jun 30 10:46:50 2015 +0200

    qemu: Close the agent connection only on agent channel events
    
    processSerialChangedEvent processes events for all channels. Commit
    2af51483 broke all agent interaction if a channel other than the agent
    closes since it did not check that the event actually originated from
    the guest agent channel.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1236924
    Fixes up: https://bugzilla.redhat.com/show_bug.cgi?id=890648

v1.2.17-rc1-5-gf1caa42

Comment 8 Fangge Jin 2015-07-03 10:02:54 UTC
I can reproduce this bug on build:
libvirt-1.2.16-1.el7.x86_64

Verify this bug on build:
libvirt-1.2.17-1.el7.x86_64

Verify steps:
0. Prepare a guest with graphical desktop and unix channel.

1. Start the guest.
# virsh start rhel7.0

2.Get the domtime of rhel7.0
# virsh domtime rhel7.0
Time: 1435917493

3.Launch virt-manager, log into the graphical desktop of rhel7.0.

4.Get the domtime of rhel7.0
# virsh domtime rhel7.0
Time: 1435917554

5.Shutdown rhel7.0 with mode=agent
# virsh shutdown rhel7.0 --mode agent
Domain rhel7.0 is being shutdown

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 64    rhel7.0                        shutoff

6.Start rhel7.0 again, log into the graphical desktop of rhel7.0, and shutdown without option.
# virsh shutdown rhel7.0
Domain rhel7.0 is being shutdown

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 64    rhel7.0                        shutoff

7.Check the libvirtd log, there is NO such error log:
 error : qemuAgentCommand:1120 : Guest agent is not responding: Guest agent disappeared while executing command

The bug has been fixed, so move to verified.

Comment 10 errata-xmlrpc 2015-11-19 06:47:11 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.

https://rhn.redhat.com/errata/RHBA-2015-2202.html