Bug 1029726

Summary: Report error on screenshot stream close
Product: Red Hat Enterprise Linux 7 Reporter: weizhang <weizhan>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, dyuan, mzhan, weizhan, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-05 14:49:20 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:
Attachments:
Description Flags
libvirtd.log in level 1 none

Description weizhang 2013-11-13 02:28:43 UTC
Created attachment 823237 [details]
libvirtd.log in level 1

Description of problem:
When I test it on perl-Sys-Virt with script
#!/usr/bin/perl
use warnings;
use strict;
use Sys::Virt;

my $uri = "qemu:///system";
my $domname = "test";
my $con = Sys::Virt->new(address => $uri, readonly => 0);
my $dom = $con->get_domain_by_name($domname);
my $st = $con->new_stream();
$dom->screenshot($st, 0);
$st->finish();

It will report error
2013-11-07 09:38:45.373+0000: 907: error : virFDStreamCloseInt:315 : internal error: I/O helper exited abnormally
2013-11-07 09:38:45.374+0000: 907: error : virFDStreamUpdateCallback:133 : internal error: stream is not open


Version-Release number of selected component (if applicable):
perl-Sys-Virt-1.1.1-2.el7.x86_64
kernel-3.10.0-26.el7.x86_64
qemu-kvm-rhev-1.5.3-16.el7.x86_64
libvirt-1.1.1-12.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1. start a guest with name test
2. perl test.pl (content of test.pl show in description)
3.

Actual results:
report error
2013-11-07 09:38:45.373+0000: 907: error : virFDStreamCloseInt:315 : internal error: I/O helper exited abnormally
2013-11-07 09:38:45.374+0000: 907: error : virFDStreamUpdateCallback:133 : internal error: stream is not open

Expected results:
No error

Additional info:

Comment 2 Daniel Berrangé 2013-12-02 13:55:06 UTC
These log messages are in libvirtd, so not a perl client bug.

Comment 3 Michal Privoznik 2013-12-05 14:49:20 UTC
This is not a bug.

First of all: you didn't specify where the stream data should go. Then: you need either to recv all data or abort the stream prior calling finish. So in fact your script needs to look like this:

#!/usr/bin/perl
use warnings;
use strict;
use Sys::Virt;

my $f = shift @ARGV;
my $uri = "qemu:///system";
my $domname = "gentoo";
my $con = Sys::Virt->new(address => $uri, readonly => 0);
my $dom = $con->get_domain_by_name($domname);
my $st = $con->new_stream();

open FILE, ">$f" or die "cannot create $f: $!";

sub foo {
	my $st = shift;
	my $data = shift;
	my $nbytes = shift;
	return syswrite FILE, $data, $nbytes;
};

$dom->screenshot($st, 0);
$st->recv_all(\&foo);
$st->finish();