Bug 1875195

Summary: Failed to take screenshot for guest
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: yafu <yafu>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: yafu <yafu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: chhu, dyuan, jdenemar, jtomko, lcheng, lmen, virt-maint, xuzhang
Target Milestone: rcKeywords: Regression
Target Release: 8.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-6.6.0-5.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-17 17:51:44 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:

Description yafu 2020-09-03 01:50:42 UTC
Description of problem:
Failed to take screenshot for guest

Version-Release number of selected component (if applicable):
libvirt-daemon-6.6.0-4.module+el8.3.0+7883+3d717aa8.x86_64
qemu-kvm-5.1.0-4.module+el8.3.0+7846+ae9b566f.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Edit guest with qxl video and vnc graphical device:
#virsh edit vm1
...
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
<video>
...
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
...

2.Start guest:
#virsh start vm1

3.Connect guest with remote-viewer:
# remote-viewer vnc://*.*.*.com:5902

4.Take screenshot for guest:
## virsh screenshot vm1 --file /tmp/screen.ppm 
error: could not receive data from domain vm1
error: recv handler failed: Bad file descriptor

Actual results:
Failed to take screenshot for guest

Expected results:
Should take screenshot for guest successfully.

Additional info:
1.It works well with libvirt-6.0.0-28.module+el8.3.0+7827+5e65edd7.x86_64:
# virsh screenshot vm1 /tmp/screen0
Screenshot saved to /tmp/screen0, with type of image/x-portable-pixmap

Comment 1 Ján Tomko 2020-09-09 09:01:28 UTC
git bisect points to:
commit 9e745a97171e10f050962c166082439d6724e245
    virsh: Pass virshStreamCallbackDataPtr to virshStreamSink() and virshStreamSkip()

git describe: v6.6.0-565-g9e745a9717 contains: v6.7.0-rc1~73

Comment 2 Ján Tomko 2020-09-09 09:06:59 UTC
Upstream patch:
https://www.redhat.com/archives/libvir-list/2020-September/msg00487.html

Comment 3 Ján Tomko 2020-09-09 12:39:14 UTC
Fixed upstream by:
commit 3144e881b137123b0326157ce6dc23ca649c9270
Author:     Ján Tomko <jtomko>
CommitDate: 2020-09-09 14:37:19 +0200

    virsh: cmdScreenshot: fix cbdata passing to virshStreamSink
    
    The changes for sparse stream support started passing
    virshStreamCallbackDataPtr to virshStreamSink
    instead of passing a simple file descriptor, but
    forgot to adjust all the callers.
    
    Fix it in cmdScreenshot as well.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1875195
    
    Signed-off-by: Ján Tomko <jtomko>
    Fixes: 9e745a97171e10f050962c166082439d6724e245
    Reviewed-by: Martin Kletzander <mkletzan>

git describe: v6.7.0-111-g3144e881b1

Comment 7 yafu 2020-09-23 07:30:55 UTC
Verified with libvirt-6.6.0-6.module+el8.3.0+8125+aefcf088.x86_64.

Test steps:
1.Edit guest with qxl video and vnc graphical device:
#virsh edit vm1
...
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
<video>
...
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
...

2.Start guest:
#virsh start vm1

3.Connect guest with remote-viewer:
# remote-viewer vnc://*.*.*.com:5902

4.Take screenshot for guest:
#virsh screenshot vm1 --file /tmp/screen.ppm 
Screenshot saved to /tmp/screen.ppm, with type of image/x-portable-pixmap

5.Also test screenshot for 2 videos, it also works well.

Comment 10 errata-xmlrpc 2020-11-17 17:51:44 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 (virt:8.3 bug fix and enhancement update), 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://access.redhat.com/errata/RHBA-2020:5137