Bug 691830 - RFE: Add console screenshot support
Summary: RFE: Add console screenshot support
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 705070 710489 729969 741337
Blocks: 693512 701287
TreeView+ depends on / blocked
 
Reported: 2011-03-29 15:11 UTC by Andrew Cathrow
Modified: 2014-09-07 22:54 UTC (History)
13 users (show)

Fixed In Version: libvirt-0.9.4-14.el6
Doc Type: Enhancement
Doc Text:
Cause: Users often want to do a screenshot of running VM Consequence: Other tools (like virt-manager) needed to be used Change: New Libvirt API was created (virDomainScreenshot) which allows to take screenshots on those hypervisors supporting it (virtualbox, qemu) Result: Users can use libvirt directly (e.g. virsh screenshot) instead of workarounds
Clone Of:
: 701287 (view as bug list)
Environment:
Last Closed: 2011-12-06 11:03:40 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-06 01:23:30 UTC

Description Andrew Cathrow 2011-03-29 15:11:36 UTC
RFE: Add support to libvirt API (and virsh) for taking a screenshot of current guest console.

Use case : Allow management application to take screenshot of VM to use as a preview for various management actions.

Exporting the screenshot in the currently supported qemu PPM format would be acceptable

Comment 1 Dave Allan 2011-04-01 14:20:34 UTC
Patches are being worked on upstream.

Comment 2 Michal Privoznik 2011-04-14 13:11:46 UTC
Patches currently waits for review:

https://www.redhat.com/archives/libvir-list/2011-April/msg00275.html

Comment 3 Michal Privoznik 2011-05-14 14:55:26 UTC
Pushed upstream:

commit 6a1fcd9f209005954628c158314b071fcf2ba84a
Author: Michal Privoznik <mprivozn@redhat.com>
Date:   Mon Apr 4 11:58:53 2011 +0200

    screenshot: Defining the public API
    
    Add public API for taking screenshots of current domain console.
    
    * include/libvirt/libvirt.h.in: add virDomainScreenshot
    * src/libvirt_public.syms: Export new symbol


v0.9.1-95-g6a1fcd9

But virsh currently miss the screenshot command. I work on it.

Comment 4 Andrew Cathrow 2011-05-14 22:02:26 UTC
Note for QE - please ensure you test with VNC and Spice. For spice remember that it supports multiple displays.

Comment 8 Michal Privoznik 2011-06-02 13:05:51 UTC
New virsh command:

commit 3ef7350c4206887983af88d97d66931b14bf0412
Author: Michal Privoznik <mprivozn@redhat.com>
Date:   Thu May 12 18:29:12 2011 +0200

    screenshot: Expose the new API in virsh
    
    * tools/virsh.c: Add screenshot command
    * tools/virsh.pod: Document new command
    * src/libvirt.c: Fix off-be-one error

v0.9.1-353-g3ef7350

Comment 9 Michal Privoznik 2011-06-03 14:32:48 UTC
Moving this to POST.
However, to track possibility of taking screenshots of secondary monitors in QEMU, I've created Bug 710489.

Comment 11 zhe peng 2011-06-22 06:24:09 UTC
can't verify now, waiting for bug:705070 modified.

Comment 12 weizhang 2011-06-28 09:11:18 UTC
I test on fedora15 with 
libvirt-0.9.2-2.fc16.x86_64
qemu-kvm-0.14.0-9.fc16.x86_64

I found that after running
# virsh screenshot domain /tmp/screen.ppm
the file /tmp/screen.ppm can be generated, but with 0 size.

I debug libvirtd with gdb and find that when generate temp file
/var/cache/libvirt/qemu/qemu.screendump.xxxxxx 
the attribute of file is
-rw-------. 1 root root 0 Jun 28 14:35 /var/cache/libvirt/qemu/qemu.screendump.a3yOoa
which means that qemu has no privilege to access this file. So we also need to change either permissions or owner of this file for this bug.

It still has bug, so change the status to assign

Comment 13 Michal Privoznik 2011-07-08 08:29:49 UTC
Sorry for the delay. It is upstream for a while but I've forgotten to update BZ.

commit c72aecc5fcac98d61f8a94ff2ae1f40a149a5c4a
Author: Michal Privoznik <mprivozn@redhat.com>
Date:   Wed Jun 29 10:17:51 2011 +0200

    screenshot: Set access rights to temporary file
    
    Although we create a temporary file, it is owned by root:root and have
    rights 0600. In case qemu does not run under root, it is unable to write
    to that file and thus we transfer 0B sized file.

v0.9.3-rc1-39-gc72aecc

Comment 16 dyuan 2011-08-09 06:10:49 UTC
As bug 705070 was set to MODEFIED status with qemu-kvm-0.12.1.2-2.177.el6, tested with libvirt-0.9.4-1.el6 and qemu-kvm-0.12.1.2-2.177.el6, get the same error as comment 10.

According to comment 4 and comment 9, add the bug 710489 in the "Depends on".

Comment 17 Vivian Bian 2011-09-21 11:18:25 UTC
Will try to verify this bug after bug 729969 get VERIFIED .

Comment 18 Daniel Berrangé 2011-09-26 14:40:29 UTC
There is a bug in the RPC code which also prevents the screenshot command from being used in virsh. The upstream patch is

https://www.redhat.com/archives/libvir-list/2011-September/msg00840.html

Comment 19 Daniel Veillard 2011-10-03 13:56:01 UTC
Note that the above patch is now in libvirt-0.9.4-14.el6, please use this
for further QA on this bug,

   thank,

Daniel

Comment 20 yanbing du 2011-10-18 08:12:10 UTC
Bug verified.

rpm packages version:
libvirt-0.9.4-18.el6.x86_64
qemu-kvm-0.12.1.2-2.197.el6.x86_64
kernel-2.6.32-210.el6.x86_64

Comment 21 Michal Privoznik 2011-11-11 12:44:23 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: Users often want to do a screenshot of running VM

Consequence: Other tools (like virt-manager) needed to be used

Change: New Libvirt API was created (virDomainScreenshot) which allows to take screenshots on those hypervisors supporting it (virtualbox, qemu)

Result: Users can use libvirt directly (e.g. virsh screenshot) instead of workarounds

Comment 22 errata-xmlrpc 2011-12-06 11:03:40 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/RHBA-2011-1513.html


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