Hello community, here is the log from the commit of package perl-Sys-Virt for openSUSE:Factory checked in at 2017-06-21 13:53:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Sys-Virt (Old) and /work/SRC/openSUSE:Factory/.perl-Sys-Virt.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Sys-Virt" Wed Jun 21 13:53:45 2017 rev:54 rq:503234 version:3.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Sys-Virt/perl-Sys-Virt.changes 2017-05-09 18:09:56.539302213 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Sys-Virt.new/perl-Sys-Virt.changes 2017-06-21 13:53:47.124199001 +0200 @@ -1,0 +2,6 @@ +Mon Jun 5 16:12:46 UTC 2017 - [email protected] + +- Update to 3.4.0 + - Add all new APIs and constants in libvirt 3.4.0 + +------------------------------------------------------------------- Old: ---- Sys-Virt-3.3.0.tar.gz New: ---- Sys-Virt-3.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Sys-Virt.spec ++++++ --- /var/tmp/diff_new_pack.socT32/_old 2017-06-21 13:53:48.971938359 +0200 +++ /var/tmp/diff_new_pack.socT32/_new 2017-06-21 13:53:48.971938359 +0200 @@ -17,7 +17,7 @@ Name: perl-Sys-Virt -Version: 3.3.0 +Version: 3.4.0 Release: 0 %define cpan_name Sys-Virt Summary: Represent and manage a libvirt hypervisor connection ++++++ Sys-Virt-3.3.0.tar.gz -> Sys-Virt-3.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/Changes new/Sys-Virt-3.4.0/Changes --- old/Sys-Virt-3.3.0/Changes 2017-05-08 12:23:32.000000000 +0200 +++ new/Sys-Virt-3.4.0/Changes 2017-06-05 13:05:52.000000000 +0200 @@ -1,5 +1,20 @@ Revision history for perl module Sys::Virt +3.4.0 2017-06-05 + + - Add LIST_CAP_MDEV & LIST_CAP_MDEV_TYPES constants + - Fix send_all() callback helper + - Introduce flags to Stream::recv() and + register RECV_STOP_AT_HOLE constant + - Introduce Stream::recv_hole() and Stream::send_hole() + - Introduce Stream::sparse_recv_all() + - Introduce Stream::sparse_send_all() + - Register VOL_DOWNLOAD_SPARSE_STREAM & + VOL_UPLOAD_SPARSE_STREAM constants + - Add vol-sparse.pl example + - Add new domain event constants + - Add new LIST_CAP_CCW_DEV constant + 3.3.0 2017-05-08 - Add VIR_DOMAIN_JOB_OPERATION* constants diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/MANIFEST new/Sys-Virt-3.4.0/MANIFEST --- old/Sys-Virt-3.3.0/MANIFEST 2017-05-08 12:25:34.000000000 +0200 +++ new/Sys-Virt-3.4.0/MANIFEST 2017-06-05 13:07:21.000000000 +0200 @@ -26,6 +26,7 @@ examples/vol-download-all.pl examples/vol-download-nonblock.pl examples/vol-download.pl +examples/vol-sparse.pl examples/vol-upload-all.pl examples/vol-upload-nonblock.pl examples/vol-upload.pl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/META.yml new/Sys-Virt-3.4.0/META.yml --- old/Sys-Virt-3.3.0/META.yml 2017-05-08 12:25:34.000000000 +0200 +++ new/Sys-Virt-3.4.0/META.yml 2017-06-05 13:07:21.000000000 +0200 @@ -1,7 +1,7 @@ --- #YAML:1.0 name: Sys-Virt abstract: Extension for the libvirt library -version: 3.3.0 +version: 3.4.0 author: - Daniel P. Berrange <[email protected]> license: perl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/MYMETA.json new/Sys-Virt-3.4.0/MYMETA.json --- old/Sys-Virt-3.3.0/MYMETA.json 2017-05-08 12:25:26.000000000 +0200 +++ new/Sys-Virt-3.4.0/MYMETA.json 2017-06-05 13:07:13.000000000 +0200 @@ -42,6 +42,6 @@ } }, "release_status" : "stable", - "version" : "v3.3.0", + "version" : "v3.4.0", "x_serialization_backend" : "JSON::PP version 2.27400" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/MYMETA.yml new/Sys-Virt-3.4.0/MYMETA.yml --- old/Sys-Virt-3.3.0/MYMETA.yml 2017-05-08 12:25:26.000000000 +0200 +++ new/Sys-Virt-3.4.0/MYMETA.yml 2017-06-05 13:07:13.000000000 +0200 @@ -24,5 +24,5 @@ Test::Pod::Coverage: '0' Time::HiRes: '0' XML::XPath: '0' -version: v3.3.0 +version: v3.4.0 x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/Makefile.PL new/Sys-Virt-3.4.0/Makefile.PL --- old/Sys-Virt-3.3.0/Makefile.PL 2017-04-03 15:51:08.000000000 +0200 +++ new/Sys-Virt-3.4.0/Makefile.PL 2017-05-08 18:05:00.000000000 +0200 @@ -3,7 +3,7 @@ # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. -my $libvirtver = "3.3.0"; +my $libvirtver = "3.4.0"; my $stat = system "pkg-config --atleast-version=$libvirtver libvirt"; die "cannot run pkg-config to check libvirt version" if $stat == -1; die "libvirt >= $libvirtver is required\n" unless $stat == 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/README new/Sys-Virt-3.4.0/README --- old/Sys-Virt-3.3.0/README 2017-04-03 15:50:44.000000000 +0200 +++ new/Sys-Virt-3.4.0/README 2017-05-08 18:04:56.000000000 +0200 @@ -7,6 +7,6 @@ The only pre-requisite for this module is libvirt itself. For installation instructions, consult the INSTALL file. -The current minimum required version of libvirt is 3.3.0 +The current minimum required version of libvirt is 3.4.0 -- End diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/Virt.xs new/Sys-Virt-3.4.0/Virt.xs --- old/Sys-Virt-3.3.0/Virt.xs 2017-04-28 13:10:06.000000000 +0200 +++ new/Sys-Virt-3.4.0/Virt.xs 2017-05-30 13:16:56.000000000 +0200 @@ -1948,7 +1948,7 @@ const char *newdata = SvPV_nolen(datasv); if (ret > nbytes) ret = nbytes; - strncpy(data, newdata, nbytes); + memcpy(data, newdata, nbytes); } FREETMPS; @@ -1961,6 +1961,100 @@ static int +_stream_sparse_send_all_hole_handler(virStreamPtr st, + int *inData, + long long *length, + void *opaque) +{ + AV *av = opaque; + SV **self; + SV **hole_handler; + SV *inDataSV; + SV *lengthSV; + int count; + int ret; + dSP; + + self = av_fetch(av, 0, 0); + hole_handler = av_fetch(av, 2, 0); + + SvREFCNT_inc(*self); + + ENTER; + SAVETMPS; + + PUSHMARK(SP); + XPUSHs(*self); + PUTBACK; + + count = call_sv((SV*)*hole_handler, G_ARRAY); + + SPAGAIN; + + if (count == 2) { + /* @hole_handler returns (in_data, length), but on a stack. + * Therefore the order is reversed. */ + lengthSV = POPs; + inDataSV = POPs; + *inData = virt_SvIVll(inDataSV); + *length = virt_SvIVll(lengthSV); + ret = 0; + } else { + ret = -1; + } + + PUTBACK; + FREETMPS; + LEAVE; + + return ret; +} + + +static int +_stream_sparse_send_all_skip_handler(virStreamPtr st, + long long length, + void *opaque) +{ + AV *av = opaque; + SV **self; + SV **skip_handler; + int rv; + int ret; + dSP; + + self = av_fetch(av, 0, 0); + skip_handler = av_fetch(av, 3, 0); + + SvREFCNT_inc(*self); + + ENTER; + SAVETMPS; + + PUSHMARK(SP); + XPUSHs(*self); + XPUSHs(sv_2mortal(virt_newSVll(length))); + PUTBACK; + + rv = call_sv((SV*)*skip_handler, G_SCALAR); + + SPAGAIN; + + if (rv == 1) { + ret = POPi; + } else { + ret = -1; + } + + PUTBACK; + FREETMPS; + LEAVE; + + return ret; +} + + +static int _stream_recv_all_sink(virStreamPtr st, const char *data, size_t nbytes, @@ -2008,6 +2102,48 @@ } +static int +_stream_sparse_recv_hole_handler(virStreamPtr st, + long long offset, + void *opaque) +{ + AV *av = opaque; + SV **self; + SV **hole_handler; + int rv; + int ret; + dSP; + + self = av_fetch(av, 0, 0); + hole_handler = av_fetch(av, 2, 0); + + SvREFCNT_inc(*self); + + ENTER; + SAVETMPS; + + PUSHMARK(SP); + XPUSHs(*self); + XPUSHs(sv_2mortal(virt_newSVll(offset))); + PUTBACK; + + rv = call_sv((SV*)*hole_handler, G_SCALAR); + + SPAGAIN; + + if (rv == 1) { + ret = POPi; + } else { + ret = -1; + } + + FREETMPS; + LEAVE; + + return ret; +} + + MODULE = Sys::Virt PACKAGE = Sys::Virt PROTOTYPES: ENABLE @@ -7874,16 +8010,21 @@ int -recv(st, data, nbytes) +recv(st, data, nbytes, flags=0) virStreamPtr st; SV *data; size_t nbytes; + unsigned int flags; PREINIT: char *rawdata; CODE: Newx(rawdata, nbytes, char); - if ((RETVAL = virStreamRecv(st, rawdata, nbytes)) < 0 && - RETVAL != -2) { + if (flags) + RETVAL = virStreamRecvFlags(st, rawdata, nbytes, flags); + else + RETVAL = virStreamRecv(st, rawdata, nbytes); + + if (RETVAL != -2 && RETVAL != -3) { Safefree(rawdata); _croak_error(); } @@ -7895,6 +8036,34 @@ RETVAL +SV * +recv_hole(st, flags=0) + virStreamPtr st; + unsigned int flags; + PREINIT: + long long length; + CODE: + if (virStreamRecvHole(st, &length, flags) < 0) + _croak_error(); + + RETVAL = virt_newSVll(length); + OUTPUT: + RETVAL + + +void +send_hole(st, lengthSV, flags=0) + virStreamPtr st; + SV *lengthSV; + unsigned int flags; + PREINIT: + long long length; + PPCODE: + length = virt_SvIVll(lengthSV); + if (virStreamSendHole(st, length, flags) < 0) + _croak_error(); + + void send_all(stref, handler) SV *stref; @@ -7940,6 +8109,64 @@ void +sparse_recv_all(stref, handler, hole_handler) + SV *stref; + SV *handler; + SV *hole_handler; + PREINIT: + AV *opaque; + virStreamPtr st; + CODE: + st = (virStreamPtr)SvIV((SV*)SvRV(stref)); + + opaque = newAV(); + SvREFCNT_inc(stref); + SvREFCNT_inc(handler); + SvREFCNT_inc(hole_handler); + av_push(opaque, stref); + av_push(opaque, handler); + av_push(opaque, hole_handler); + + if (virStreamSparseRecvAll(st, + _stream_recv_all_sink, + _stream_sparse_recv_hole_handler, + opaque) < 0) + _croak_error(); + + SvREFCNT_dec(opaque); + +void +sparse_send_all(stref, handler, hole_handler, skip_handler) + SV *stref; + SV *handler; + SV *hole_handler; + SV *skip_handler; + PREINIT: + AV *opaque; + virStreamPtr st; + CODE: + st = (virStreamPtr)SvIV((SV*)SvRV(stref)); + + opaque = newAV(); + SvREFCNT_inc(stref); + SvREFCNT_inc(handler); + SvREFCNT_inc(hole_handler); + SvREFCNT_inc(skip_handler); + av_push(opaque, stref); + av_push(opaque, handler); + av_push(opaque, hole_handler); + av_push(opaque, skip_handler); + + if (virStreamSparseSendAll(st, + _stream_send_all_source, + _stream_sparse_send_all_hole_handler, + _stream_sparse_send_all_skip_handler, + opaque) < 0) + _croak_error(); + + SvREFCNT_dec(opaque); + +void add_callback(stref, events, cb) SV* stref; int events; @@ -8334,6 +8561,8 @@ REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT, EVENT_STOPPED_FROM_SNAPSHOT); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED, EVENT_SHUTDOWN_FINISHED); + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SHUTDOWN_HOST, EVENT_SHUTDOWN_HOST); + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SHUTDOWN_GUEST, EVENT_SHUTDOWN_GUEST); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY, EVENT_PMSUSPENDED_MEMORY); @@ -8938,6 +9167,9 @@ REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS, LIST_CAP_VPORTS); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC, LIST_CAP_SCSI_GENERIC); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM, LIST_CAP_DRM); + REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV, LIST_CAP_MDEV); + REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES, LIST_CAP_MDEV_TYPES); + REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV, LIST_CAP_CCW_DEV); REGISTER_CONSTANT(VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE, EVENT_ID_LIFECYCLE); REGISTER_CONSTANT(VIR_NODE_DEVICE_EVENT_ID_UPDATE, EVENT_ID_UPDATE); @@ -8980,6 +9212,10 @@ REGISTER_CONSTANT(VIR_STORAGE_VOL_USE_ALLOCATION, USE_ALLOCATION); REGISTER_CONSTANT(VIR_STORAGE_VOL_GET_PHYSICAL, GET_PHYSICAL); + REGISTER_CONSTANT(VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM, VOL_DOWNLOAD_SPARSE_STREAM); + + REGISTER_CONSTANT(VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM, VOL_UPLOAD_SPARSE_STREAM); + stash = gv_stashpv( "Sys::Virt::Secret", TRUE ); REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_NONE, USAGE_TYPE_NONE); REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_VOLUME, USAGE_TYPE_VOLUME); @@ -9008,6 +9244,8 @@ REGISTER_CONSTANT(VIR_STREAM_EVENT_ERROR, EVENT_ERROR); REGISTER_CONSTANT(VIR_STREAM_EVENT_HANGUP, EVENT_HANGUP); + REGISTER_CONSTANT(VIR_STREAM_RECV_STOP_AT_HOLE, RECV_STOP_AT_HOLE); + stash = gv_stashpv( "Sys::Virt::Error", TRUE ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/examples/vol-sparse.pl new/Sys-Virt-3.4.0/examples/vol-sparse.pl --- old/Sys-Virt-3.3.0/examples/vol-sparse.pl 1970-01-01 01:00:00.000000000 +0100 +++ new/Sys-Virt-3.4.0/examples/vol-sparse.pl 2017-05-30 13:14:29.000000000 +0200 @@ -0,0 +1,144 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Sys::Virt; +use Fcntl; + +my $FILE; + +sub download_handler { + my $st = shift; + my $data = shift; + my $nbytes = shift; + return syswrite FILE, $data, $nbytes; +} + +sub download_hole_handler { + my $st = shift; + my $offset = shift; + my $pos = sysseek FILE, $offset, Fcntl::SEEK_CUR or die "Unable to seek in $FILE: $!"; + truncate FILE, $pos; +} + + +sub download { + my $vol = shift; + my $st = shift; + my $filename = shift; + my $offset = 0; + my $length = 0; + + open FILE, ">$filename" or die "unable to create $filename: $!"; + eval { + $vol->download($st, $offset, $length, Sys::Virt::StorageVol::VOL_DOWNLOAD_SPARSE_STREAM); + $st->sparse_recv_all(\&download_handler, \&download_hole_handler); + $st->finish(); + }; + if ($@) { + unlink $filename if $@; + close FILE; + die $@; + } + + close FILE or die "cannot save $filename: $!" +} + +sub upload_handler { + my $st = $_[0]; + my $nbytes = $_[2]; + return sysread FILE, $_[1], $nbytes; +} + +sub upload_hole_handler { + my $st = shift; + my $in_data; + my $section_len; + + # HACK, Perl lacks SEEK_DATA and SEEK_HOLE. + my $SEEK_DATA = 3; + my $SEEK_HOLE = 4; + + my $cur = sysseek FILE, 0, Fcntl::SEEK_CUR; + eval { + my $data = sysseek FILE, $cur, $SEEK_DATA; + # There are three options: + # 1) $data == $cur; $cur is in data + # 2) $data > $cur; $cur is in a hole, next data at $data + # 3) $data < 0; either $cur is in trailing hole, or $cur is beyond EOF. + + if (!defined($data)) { + # case 3 + $in_data = 0; + my $end = sysseek FILE, 0, Fcntl::SEEK_END or die "Unable to get EOF position: $!"; + $section_len = $end - $cur; + } elsif ($data > $cur) { + #case 2 + $in_data = 0; + $section_len = $data - $cur; + } else { + #case 1 + my $hole = sysseek FILE, $data, $SEEK_HOLE; + if (!defined($hole) or $hole eq $data) { + die "Blah"; + } + $in_data = 1; + $section_len = $hole - $data; + } + }; + + die "Blah" if ($@); + + # reposition file back + sysseek FILE, $cur, Fcntl::SEEK_SET; + + return ($in_data, $section_len); +} + +sub upload_skip_handler { + my $st = shift; + my $offset = shift; + sysseek FILE, $offset, Fcntl::SEEK_CUR or die "Unable to seek in $FILE"; + return 0; +} + +sub upload { + my $vol = shift; + my $st = shift; + my $filename = shift; + my $offset = 0; + my $length = 0; + + open FILE, "<$filename" or die "unable to open $filename: $!"; + eval { + $vol->upload($st, $offset, $length, Sys::Virt::StorageVol::VOL_UPLOAD_SPARSE_STREAM); + $st->sparse_send_all(\&upload_handler, \&upload_hole_handler, \&upload_skip_handler); + $st->finish(); + }; + if ($@) { + close FILE; + die $@; + } + + close FILE or die "cannot close $filename: $!" +} + +die "syntax: $0 URI --download/--upload VOLUME FILE" unless int(@ARGV) == 4; + +my $uri = shift @ARGV; +my $action = shift @ARGV; +my $volpath = shift @ARGV; +my $filename = shift @ARGV; + +my $c = Sys::Virt->new(uri => $uri) or die "Unable to connect to $uri"; +my $vol = $c->get_storage_volume_by_key($volpath) or die "No such volume"; +my $st = $c->new_stream(); + +if ($action eq "--download") { + download($vol, $st, $filename); +} elsif ($action eq "--upload") { + upload($vol, $st, $filename); +} else { + die "unknown action $action"; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/lib/Sys/Virt/Domain.pm new/Sys-Virt-3.4.0/lib/Sys/Virt/Domain.pm --- old/Sys-Virt-3.3.0/lib/Sys/Virt/Domain.pm 2017-04-28 13:12:40.000000000 +0200 +++ new/Sys-Virt-3.4.0/lib/Sys/Virt/Domain.pm 2017-05-30 13:16:03.000000000 +0200 @@ -3099,6 +3099,14 @@ The domain finished shutting down +=item Sys::Virt::Domain::EVENT_SHUTDOWN_HOST + +The domain shutdown due to host trigger + +=item Sys::Virt::Domain::EVENT_SHUTDOWN_GUEST + +The domain shutdown due to guest trigger + =back =item Sys::Virt::Domain::EVENT_SUSPENDED diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/lib/Sys/Virt/NodeDevice.pm new/Sys-Virt-3.4.0/lib/Sys/Virt/NodeDevice.pm --- old/Sys-Virt-3.3.0/lib/Sys/Virt/NodeDevice.pm 2017-04-19 11:10:19.000000000 +0200 +++ new/Sys-Virt-3.4.0/lib/Sys/Virt/NodeDevice.pm 2017-05-30 13:17:12.000000000 +0200 @@ -169,6 +169,18 @@ Include devices with the DRM capability +=item Sys::Virt::NodeDevice::LIST_CAP_MDEV + +Include mediated devices + +=item Sys::Virt::NodeDevice::LIST_CAP_MDEV_TYPES + +Include devices capable of mediated devices + +=item Sys::Virt::NodeDevice::LIST_CAP_CCW_DEV + +Include CCW devices + =back =head2 EVENT ID CONSTANTS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/lib/Sys/Virt/StorageVol.pm new/Sys-Virt-3.4.0/lib/Sys/Virt/StorageVol.pm --- old/Sys-Virt-3.3.0/lib/Sys/Virt/StorageVol.pm 2016-12-21 12:21:38.000000000 +0100 +++ new/Sys-Virt-3.4.0/lib/Sys/Virt/StorageVol.pm 2017-05-30 13:14:29.000000000 +0200 @@ -141,17 +141,39 @@ =back -=item $vol->download($st, $offset, $length); +=item $vol->download($st, $offset, $length, $flags=0); Download data from C<$vol> using the stream C<$st>. If C<$offset> and C<$length> are non-zero, then restrict data to the specified -volume byte range. +volume byte range. The C<$flags> accept the following values: -=item $vol->upload($st, $offset, $length); +=over 4 + +=item Sys::Virt::StorageVol::VOL_DOWNLOAD_SPARSE_STREAM + +If this flag is is set in @flags effective transmission of holes +is enabled. This assumes using the stream C<$st> with combination of +C<sparse_recv_all> or C<recv($flags = +VIR_STREAM_RECV_STOP_AT_HOLE)> for honouring holes sent by server. + +=back + +=item $vol->upload($st, $offset, $length, $flags=0); Upload data to C<$vol> using the stream C<$st>. If C<$offset> and C<$length> are non-zero, then restrict data to the specified -volume byte range. +volume byte range. The C<$flags> accept the following values: + +=over 4 + +=item Sys::Virt::StorageVol::VOL_UPLOAD_SPARSE_STREAM + +If this is set in C<$flags> effective transmission of holes is +enabled. This assumes using the stream C<$st> with combination of +C<sparse_send_all> or C<send_hole> to preserve source file +sparseness. + +=back =back diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/lib/Sys/Virt/Stream.pm new/Sys-Virt-3.4.0/lib/Sys/Virt/Stream.pm --- old/Sys-Virt-3.3.0/lib/Sys/Virt/Stream.pm 2016-10-26 12:35:34.000000000 +0200 +++ new/Sys-Virt-3.4.0/lib/Sys/Virt/Stream.pm 2017-05-30 13:14:29.000000000 +0200 @@ -69,11 +69,23 @@ Complete I/O on the stream. Either this function or C<abort> must be called on any stream which has been activated -=item $rv = $st->recv($data, $nbytes) +=item $rv = $st->recv($data, $nbytes, $flags=0) -Receive upto C<$nbytes> worth of data, copying into C<$data>. -Returns the number of bytes read, or -2 if I/O would block, -or -1 on error. +Receive up to C<$nbytes> worth of data, copying into C<$data>. +Returns the number of bytes read, or -3 if hole is reached and +C<$flags> contains RECV_STOP_AT_HOLE, or -2 if I/O would block, +or -1 on error. The C<$flags> parameter accepts the following +flags: + +=over 4 + +=item Sys::Virt::Stream::RECV_STOP_AT_HOLE + +If this flag is set, the C<recv> function will stop reading from +stream if it has reached a hole. In that case, -3 is returned and +C<recv_hole> should be called to get the hole size. + +=back =item $rv = $st->send($data, $nbytes) @@ -81,6 +93,23 @@ Returns the number of bytes sent, or -2 if I/O would block, or -1 on error. +=item $rv = $st->recv_hole($flags=0) + +Determine the amount of the empty space (in bytes) to be created +in a stream's target file when uploading or downloading sparsely +populated files. This is the counterpart to C<send_hole>. The +optional C<$flags> parameter is currently unused and defaults to +zero if omitted. + +=item $st->send_hole($length, $flags=0) + +Rather than transmitting empty file space, this method directs +the stream target to create C<$length> bytes of empty space. +This method would be used when uploading or downloading sparsely +populated files to avoid the needless copy of empty file space. +The optional C<$flags> parameter is currently unused and defaults +to zero if omitted. + =item $st->recv_all($handler) Receive all data available from the stream, invoking @@ -101,6 +130,39 @@ the number of bytes filled, 0 on end of file, or -1 upon error +=item $st->sparse_recv_all($handler, $hole_handler) + +Receive all data available from the sparse stream, invoking +C<$handler> to process the data. The C<$handler> parameter must +be a function which expects three arguments, the C<$st> stream +object, a scalar containing the data received and a data byte +count. The function should return the number of bytes processed, +or -1 upon error. The second argument C<$hole_handler> is a +function which expects two arguments: the C<$st> stream and a +scalar, number describing the size of the hole in the stream (in +bytes). The C<$hole_handler> is expected to return a non-negative +number on success (usually 0) and a negative number (usually -1) +otherwise. + +=item $st->sparse_send_all($handler, $hole_handler, $skip_handler) + +Send all data produced by C<$handler> to the stream. The +C<$handler> parameter must be a function which expects three +arguments, the C<$st> stream object, a scalar which must be +filled with data and a maximum data byte count desired. The +function should return the number of bytes filled, 0 on end of +file, or -1 upon error. The second argument C<$hole_handler> is a +function expecting just one argument C<$st> and returning an +array of two elements (C<$in_data>, C<$section_len>) where +C<$in_data> has zero or non-zero value if underlying file is in a +hole or data section respectively. The C<$section_len> then is the +number of remaining bytes in the current section in the +underlying file. Finally, the third C<$skip_handler> is a function +expecting two arguments C<$st> and C<$length> which moves cursor +in the underlying file for C<$length> bytes. The C<$skip_handler> +is expected to return a non-negative number on success (usually +0) and a negative number (usually -1) otherwise. + =item $st->add_callback($events, $coderef) Register a callback to be invoked whenever the stream has diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/lib/Sys/Virt.pm new/Sys-Virt-3.4.0/lib/Sys/Virt.pm --- old/Sys-Virt-3.3.0/lib/Sys/Virt.pm 2017-04-03 15:50:38.000000000 +0200 +++ new/Sys-Virt-3.4.0/lib/Sys/Virt.pm 2017-05-08 18:05:05.000000000 +0200 @@ -78,7 +78,7 @@ use Sys::Virt::DomainSnapshot; use Sys::Virt::Stream; -our $VERSION = '3.3.0'; +our $VERSION = '3.4.0'; require XSLoader; XSLoader::load('Sys::Virt', $VERSION); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/perl-Sys-Virt.spec new/Sys-Virt-3.4.0/perl-Sys-Virt.spec --- old/Sys-Virt-3.3.0/perl-Sys-Virt.spec 2017-05-08 12:25:34.000000000 +0200 +++ new/Sys-Virt-3.4.0/perl-Sys-Virt.spec 2017-06-05 13:07:21.000000000 +0200 @@ -1,7 +1,7 @@ # Automatically generated by perl-Sys-Virt.spec.PL Name: perl-Sys-Virt -Version: 3.3.0 +Version: 3.4.0 Release: 1%{?dist}%{?extra_release} Summary: Represent and manage a libvirt hypervisor connection License: GPLv2+ or Artistic diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sys-Virt-3.3.0/t/030-api-coverage.t new/Sys-Virt-3.4.0/t/030-api-coverage.t --- old/Sys-Virt-3.3.0/t/030-api-coverage.t 2017-04-03 15:25:40.000000000 +0200 +++ new/Sys-Virt-3.4.0/t/030-api-coverage.t 2017-05-30 13:14:29.000000000 +0200 @@ -114,7 +114,10 @@ virStreamEventCallback virStreamSinkFunc +virStreamSinkHoleFunc virStreamSourceFunc +virStreamSourceHoleFunc +virStreamSourceSkipFunc virConnectCloseFunc ++++++ suse-set-migration-constraints.patch ++++++ --- /var/tmp/diff_new_pack.socT32/_old 2017-06-21 13:53:49.127916357 +0200 +++ /var/tmp/diff_new_pack.socT32/_new 2017-06-21 13:53:49.131915793 +0200 @@ -2,11 +2,11 @@ References: fate#316614, bsc#859868 -Index: Sys-Virt-3.3.0/Virt.xs +Index: Sys-Virt-3.4.0/Virt.xs =================================================================== ---- Sys-Virt-3.3.0.orig/Virt.xs -+++ Sys-Virt-3.3.0/Virt.xs -@@ -5006,7 +5006,7 @@ _migrate(dom, destcon, newparams, flags= +--- Sys-Virt-3.4.0.orig/Virt.xs ++++ Sys-Virt-3.4.0/Virt.xs +@@ -5142,7 +5142,7 @@ _migrate(dom, destcon, newparams, flags= virTypedParameterPtr params; int nparams; CODE: @@ -15,7 +15,7 @@ Newx(params, nparams, virTypedParameter); strncpy(params[0].field, VIR_MIGRATE_PARAM_URI, -@@ -5069,6 +5069,22 @@ _migrate(dom, destcon, newparams, flags= +@@ -5205,6 +5205,22 @@ _migrate(dom, destcon, newparams, flags= VIR_TYPED_PARAM_FIELD_LENGTH); params[14].type = VIR_TYPED_PARAM_INT; @@ -38,7 +38,7 @@ nparams = vir_typed_param_from_hv(newparams, params, nparams); vir_typed_param_add_string_list_from_hv(newparams, ¶ms, &nparams, -@@ -5097,7 +5113,7 @@ _migrate_to_uri(dom, desturi, newparams, +@@ -5233,7 +5249,7 @@ _migrate_to_uri(dom, desturi, newparams, virTypedParameterPtr params; int nparams; PPCODE: @@ -47,7 +47,7 @@ Newx(params, nparams, virTypedParameter); strncpy(params[0].field, VIR_MIGRATE_PARAM_URI, -@@ -5160,6 +5176,22 @@ _migrate_to_uri(dom, desturi, newparams, +@@ -5296,6 +5312,22 @@ _migrate_to_uri(dom, desturi, newparams, VIR_TYPED_PARAM_FIELD_LENGTH); params[14].type = VIR_TYPED_PARAM_INT; @@ -70,7 +70,7 @@ nparams = vir_typed_param_from_hv(newparams, params, nparams); vir_typed_param_add_string_list_from_hv(newparams, ¶ms, &nparams, -@@ -8237,6 +8269,10 @@ BOOT: +@@ -8464,6 +8496,10 @@ BOOT: REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_PERSIST_XML, MIGRATE_PARAM_PERSIST_XML); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL, MIGRATE_PARAM_AUTO_CONVERGE_INITIAL); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT); @@ -81,10 +81,10 @@ REGISTER_CONSTANT(VIR_DOMAIN_XML_SECURE, XML_SECURE); REGISTER_CONSTANT(VIR_DOMAIN_XML_INACTIVE, XML_INACTIVE); -Index: Sys-Virt-3.3.0/lib/Sys/Virt/Domain.pm +Index: Sys-Virt-3.4.0/lib/Sys/Virt/Domain.pm =================================================================== ---- Sys-Virt-3.3.0.orig/lib/Sys/Virt/Domain.pm -+++ Sys-Virt-3.3.0/lib/Sys/Virt/Domain.pm +--- Sys-Virt-3.4.0.orig/lib/Sys/Virt/Domain.pm ++++ Sys-Virt-3.4.0/lib/Sys/Virt/Domain.pm @@ -1101,6 +1101,22 @@ The initial percentage to throttle guest The additional percentage step size to throttle guest vCPUs if progress is not made
