Re: [libvirt] [PATCH v3 12/31] Add new flag to daemonCreateClientStream and virNetClientStreamNew

2017-05-17 Thread John Ferlan


On 05/16/2017 10:03 AM, Michal Privoznik wrote:
> Add a new argument to daemonCreateClientStream in order to allow for
> future expansion to mark that a specific stream can be used to skip
> data, such as the case with sparsely populated files. The new flag will
> be the eventual decision point between client/server to decide whether
> both ends can support and want to use sparse streams.
> 
> A new bool 'allowSkip' is added to both _virNetClientStream and
> daemonClientStream in order to perform the tracking.
> 
> Signed-off-by: Michal Privoznik 
> ---
>  daemon/remote.c  | 2 +-
>  daemon/stream.c  | 6 +-
>  daemon/stream.h  | 3 ++-
>  src/remote/remote_driver.c   | 6 --
>  src/rpc/gendispatch.pl   | 4 ++--
>  src/rpc/virnetclientstream.c | 6 +-
>  src/rpc/virnetclientstream.h | 3 ++-
>  7 files changed, 21 insertions(+), 9 deletions(-)
> 

Reviewed-by: John Ferlan 

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v3 12/31] Add new flag to daemonCreateClientStream and virNetClientStreamNew

2017-05-16 Thread Michal Privoznik
Add a new argument to daemonCreateClientStream in order to allow for
future expansion to mark that a specific stream can be used to skip
data, such as the case with sparsely populated files. The new flag will
be the eventual decision point between client/server to decide whether
both ends can support and want to use sparse streams.

A new bool 'allowSkip' is added to both _virNetClientStream and
daemonClientStream in order to perform the tracking.

Signed-off-by: Michal Privoznik 
---
 daemon/remote.c  | 2 +-
 daemon/stream.c  | 6 +-
 daemon/stream.h  | 3 ++-
 src/remote/remote_driver.c   | 6 --
 src/rpc/gendispatch.pl   | 4 ++--
 src/rpc/virnetclientstream.c | 6 +-
 src/rpc/virnetclientstream.h | 3 ++-
 7 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 0dbb250ff..fd8542120 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -5323,7 +5323,7 @@ 
remoteDispatchDomainMigratePrepareTunnel3Params(virNetServerPtr server ATTRIBUTE
 
 if (!(st = virStreamNew(priv->conn, VIR_STREAM_NONBLOCK)) ||
 !(stream = daemonCreateClientStream(client, st, remoteProgram,
-&msg->header)))
+&msg->header, false)))
 goto cleanup;
 
 if (virDomainMigratePrepareTunnel3Params(priv->conn, st, params, nparams,
diff --git a/daemon/stream.c b/daemon/stream.c
index 11c0a469d..6465463ff 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -52,6 +52,8 @@ struct daemonClientStream {
 virNetMessagePtr rx;
 bool tx;
 
+bool allowSkip;
+
 daemonClientStreamPtr next;
 };
 
@@ -321,7 +323,8 @@ daemonClientStream *
 daemonCreateClientStream(virNetServerClientPtr client,
  virStreamPtr st,
  virNetServerProgramPtr prog,
- virNetMessageHeaderPtr header)
+ virNetMessageHeaderPtr header,
+ bool allowSkip)
 {
 daemonClientStream *stream;
 daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
@@ -339,6 +342,7 @@ daemonCreateClientStream(virNetServerClientPtr client,
 stream->serial = header->serial;
 stream->filterID = -1;
 stream->st = st;
+stream->allowSkip = allowSkip;
 
 return stream;
 }
diff --git a/daemon/stream.h b/daemon/stream.h
index cf76e717a..e1f106759 100644
--- a/daemon/stream.h
+++ b/daemon/stream.h
@@ -30,7 +30,8 @@ daemonClientStream *
 daemonCreateClientStream(virNetServerClientPtr client,
  virStreamPtr st,
  virNetServerProgramPtr prog,
- virNetMessageHeaderPtr hdr);
+ virNetMessageHeaderPtr hdr,
+ bool allowSkip);
 
 int daemonFreeClientStream(virNetServerClientPtr client,
daemonClientStream *stream);
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index b152be523..aebdd47c9 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -6173,7 +6173,8 @@ remoteDomainMigratePrepareTunnel3(virConnectPtr dconn,
 if (!(netst = virNetClientStreamNew(st,
 priv->remoteProgram,
 
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3,
-priv->counter)))
+priv->counter,
+false)))
 goto done;
 
 if (virNetClientAddStream(priv->client, netst) < 0) {
@@ -7098,7 +7099,8 @@ remoteDomainMigratePrepareTunnel3Params(virConnectPtr 
dconn,
 if (!(netst = virNetClientStreamNew(st,
 priv->remoteProgram,
 
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS,
-priv->counter)))
+priv->counter,
+false)))
 goto cleanup;
 
 if (virNetClientAddStream(priv->client, netst) < 0) {
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index e608812ce..98625983a 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -1024,7 +1024,7 @@ elsif ($mode eq "server") {
 print "if (!(st = virStreamNew(priv->conn, 
VIR_STREAM_NONBLOCK)))\n";
 print "goto cleanup;\n";
 print "\n";
-print "if (!(stream = daemonCreateClientStream(client, st, 
remoteProgram, &msg->header)))\n";
+print "if (!(stream = daemonCreateClientStream(client, st, 
remoteProgram, &msg->header, false)))\n";
 print "goto cleanup;\n";
 print "\n";
 }
@@ -1738,7 +1738,7 @@ elsif ($mode eq "client") {
 
 if ($call->{streamflag} ne "none") {
 print "\n";
-pri