Re: [libvirt] [PATCH 2/8] Add virDomain{Set, Get}BlockIoTune support to the remote driver

2011-11-22 Thread Eric Blake
On 11/15/2011 02:02 AM, Lei Li wrote:
 Support Block I/O Throttle setting and query to remote driver.
 
 Signed-off-by: Lei Li li...@linux.vnet.ibm.com
 Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com
 ---
  daemon/remote.c  |  109 
 ++
  src/remote/remote_driver.c   |   96 +
  src/remote/remote_protocol.x |   27 ++-
  src/remote_protocol-structs  |   24 +
  4 files changed, 255 insertions(+), 1 deletions(-)
 

 diff --git a/daemon/remote.c b/daemon/remote.c
 index aa3f768..227d36e 100644
 --- a/daemon/remote.c
 +++ b/daemon/remote.c
 @@ -1886,6 +1886,115 @@ cleanup:
  return rv;
  }
  
 +static int
 +remoteDispatchDomainSetBlockIoThrottle(virNetServerPtr server 
 ATTRIBUTE_UNUSED,

This should be named remoteDispatchDomainSetBlockIoTune, to match the
public API naming.

In fact, by naming it correctly, we can rely on autogen to write this
function for us.

 +
 +static int
 +remoteDispatchDomainGetBlockIoThrottle(virNetServerPtr server 
 ATTRIBUTE_UNUSED,
 +   virNetServerClientPtr client 
 ATTRIBUTE_UNUSED,
 +   virNetMessagePtr hdr ATTRIBUTE_UNUSED,
 +   virNetMessageErrorPtr rerr,
 +   
 remote_domain_get_block_io_throttle_args *args,
 +   
 remote_domain_get_block_io_throttle_ret *ret)

Again, naming should be consistent, but this time we have to provide a
manual version.

 +{
 +virDomainPtr dom = NULL;
 +int rv = -1;
 +int i;
 +virTypedParameterPtr params;
 +int nparams = args-nparams;
 +struct daemonClientPrivate *priv =
 +virNetServerClientGetPrivateData(client);
 +
 +if (!priv-conn) {
 +virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(connection not open));
 +goto cleanup;
 +}
 +
 +if (nparams  REMOTE_DOMAIN_BLKIOTHROTTLE_PARAMETERS_MAX) {

More naming; the constant should be
REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX.

 +virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(nparams too large));
 +goto cleanup;
 +}
 +
 +if (VIR_ALLOC_N(params, nparams)  0) {
 +virReportOOMError();
 +goto cleanup;
 +}
 +
 +if (!(dom = get_nonnull_domain(priv-conn, args-dom)))
 +goto cleanup;
 +
 +if (virDomainGetBlockIoTune(dom, args-disk, params, nparams, 
 args-flags)  0)

Given my tweaks in 1/8, we want to be able to handle NULL over the wire;
this means that this type is changed to remote_string, and that
args-disk is now char** instead of char* and requires slightly
different handling.

 +
 +cleanup:
 +if (rv  0) {
 +virNetMessageSaveError(rerr);
 +if (ret-params.params_val) {
 +for (i = 0; i  nparams; i++)
 +VIR_FREE(ret-params.params_val[i].field);
 +VIR_FREE(ret-params.params_val);
 +}
 +}

Memory leak on any string parameters, as well as on params itself.

 +++ b/src/remote/remote_driver.c
 @@ -2178,6 +2178,100 @@ done:
  return rv;
  }
  
 +static int remoteDomainSetBlockIoTune(virDomainPtr domain,

This one can be auto-generated.

 +
 +static int remoteDomainGetBlockIoTune(virDomainPtr domain,
 +  const char *disk,
 +  virTypedParameterPtr params,
 +  int *nparams,
 +  unsigned int flags)
 +{
 +int rv = -1;
 +remote_domain_get_block_io_throttle_args args;
 +remote_domain_get_block_io_throttle_ret ret;

Naming of these types.

 +struct private_data *priv = domain-conn-privateData;
 +
 +remoteDriverLock(priv);
 +
 +make_nonnull_domain(args.dom, domain);
 +args.disk = (char *)disk;

Type of this argument.

 +if (remoteDeserializeTypedParameters(ret.params.params_val,
 + ret.params.params_len,
 + REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX,
 + params,
 + nparams)  0)
 +goto cleanup;
 +
 +rv = 0;
 +
 +cleanup:
 +xdr_free ((xdrproc_t) xdr_remote_domain_get_block_io_throttle_ret,
 +  (char *) ret);
 +rv = 0;

Oops - that negated any previously reported error.

 +++ b/src/remote/remote_protocol.x
 @@ -125,6 +125,9 @@ const REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX = 16;
  /* Upper limit on list of memory parameters. */
  const REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX = 16;
  
 +/* Upper limit on list of blockio throttle parameters. */
 +const REMOTE_DOMAIN_BLKIOTHROTTLE_PARAMETERS_MAX = 16;

As mentioned above, I tweaked this naming.

 +
 +struct remote_domain_get_block_io_throttle_args {
 +remote_nonnull_domain dom;
 +remote_nonnull_string disk;

as well as this.

 @@ -2564,7 +2586,10 @@ enum 

[libvirt] [PATCH 2/8] Add virDomain{Set, Get}BlockIoTune support to the remote driver

2011-11-15 Thread Lei Li
Support Block I/O Throttle setting and query to remote driver.

Signed-off-by: Lei Li li...@linux.vnet.ibm.com
Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com
---
 daemon/remote.c  |  109 ++
 src/remote/remote_driver.c   |   96 +
 src/remote/remote_protocol.x |   27 ++-
 src/remote_protocol-structs  |   24 +
 4 files changed, 255 insertions(+), 1 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index aa3f768..227d36e 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1886,6 +1886,115 @@ cleanup:
 return rv;
 }
 
+static int
+remoteDispatchDomainSetBlockIoThrottle(virNetServerPtr server ATTRIBUTE_UNUSED,
+   virNetServerClientPtr client 
ATTRIBUTE_UNUSED,
+   virNetMessagePtr hdr ATTRIBUTE_UNUSED,
+   virNetMessageErrorPtr rerr,
+   
remote_domain_set_block_io_throttle_args *args)
+{
+virDomainPtr dom = NULL;
+int rv = -1;
+virTypedParameterPtr params = NULL;
+int nparams;
+struct daemonClientPrivate *priv =
+virNetServerClientGetPrivateData(client);
+
+if (!priv-conn) {
+virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(connection not open));
+goto cleanup;
+}
+
+if (!(dom = get_nonnull_domain(priv-conn, args-dom)))
+goto cleanup;
+
+if ((params = remoteDeserializeTypedParameters(args-params.params_val,
+   args-params.params_len,
+   
REMOTE_DOMAIN_BLKIOTHROTTLE_PARAMETERS_MAX,
+   nparams)) == NULL)
+goto cleanup;
+
+rv = virDomainSetBlockIoTune(dom, args-disk, params, nparams, 
args-flags);
+
+if (rv  0)
+goto cleanup;
+
+cleanup:
+if (rv  0)
+virNetMessageSaveError(rerr);
+if (dom)
+virDomainFree(dom);
+return rv;
+}
+
+static int
+remoteDispatchDomainGetBlockIoThrottle(virNetServerPtr server ATTRIBUTE_UNUSED,
+   virNetServerClientPtr client 
ATTRIBUTE_UNUSED,
+   virNetMessagePtr hdr ATTRIBUTE_UNUSED,
+   virNetMessageErrorPtr rerr,
+   
remote_domain_get_block_io_throttle_args *args,
+   remote_domain_get_block_io_throttle_ret 
*ret)
+{
+virDomainPtr dom = NULL;
+int rv = -1;
+int i;
+virTypedParameterPtr params;
+int nparams = args-nparams;
+struct daemonClientPrivate *priv =
+virNetServerClientGetPrivateData(client);
+
+if (!priv-conn) {
+virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(connection not open));
+goto cleanup;
+}
+
+if (nparams  REMOTE_DOMAIN_BLKIOTHROTTLE_PARAMETERS_MAX) {
+virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(nparams too large));
+goto cleanup;
+}
+
+if (VIR_ALLOC_N(params, nparams)  0) {
+virReportOOMError();
+goto cleanup;
+}
+
+if (!(dom = get_nonnull_domain(priv-conn, args-dom)))
+goto cleanup;
+
+if (virDomainGetBlockIoTune(dom, args-disk, params, nparams, 
args-flags)  0)
+goto cleanup;
+
+/* In this case, we need to send back the number of parameters
+ * supported
+ */
+if (args-nparams == 0) {
+ret-nparams = nparams;
+goto success;
+}
+
+/* Serialise the block I/O throttle. */
+if (remoteSerializeTypedParameters(params, nparams,
+   ret-params.params_val,
+   ret-params.params_len,
+   args-flags)  0)
+goto cleanup;
+
+success:
+rv = 0;
+
+cleanup:
+if (rv  0) {
+virNetMessageSaveError(rerr);
+if (ret-params.params_val) {
+for (i = 0; i  nparams; i++)
+VIR_FREE(ret-params.params_val[i].field);
+VIR_FREE(ret-params.params_val);
+}
+}
+if (dom)
+virDomainFree(dom);
+return rv;
+}
 
 /*-*/
 
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 94fd3e7..fa2d2c7 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2178,6 +2178,100 @@ done:
 return rv;
 }
 
+static int remoteDomainSetBlockIoTune(virDomainPtr domain,
+  const char *disk,
+  virTypedParameterPtr params,
+  int nparams,
+  unsigned int flags)
+{
+int rv = -1;
+remote_domain_set_block_io_throttle_args args;
+struct private_data *priv = domain-conn-privateData;
+
+remoteDriverLock(priv);

[libvirt] [PATCH 2/8] Add virDomain{Set, Get}BlockIoTune support to the remote driver

2011-11-14 Thread Lei Li
Support Block I/O Throttle setting and query to remote driver.

Signed-off-by: Lei Li li...@linux.vnet.ibm.com
Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com
---
 daemon/remote.c  |  109 ++
 src/remote/remote_driver.c   |   96 +
 src/remote/remote_protocol.x |   26 ++-
 src/remote_protocol-structs  |   24 +
 4 files changed, 254 insertions(+), 1 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index aa3f768..227d36e 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1886,6 +1886,115 @@ cleanup:
 return rv;
 }
 
+static int
+remoteDispatchDomainSetBlockIoThrottle(virNetServerPtr server ATTRIBUTE_UNUSED,
+   virNetServerClientPtr client 
ATTRIBUTE_UNUSED,
+   virNetMessagePtr hdr ATTRIBUTE_UNUSED,
+   virNetMessageErrorPtr rerr,
+   
remote_domain_set_block_io_throttle_args *args)
+{
+virDomainPtr dom = NULL;
+int rv = -1;
+virTypedParameterPtr params = NULL;
+int nparams;
+struct daemonClientPrivate *priv =
+virNetServerClientGetPrivateData(client);
+
+if (!priv-conn) {
+virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(connection not open));
+goto cleanup;
+}
+
+if (!(dom = get_nonnull_domain(priv-conn, args-dom)))
+goto cleanup;
+
+if ((params = remoteDeserializeTypedParameters(args-params.params_val,
+   args-params.params_len,
+   
REMOTE_DOMAIN_BLKIOTHROTTLE_PARAMETERS_MAX,
+   nparams)) == NULL)
+goto cleanup;
+
+rv = virDomainSetBlockIoTune(dom, args-disk, params, nparams, 
args-flags);
+
+if (rv  0)
+goto cleanup;
+
+cleanup:
+if (rv  0)
+virNetMessageSaveError(rerr);
+if (dom)
+virDomainFree(dom);
+return rv;
+}
+
+static int
+remoteDispatchDomainGetBlockIoThrottle(virNetServerPtr server ATTRIBUTE_UNUSED,
+   virNetServerClientPtr client 
ATTRIBUTE_UNUSED,
+   virNetMessagePtr hdr ATTRIBUTE_UNUSED,
+   virNetMessageErrorPtr rerr,
+   
remote_domain_get_block_io_throttle_args *args,
+   remote_domain_get_block_io_throttle_ret 
*ret)
+{
+virDomainPtr dom = NULL;
+int rv = -1;
+int i;
+virTypedParameterPtr params;
+int nparams = args-nparams;
+struct daemonClientPrivate *priv =
+virNetServerClientGetPrivateData(client);
+
+if (!priv-conn) {
+virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(connection not open));
+goto cleanup;
+}
+
+if (nparams  REMOTE_DOMAIN_BLKIOTHROTTLE_PARAMETERS_MAX) {
+virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(nparams too large));
+goto cleanup;
+}
+
+if (VIR_ALLOC_N(params, nparams)  0) {
+virReportOOMError();
+goto cleanup;
+}
+
+if (!(dom = get_nonnull_domain(priv-conn, args-dom)))
+goto cleanup;
+
+if (virDomainGetBlockIoTune(dom, args-disk, params, nparams, 
args-flags)  0)
+goto cleanup;
+
+/* In this case, we need to send back the number of parameters
+ * supported
+ */
+if (args-nparams == 0) {
+ret-nparams = nparams;
+goto success;
+}
+
+/* Serialise the block I/O throttle. */
+if (remoteSerializeTypedParameters(params, nparams,
+   ret-params.params_val,
+   ret-params.params_len,
+   args-flags)  0)
+goto cleanup;
+
+success:
+rv = 0;
+
+cleanup:
+if (rv  0) {
+virNetMessageSaveError(rerr);
+if (ret-params.params_val) {
+for (i = 0; i  nparams; i++)
+VIR_FREE(ret-params.params_val[i].field);
+VIR_FREE(ret-params.params_val);
+}
+}
+if (dom)
+virDomainFree(dom);
+return rv;
+}
 
 /*-*/
 
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 94fd3e7..fa2d2c7 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2178,6 +2178,100 @@ done:
 return rv;
 }
 
+static int remoteDomainSetBlockIoTune(virDomainPtr domain,
+  const char *disk,
+  virTypedParameterPtr params,
+  int nparams,
+  unsigned int flags)
+{
+int rv = -1;
+remote_domain_set_block_io_throttle_args args;
+struct private_data *priv = domain-conn-privateData;
+
+remoteDriverLock(priv);

Re: [libvirt] [PATCH 2/8] Add virDomain{Set, Get}BlockIoTune support to the remote driver

2011-11-14 Thread Eric Blake
On 11/14/2011 09:33 PM, Lei Li wrote:
 Support Block I/O Throttle setting and query to remote driver.
 
 Signed-off-by: Lei Li li...@linux.vnet.ibm.com
 Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com

 +
 +struct remote_domain_get_block_io_throttle_args {
 +remote_nonnull_domain dom;
 +remote_nonnull_string disk;
 +int nparams;
 +unsigned int flags;
 +};

Hmm, just wondering - if we use 'remote_string disk', then we can allow
NULL for disk and params as a way to populate nparams as the maximum
possible for all types of disks in a given domain, rather than returning
a possibly-varying nparams specific to each disk.  Might be worth a
tweak to the libvirt.c documentation to allow NULL disk as a special case.

 @@ -2564,7 +2586,9 @@ enum remote_procedure {
  REMOTE_PROC_DOMAIN_SNAPSHOT_NUM_CHILDREN = 246, /* autogen autogen 
 priority:high */
  REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_CHILDREN_NAMES = 247, /* autogen 
 autogen priority:high */
  REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE = 248, /* skipgen skipgen */
 -REMOTE_PROC_DOMAIN_OPEN_GRAPHICS = 249 /* skipgen skipgen */
 +REMOTE_PROC_DOMAIN_OPEN_GRAPHICS = 249, /* skipgen skipgen */
 +REMOTE_PROC_DOMAIN_SET_BLOCK_IO_THROTTLE = 250, /* skipgen skipgen */
 +REMOTE_PROC_DOMAIN_GET_BLOCK_IO_THROTTLE = 251 /* skipgen skipgen */
  
  /*
   * Notice how the entries are grouped in sets of 10 ?

Oops - you skipped right over the comment here, and forgot your blank
line :)

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/8] Add virDomain{Set, Get}BlockIoTune support to the remote driver

2011-11-10 Thread Adam Litke
Looks good to me.

On Thu, Nov 10, 2011 at 04:32:52AM +0800, Lei HH Li wrote:
 Support Block I/O Throttle setting and query to remote driver.
 
 Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com
 Signed-off-by: Lei Li li...@linux.vnet.ibm.com
 ---
  daemon/remote.c  |   87 
 ++
  src/remote/remote_driver.c   |   80 ++
  src/remote/remote_protocol.x |   38 ++-
  src/remote_protocol-structs  |   33 
  4 files changed, 237 insertions(+), 1 deletions(-)
 
 diff --git a/daemon/remote.c b/daemon/remote.c
 index bd0c3e3..070ca65 100644
 --- a/daemon/remote.c
 +++ b/daemon/remote.c
 @@ -1850,6 +1850,93 @@ cleanup:
  return rv;
  }
 
 +static int
 +remoteDispatchDomainSetBlockIoThrottle(virNetServerPtr server 
 ATTRIBUTE_UNUSED,
 +   virNetServerClientPtr client 
 ATTRIBUTE_UNUSED,
 +   virNetMessagePtr hdr ATTRIBUTE_UNUSED,
 +   virNetMessageErrorPtr rerr,
 +   
 remote_domain_set_block_io_throttle_args *args)
 +{
 +virDomainPtr dom = NULL;
 +virDomainBlockIoTuneInfo tmp;
 +int rv = -1;
 +struct daemonClientPrivate *priv =
 +virNetServerClientGetPrivateData(client);
 +
 +if (!priv-conn) {
 +virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(connection not open));
 +goto cleanup;
 +}
 +
 +if (!(dom = get_nonnull_domain(priv-conn, args-dom)))
 +goto cleanup;
 +
 +if (args) {
 +tmp.total_bytes_sec = args-bps;
 +tmp.read_bytes_sec = args-bps_rd;
 +tmp.write_bytes_sec = args-bps_wr;
 +tmp.total_iops_sec = args-iops;
 +tmp.read_iops_sec = args-iops_rd;
 +tmp.write_iops_sec = args-iops_wr;
 +}
 +
 +rv = virDomainSetBlockIoTune(dom, args-disk, tmp, args-flags);
 +
 +if (rv  0)
 +goto cleanup;
 +
 +cleanup:
 +if (rv  0)
 +virNetMessageSaveError(rerr);
 +if (dom)
 +virDomainFree(dom);
 +return rv;
 +}
 +
 +static int
 +remoteDispatchDomainGetBlockIoThrottle(virNetServerPtr server 
 ATTRIBUTE_UNUSED,
 +   virNetServerClientPtr client 
 ATTRIBUTE_UNUSED,
 +   virNetMessagePtr hdr ATTRIBUTE_UNUSED,
 +   virNetMessageErrorPtr rerr,
 +   
 remote_domain_get_block_io_throttle_args *args,
 +   
 remote_domain_get_block_io_throttle_ret *ret)
 +{
 +virDomainPtr dom = NULL;
 +virDomainBlockIoTuneInfo reply;
 +int rv = -1;
 +struct daemonClientPrivate *priv =
 +virNetServerClientGetPrivateData(client);
 +
 +if (!priv-conn) {
 +virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(connection not open));
 +goto cleanup;
 +}
 +
 +if (!(dom = get_nonnull_domain(priv-conn, args-dom)))
 +goto cleanup;
 +
 +rv = virDomainGetBlockIoTune(dom, args-disk, reply, args-flags);
 +
 +if (rv  0) {
 +ret-found = 0;
 +goto cleanup;
 +}
 +
 +ret-bps = reply.total_bytes_sec;
 +ret-bps_rd  = reply.read_bytes_sec;
 +ret-bps_wr  = reply.write_bytes_sec;
 +ret-iops= reply.total_iops_sec;
 +ret-iops_rd = reply.read_iops_sec;
 +ret-iops_wr = reply.write_iops_sec;
 +ret-found = 1;
 +
 +cleanup:
 +if (rv  0)
 +virNetMessageSaveError(rerr);
 +if (dom)
 +virDomainFree(dom);
 +return rv;
 +}
 
  /*-*/
 
 diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
 index f3b8ad5..0900231 100644
 --- a/src/remote/remote_driver.c
 +++ b/src/remote/remote_driver.c
 @@ -2154,6 +2154,84 @@ done:
  return rv;
  }
 
 +static int remoteDomainSetBlockIoTune(virDomainPtr domain,
 +  const char *disk,
 +  virDomainBlockIoTuneInfoPtr info,
 +  unsigned int flags)
 +{
 +int rv = -1;
 +remote_domain_set_block_io_throttle_args args;
 +struct private_data *priv = domain-conn-privateData;
 +
 +remoteDriverLock(priv);
 +
 +memset(args, 0, sizeof(args));
 +
 +make_nonnull_domain(args.dom, domain);
 +args.disk = (char *)disk;
 +args.bps = info-total_bytes_sec;
 +args.bps_rd = info-read_bytes_sec;
 +args.bps_wr = info-write_bytes_sec;
 +args.iops = info-total_iops_sec;
 +args.iops_rd = info-read_iops_sec;
 +args.iops_wr = info-write_iops_sec;
 +args.flags = flags;
 +
 +if (call(domain-conn, priv, 0, REMOTE_PROC_DOMAIN_SET_BLOCK_IO_THROTTLE,
 + (xdrproc_t) xdr_remote_domain_set_block_io_throttle_args,
 +   (char *) args,
 + (xdrproc_t) xdr_void,
 +   (char *) NULL) == -1) {
 + 

[libvirt] [PATCH 2/8] Add virDomain{Set, Get}BlockIoTune support to the remote driver

2011-11-09 Thread Lei Li
Support Block I/O Throttle setting and query to remote driver.

Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com
Signed-off-by: Lei Li li...@linux.vnet.ibm.com
---
 daemon/remote.c  |   87 ++
 src/remote/remote_driver.c   |   80 ++
 src/remote/remote_protocol.x |   38 ++-
 src/remote_protocol-structs  |   33 
 4 files changed, 237 insertions(+), 1 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index bd0c3e3..070ca65 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1850,6 +1850,93 @@ cleanup:
 return rv;
 }
 
+static int
+remoteDispatchDomainSetBlockIoThrottle(virNetServerPtr server ATTRIBUTE_UNUSED,
+   virNetServerClientPtr client 
ATTRIBUTE_UNUSED,
+   virNetMessagePtr hdr ATTRIBUTE_UNUSED,
+   virNetMessageErrorPtr rerr,
+   
remote_domain_set_block_io_throttle_args *args)
+{
+virDomainPtr dom = NULL;
+virDomainBlockIoTuneInfo tmp;
+int rv = -1;
+struct daemonClientPrivate *priv =
+virNetServerClientGetPrivateData(client);
+
+if (!priv-conn) {
+virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(connection not open));
+goto cleanup;
+}
+
+if (!(dom = get_nonnull_domain(priv-conn, args-dom)))
+goto cleanup;
+
+if (args) {
+tmp.total_bytes_sec = args-bps;
+tmp.read_bytes_sec = args-bps_rd;
+tmp.write_bytes_sec = args-bps_wr;
+tmp.total_iops_sec = args-iops;
+tmp.read_iops_sec = args-iops_rd;
+tmp.write_iops_sec = args-iops_wr;
+}
+
+rv = virDomainSetBlockIoTune(dom, args-disk, tmp, args-flags);
+
+if (rv  0)
+goto cleanup;
+
+cleanup:
+if (rv  0)
+virNetMessageSaveError(rerr);
+if (dom)
+virDomainFree(dom);
+return rv;
+}
+
+static int
+remoteDispatchDomainGetBlockIoThrottle(virNetServerPtr server ATTRIBUTE_UNUSED,
+   virNetServerClientPtr client 
ATTRIBUTE_UNUSED,
+   virNetMessagePtr hdr ATTRIBUTE_UNUSED,
+   virNetMessageErrorPtr rerr,
+   
remote_domain_get_block_io_throttle_args *args,
+   remote_domain_get_block_io_throttle_ret 
*ret)
+{
+virDomainPtr dom = NULL;
+virDomainBlockIoTuneInfo reply;
+int rv = -1;
+struct daemonClientPrivate *priv =
+virNetServerClientGetPrivateData(client);
+
+if (!priv-conn) {
+virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(connection not open));
+goto cleanup;
+}
+
+if (!(dom = get_nonnull_domain(priv-conn, args-dom)))
+goto cleanup;
+
+rv = virDomainGetBlockIoTune(dom, args-disk, reply, args-flags);
+
+if (rv  0) {
+ret-found = 0;
+goto cleanup;
+}
+
+ret-bps = reply.total_bytes_sec;
+ret-bps_rd  = reply.read_bytes_sec;
+ret-bps_wr  = reply.write_bytes_sec;
+ret-iops= reply.total_iops_sec;
+ret-iops_rd = reply.read_iops_sec;
+ret-iops_wr = reply.write_iops_sec;
+ret-found = 1;
+
+cleanup:
+if (rv  0)
+virNetMessageSaveError(rerr);
+if (dom)
+virDomainFree(dom);
+return rv;
+}
 
 /*-*/
 
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index f3b8ad5..0900231 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2154,6 +2154,84 @@ done:
 return rv;
 }
 
+static int remoteDomainSetBlockIoTune(virDomainPtr domain,
+  const char *disk,
+  virDomainBlockIoTuneInfoPtr info,
+  unsigned int flags)
+{
+int rv = -1;
+remote_domain_set_block_io_throttle_args args;
+struct private_data *priv = domain-conn-privateData;
+
+remoteDriverLock(priv);
+
+memset(args, 0, sizeof(args));
+
+make_nonnull_domain(args.dom, domain);
+args.disk = (char *)disk;
+args.bps = info-total_bytes_sec;
+args.bps_rd = info-read_bytes_sec;
+args.bps_wr = info-write_bytes_sec;
+args.iops = info-total_iops_sec;
+args.iops_rd = info-read_iops_sec;
+args.iops_wr = info-write_iops_sec;
+args.flags = flags;
+
+if (call(domain-conn, priv, 0, REMOTE_PROC_DOMAIN_SET_BLOCK_IO_THROTTLE,
+ (xdrproc_t) xdr_remote_domain_set_block_io_throttle_args,
+   (char *) args,
+ (xdrproc_t) xdr_void,
+   (char *) NULL) == -1) {
+goto done;
+}
+rv = 0;
+
+done:
+remoteDriverUnlock(priv);
+return rv;
+}
+
+static int remoteDomainGetBlockIoTune(virDomainPtr domain,
+  const char *disk,
+