Bug 1122151 - Pass close from qemu-ga
Summary: Pass close from qemu-ga
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Laszlo Ersek
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 890648
TreeView+ depends on / blocked
 
Reported: 2014-07-22 16:06 UTC by Laszlo Ersek
Modified: 2015-03-05 08:10 UTC (History)
23 users (show)

Fixed In Version: qemu-kvm-1.5.3-69.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1080376
Environment:
Last Closed: 2015-03-05 08:10:55 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0349 normal SHIPPED_LIVE Important: qemu-kvm security, bug fix, and enhancement update 2015-03-05 12:27:34 UTC

Comment 2 Miroslav Rezanina 2014-08-26 14:03:55 UTC
Fix included in qemu-kvm-1.5.3-69.el7

Comment 4 Xiaoqing Wei 2014-11-03 07:18:54 UTC
Hello Laszlo,

Could you pls tell me how to check whether this bug is fixed ?

I referred the cloned bugs 1080376, 890648.

no knowing if I am understand that correctly:

steps to verify:

1) provision a rhel7 host
qemu-kvm-1.5.3-77.el7.x86_64
libvirt-1.2.8-5.el7.x86_64

2) install a rhel7.1 guest, and install qemu-guest-agent-2.1.0-4.el7.x86_64.rpm inside.

3) define a libvirt guest(use seabios) with S3 S4 enabled
---
  <pm>
    <suspend-to-mem enabled='yes'/>
    <suspend-to-disk enabled='yes'/>
  </pm>

<channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/r6.agent'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
---

4) start libvirt vm
virsh start vm

5) suspend vm to ram and wake it up
virsh dompmsuspend vm --target mem
virsh dompmwakeup vm

6) save vm to disk and restore
virsh save vm /tmp/r6.save
virsh restore /tmp/r6.save 

7) re-test 5) and see whether VM hung ?
if VM suspend and wake up correctly here means bug fixed ?


and one more question is: is this required a patched libvirt, if do, which specific version ?
I am asking this because seeing this still in 'assigned' status:
Bug 890648 - guest agent commands will hang if the guest agent crashes while executing a command


Best Regards,
Xiaoqing Wei.

Comment 5 Laszlo Ersek 2014-11-04 21:18:02 UTC
Apologies, I forgot to capture the testing steps here.

There's no need to use dompmsuspend/wakeup or save/restore. We can check the qga communication directly. So:

  1. set up qga as usual

  2. configure libvirtd to log QEMU monitor and agent traffic;
     in "libvirtd.conf", set

     log_filters="1:qemu_monitor_ 1:qemu_agent"
     log_outputs="1:file:/var/log/libvirt/libvirtd.log"

  3. Inside the guest, start & stop the guest agent repeatedly,
     using systemctl.

     In lock-step with that, issue the following commands on the host:

     - virsh qemu-monitor-command DOMAIN --pretty \
           '{"execute":"query-chardev"}'

       The "frontend-open" element in the output will reflect the connection
       status of the guest agent.

     - In addition, grep the libvirtd log for the new event repeatedly:

       grep  VSERPORT_CHANGE /var/log/libvirt/libvirtd.log

       The "open" element in the output will reflect the connection status of
       the guest agent.

Comment 6 Xiaoqing Wei 2014-11-07 08:01:51 UTC
inside guest, stop the service:
# systemctl status qemu-guest-agent.service
qemu-guest-agent.service - QEMU Guest Agent
   Loaded: loaded (/usr/lib/systemd/system/qemu-guest-agent.service; static)
   Active: inactive (dead)

Nov 07 15:46:44 dhcp-66-106-155.nay.redhat.com systemd[1]: Starting QEMU Gues...
Nov 07 15:46:44 dhcp-66-106-155.nay.redhat.com systemd[1]: Started QEMU Guest...
Nov 07 15:46:50 dhcp-66-106-155.nay.redhat.com systemd[1]: Stopping QEMU Gues...
Nov 07 15:46:50 dhcp-66-106-155.nay.redhat.com systemd[1]: Stopped QEMU Guest...
Nov 07 15:49:18 dhcp-66-106-155.nay.redhat.com systemd[1]: Starting QEMU Gues...
Nov 07 15:49:18 dhcp-66-106-155.nay.redhat.com systemd[1]: Started QEMU Guest...
Nov 07 15:50:11 dhcp-66-106-155.nay.redhat.com systemd[1]: Stopping QEMU Gues...
Nov 07 15:50:11 dhcp-66-106-155.nay.redhat.com systemd[1]: Stopped QEMU Guest...
Hint: Some lines were ellipsized, use -l to show in full.


corresponding info retrieved from host:

2014-11-07 07:46:50.629+0000: 1116: debug : qemuMonitorJSONIOProcessLine:194 : QEMU_MONITOR_RECV_EVENT: mon=0x7f105400c1f0 event={"timestamp": {"seconds": 1415346410, "microseconds": 629448}, "event": "VSERPORT_CHANGE", "data": {"open": false, "id": "channel1"}}                                                     // reflected to qga status

[root@dhcp-11-50 ~]# virsh qemu-monitor-command rhel7.0 --pretty '{"execute":"query-chardev"}'
{
    "return": [
        {
            "frontend-open": true,
            "filename": "spicevmc",
            "label": "charredir3"
        },
        {
            "frontend-open": true,
            "filename": "spicevmc",
            "label": "charredir2"
        },
        {
            "frontend-open": true,
            "filename": "spicevmc",
            "label": "charredir1"
        },
        {
            "frontend-open": true,
            "filename": "spicevmc",
            "label": "charredir0"
        },
        {
            "frontend-open": false,                                                    // reflected to qga status
            "filename": "unix:/var/lib/libvirt/qemu/rhel7.0.agent,server",
            "label": "charchannel1"
        },
        {
            "frontend-open": false,
            "filename": "spicevmc",
            "label": "charchannel0"
        },
        {
            "frontend-open": true,
            "filename": "pty:/dev/pts/1",
            "label": "charserial0"
        },
        {
            "frontend-open": true,
            "filename": "unix:/var/lib/libvirt/qemu/rhel7.0.monitor,server",
            "label": "charmonitor"
        }
    ],
    "id": "libvirt-12"
}



==================================

starting service inside VM

# systemctl status qemu-guest-agent.service
qemu-guest-agent.service - QEMU Guest Agent
   Loaded: loaded (/usr/lib/systemd/system/qemu-guest-agent.service; static)
   Active: inactive (dead)

Nov 07 15:46:44 dhcp-66-106-155.nay.redhat.com systemd[1]: Starting QEMU Gues...
Nov 07 15:46:44 dhcp-66-106-155.nay.redhat.com systemd[1]: Started QEMU Guest...
Nov 07 15:46:50 dhcp-66-106-155.nay.redhat.com systemd[1]: Stopping QEMU Gues...
Nov 07 15:46:50 dhcp-66-106-155.nay.redhat.com systemd[1]: Stopped QEMU Guest...
Nov 07 15:49:18 dhcp-66-106-155.nay.redhat.com systemd[1]: Starting QEMU Gues...
Nov 07 15:49:18 dhcp-66-106-155.nay.redhat.com systemd[1]: Started QEMU Guest...
Nov 07 15:50:11 dhcp-66-106-155.nay.redhat.com systemd[1]: Stopping QEMU Gues...
Nov 07 15:50:11 dhcp-66-106-155.nay.redhat.com systemd[1]: Stopped QEMU Guest...
Hint: Some lines were ellipsized, use -l to show in full.
[root@dhcp-66-106-155 ~]# systemctl start qemu-guest-agent.service
[root@dhcp-66-106-155 ~]# systemctl status qemu-guest-agent.service
qemu-guest-agent.service - QEMU Guest Agent
   Loaded: loaded (/usr/lib/systemd/system/qemu-guest-agent.service; static)
   Active: active (running) since Fri 2014-11-07 15:52:13 CST; 1s ago
 Main PID: 2925 (qemu-ga)
   CGroup: /system.slice/qemu-guest-agent.service
           └─2925 /usr/bin/qemu-ga --method=virtio-serial --path=/dev/virtio-...

Nov 07 15:52:13 dhcp-66-106-155.nay.redhat.com systemd[1]: Starting QEMU Gues...
Nov 07 15:52:13 dhcp-66-106-155.nay.redhat.com systemd[1]: Started QEMU Guest...
Hint: Some lines were ellipsized, use -l to show in full.

from host, we see:

2014-11-07 07:52:13.676+0000: 1116: debug : qemuMonitorJSONIOProcessLine:194 : QEMU_MONITOR_RECV_EVENT: mon=0x7f105400c1f0 event={"timestamp": {"seconds": 1415346733, "microseconds": 676527}, "event": "VSERPORT_CHANGE", "data": {"open": true, "id": "channel1"}}                                                    // reflected to qga status

# virsh qemu-monitor-command rhel7.0 --pretty '{"execute":"query-chardev"}'
{
    "return": [
        {
            "frontend-open": true,
            "filename": "spicevmc",
            "label": "charredir3"
        },
        {
            "frontend-open": true,
            "filename": "spicevmc",
            "label": "charredir2"
        },
        {
            "frontend-open": true,
            "filename": "spicevmc",
            "label": "charredir1"
        },
        {
            "frontend-open": true,
            "filename": "spicevmc",
            "label": "charredir0"
        },
        {
            "frontend-open": true,                                                    // reflected to qga status
            "filename": "unix:/var/lib/libvirt/qemu/rhel7.0.agent,server",
            "label": "charchannel1"
        },
        {
            "frontend-open": false,
            "filename": "spicevmc",
            "label": "charchannel0"
        },
        {
            "frontend-open": true,
            "filename": "pty:/dev/pts/1",
            "label": "charserial0"
        },
        {
            "frontend-open": true,
            "filename": "unix:/var/lib/libvirt/qemu/rhel7.0.monitor,server",
            "label": "charmonitor"
        }
    ],
    "id": "libvirt-14"
}



Based on above, this bug has been fixed correctly.

qemu-guest-agent-2.1.0-4.el7.x86_64

qemu-kvm-rhev-2.1.2-6.el7.x86_64    &&   qemu-kvm-1.5.3-77.el7.x86_64
libvirt-daemon-kvm-1.2.8-5.el7.x86_64


# virsh dumpxml rhel7.0
<domain type='kvm'>
  <name>rhel7.0</name>
  <uuid>0b16ac05-c324-4485-8c91-6a429b5ebcfc</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>Opteron_G5</model>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/home/kvm_autotest_root/images/rhel70-64-virtio.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:3c:b6:61'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/rhel7.0.agent'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' autoport='yes'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' ram='65536' vram='65536' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </memballoon>
  </devices>
</domain>

Comment 8 errata-xmlrpc 2015-03-05 08:10:55 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/RHSA-2015-0349.html


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