Bug 789327

Summary: [RFE] Resume VM from s3 as a response for monitor/keyboard/mouse action
Product: Red Hat Enterprise Linux 6 Reporter: Gerd Hoffmann <kraxel>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2CC: acathrow, ajia, areis, bsarathy, dallan, dyuan, juzhang, michen, mkenneth, mzhan, rhod, rwu, tburke, veillard, virt-maint, vrozenfe, whuang, yupzhang, zhwang, zpeng
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.0-0rc0.el6 Doc Type: Enhancement
Doc Text:
Feature: libvirt supported three new QMP events: SUSPEND, WAKEUP, and DEVICE_TRAY_MOVED. And introduced a new attribute "tray" for disk target, to indicate the tray status for CD-ROM, or Floppy device. Reason: The QEMU guest could be suspended or resumed inside the guest directly (not via libvirt API), so the QMP events "SUSPEND", and "WAKEUP" are introduced by QEMU to let management application known the guest status has been changed. The QMP event "DEVICE_TRAY_MOVED" is to let management application known the tray status has been changed for CD-ROM or Floppy device, otherwise the management application could start the guest with the medium still inserted while the medium has been ejected inside guest previously. Result (if any): New domain status "pmsuspended" is introduced for SUSPEND event, the domain status will be changed to "pmsuspended" when the QEMU "SUSPEND" event is emitted, and to "running" when the QEMU "WAKEUP" event is emitted. When the QEMU event DEVICE_TRAY_MOVED is emitted for a disk device, the current tray status for the disk will be reflected to libvirt XML. And libvirt won't start the guest with the medium inserted if the 'tray' is 'open' on the next boot.
Story Points: ---
Clone Of: 766303 Environment:
Last Closed: 2013-02-21 07:07:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 766303    
Bug Blocks: 761491, 767473    

Comment 1 Gerd Hoffmann 2012-02-10 12:51:02 UTC
qemu patches are discussed & reviewed upstream at the moment.

Plan is to send out qmp events on suspend and wakeup and also add a system_wakeup monitor command which can be used to kick the guest out of s3 state.  libvirt needs to handle those for proper s3 support.

Comment 2 Gerd Hoffmann 2012-02-10 12:53:15 UTC
submitted qemu patches:
monitor command: http://patchwork.ozlabs.org/patch/140404/
qmp events: http://patchwork.ozlabs.org/patch/140598/

Comment 9 Osier Yang 2012-03-14 14:40:34 UTC
v2 posted to upstream.

http://www.redhat.com/archives/libvir-list/2012-March/msg00616.html

Comment 12 Osier Yang 2012-05-28 08:45:50 UTC
Per comment 11, move to POST.

Comment 14 Daniel Veillard 2012-08-02 08:39:19 UTC
The upstream pathches were commited march 23, 11 patches set
a26a1969c37c865b18294c5717544c1dc90beb3c
Add support for event tray moved of removable disks
etc...
Daniel

Comment 16 zhe peng 2012-08-06 09:19:39 UTC
verify with:
libvirt-0.10.0-0rc0.el6.x86_64
qemu-kvm-0.12.1.2-2.295.el6.x86_64
seabios-0.6.1.2-19.el6.x86_64

step:
  1:prepare a guest with xml
  ......
    <os>
    <type arch='x86_64' machine='rhel6.3.0'>hvm</type>
    <loader>/usr/share/seabios/bios-pm.bin</loader>
    <boot dev='hd'/>
  </os>
  ......
  2: start the guest ,
    in guest run
  #pm-suspent or #echo mem > /sys/power/state
   the guest suspent successful
 #virsh list --all
  Id    Name                           State
----------------------------------------------------
 15    tests3                         pmsuspended

  3:wake up the guest 
   1)use clicking keyboard , the guest wakeup w/o error
   2)use clicking ps/2 mouse ,the guest wakeup w/o error
   3)use monitor command, run in host:
     # virsh qemu-monitor-command tests3 '{"execute":"system_wakeup"}'
   {"return":{},"id":"libvirt-43"}
   the guest can wakeup w/o error.
  4: use virsh command to into s3
    install vdagent in guest os.
   add qemu-ga support in guest xml:
   <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/tests3.agent'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
  in guest run #qemu-ga -d
  in host run:
  #virsh dompmsuspend $guest_name --target mem
  Domain tests3 successfully suspended
  #virsh domstate $guest_name
  pmsuspended

   wakeup guest:
  #virsh dompmwakeup $guest_name
  Domain tests3 successfully woken up
  

verification passed.

Comment 17 zhenfeng wang 2012-12-25 09:04:06 UTC
Now, in pkg qemu-guest-agent-win32-0.12.1.2-2.346.el6.x86_64.rpm  we can do the testing 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 , besides,qemu agen didn't support  "guest-suspend-mem" yet,so we can't test it untile the bug fixed and qemu agent support it

Comment 18 errata-xmlrpc 2013-02-21 07:07:50 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-2013-0276.html