Bug 705070

Summary: QMP: screendump command does not allow specification of monitor to capture
Product: Red Hat Enterprise Linux 6 Reporter: Daniel Berrangé <berrange>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1CC: dallan, dyuan, gcosta, juzhang, mkenneth, mprivozn, mzhan, qzhang, rwu, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.180.el6 Doc Type: Bug Fix
Doc Text:
Cause It is (was) impossible to make sccreenshots from secondary qxl displays. Change A monitor command was added to fill the gap.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 15:41:29 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:
Bug Depends On:    
Bug Blocks: 559201, 691830, 710489    

Description Daniel Berrangé 2011-05-16 14:52:21 UTC
Description of problem:

The screendump command allows capturing the current state of the primary monitor. With the introduction of SPICE with QXL display adapter, it is possible to have multiple monitors. The 'screendump' command needs an extra parameter to specify which device to capture.


Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.161.el6

How reproducible:
Always

Steps to Reproduce:
1. Run a guest with

 -vga qxl -global qxl-vga.vram_size=33554432 -device qxl,id=video1,vram_size=67108864,bus=pci.0,addr=0x4

2. Try to capture a screendump of the 'video1' card, instead of the default card
3.
  
Actual results:


Expected results:


Additional info:

Comment 4 Gerd Hoffmann 2011-05-31 14:35:02 UTC
This isn't just the monitor command.  Currently qemu doesn't handle multiple displays at all, thats why a number of things work for the first qxl device only (vga compatibility, screendumpable, viewable via vnc, ...).

Fixing this involves a bunch of non-trivial and likely intrusive upstream work, I doubt we'll ever see this in RHEL-6.

We can make this a RHEL-7 RFE ...
Alternatively RHEL-6.x with upstream cond-nack, but it's not realistic IMHO.

An alternative approach to do screen shots would be to connect using the spice protocol and write out a screen dump.  A little proof-of-concept tool exists (called snappy, comes with spice-gtk).  Drawback is that the spice server (currrently) supports only one client at a time, so this would disturb any users currently connected to the VM via spice as they would be disconnected.

Comment 5 Daniel Berrangé 2011-05-31 15:50:47 UTC
Hmm, I can see why getting the right, upstreamable, solution may not be practical for RHEL6 due to QEMU console/display architecture. QXL though, is the only video device type in RHEL6 that can do multiple instances, so can't we do something that just bypasses vga_hw_screen_dump infrastructure.

eg, extend 'screendump' to take a device ID, fetch that device from the qdev tree, validate that it is a QXL device, and then just directly call into qxl_hw_screen_dump. Alternatively add a __com.redhat__screendump instead of changing the existing 'screendump' command.

Comment 6 Gerd Hoffmann 2011-06-01 08:13:22 UTC
Naa, it isn't *that* simple, qxl_hw_screen_dump() will not work on secondary displays as-is.  It should be doable though.

__com.redhat__qxl_screendump <pciaddress> <filename>

Does that look sane?

Comment 7 Daniel Berrangé 2011-06-01 08:27:34 UTC
I'd prefer it if the command took a qdev ID, rather than pciaddress, just because that's what most QEMU monitor commands use to identify devices. So given a command line:

  # qemu-kvm \
      -vga qxl -global qxl-vga.vram_size=33554432 \
      -device qxl,id=video1,vram_size=67108864,bus=pci.0,addr=0x4 \ 
      -device qxl,id=video2,vram_size=67108864,bus=pci.0,addr=0x5


in libvirt I'd carry on using 'screendump' for card 0 no matter what, but for additional heads use the custom command, with the qdev ID of the device. eg

 (qemu) screendump card0.pnm
 (qemu) __com.redhat__qxl_screendump video1 card1.pnm
 (qemu) __com.redhat__qxl_screendump video2 card2.pnm

Comment 8 Gerd Hoffmann 2011-06-07 15:58:34 UTC
scratch build for testing
https://brewweb.devel.redhat.com/taskinfo?taskID=3373785

Comment 9 Dave Allan 2011-06-10 16:11:45 UTC
*** Bug 701287 has been marked as a duplicate of this bug. ***

Comment 11 juzhang 2011-06-14 08:33:30 UTC
(In reply to comment #8)
> scratch build for testing
> https://brewweb.devel.redhat.com/taskinfo?taskID=3373785
Seems this build is closed now.

Tried with qemu-kvm-0.12.1.2-2.163.el6.x86_64, didn't find __com.redhat__qxl_screendump command. mark qa_ack+

when we verify this bug,we will according to comment6 & patch

Comment 13 Gerd Hoffmann 2011-06-15 12:17:15 UTC
most recent scratch build
https://brewweb.devel.redhat.com/taskinfo?taskID=3395786

Comment 21 Qunfang Zhang 2011-08-17 08:52:36 UTC
Verified this issue on qemu-kvm-0.12.1.2-2.183.el6, passed.

Steps:
1.Boot a windows guest with multiple monitor.
 /usr/libexec/qemu-kvm -m 2G -smp 4 -cpu cpu64-rhel6,+x2apic -drive
file=/home/win7-64-virtio.qcow2,if=none,id=drive-ide0-0-0,werror=stop,rerror=stop,cache=none
-device ide-drive,drive=drive-ide0-0-0,id=ide0-0-0 -netdev
tap,id=hostnet0,script=/etc/qemu-ifup -device
rtl8139,netdev=hostnet0,mac=00:10:1a:3b:20:1f,bus=pci.0,addr=0x4 -boot dc -uuid
6d59434d-3f1c-4558-afc3-37e2cc430d6b -rtc-td-hack -no-kvm-pit-reinjection
-monitor stdio -name rhel6.1-32 -spice port=5930,disable-ticketing -vga qxl
-usb -k en-us -global qxl-vga.vram_size=33554432 -device
qxl,id=video1,vram_size=67108864,bus=pci.0,addr=0x5 -device
qxl,id=video1,vram_size=67108864,bus=pci.0,addr=0x6 -device
virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x7 -chardev
socket,id=channel0,host=127.0.0.1,port=12345,server,nowait -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=channel0,id=channel0,name=com.redhat.rhevm.vdsm
-chardev spicevmc,id=charchannel1,name=vdagent -device
virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=com.redhat.spice.0

2. Install qxl driver, virtio-serial driver, vdagent-win inside guest.

3. Right click on the desktop and bring up the display properties.
 - It should show 3 monitors now, and let you activate the display on the
second/third monitor.

4. Activate the second and third display by select the drop-down menu "extend desktop to this display".

5. Create some files/pictures and pull the files to the second/third display as well. Or open some windows and pull them to the second/third displays. That is to make sure the 3 monitors displays different content.

6. Capture the monitor with "screendump" and "__com.redhat_qxl_screendump" command.
 (qemu) screendump card0.pnm
 (qemu) __com.redhat__qxl_screendump video1 card1.pnm
 (qemu) __com.redhat__qxl_screendump video2 card2.pnm

7.Check the if the card*pnm pictures matches the 3 displays.

Result: The "screendump" and "__com.redhat_qxl_screendump" commands can capture multiple monitor screen.

So, this issue is fixed.

Comment 23 Qunfang Zhang 2011-08-18 08:00:47 UTC
Based on Comment 21,
Also test with the qmp command:

{"execute":"human-monitor-command","arguments":{"command-line","screendump card0_a.pnm"}}
{"error": {"class": "JSONParsing", "desc": "Invalid JSON syntax", "data": {}}}
}

{"execute":"__com.redhat_qxl_screendump","arguments":{"id":"video1","filename":"card1_a.pnm"}}
{"return": {}}


{"execute":"__com.redhat_qxl_screendump","arguments":{"id":"video2","filename":"card2_a.pnm"}}
{"return": {}}

The different monitors are captured correctly.

"screendump" command will be available in QMP soon according to bug 729969.

Comment 24 Gerd Hoffmann 2011-11-18 16:20:45 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    It is (was) impossible to make sccreenshots from secondary qxl displays.
Change
    A monitor command was added to fill the gap.

Comment 25 errata-xmlrpc 2011-12-06 15:41:29 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-2011-1531.html