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

Eric Blake eblake at redhat.com
Wed Nov 30 18:25:42 UTC 2011


On 11/23/2011 02:44 PM, Eric Blake wrote:
> From: Lei Li <lilei at linux.vnet.ibm.com>
> 
> Support Block I/O Throttle setting and query to remote driver.
> 
> Signed-off-by: Lei Li <lilei at linux.vnet.ibm.com>
> Signed-off-by: Zhi Yong Wu <wuzhy at linux.vnet.ibm.com>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  daemon/remote.c              |   64 ++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt.c                |    1 -
>  src/remote/remote_driver.c   |   57 +++++++++++++++++++++++++++++++++++++
>  src/remote/remote_protocol.x |   27 +++++++++++++++++-
>  src/remote_protocol-structs  |   24 +++++++++++++++
>  5 files changed, 171 insertions(+), 2 deletions(-)
> 
> diff --git a/daemon/remote.c b/daemon/remote.c
> index 97c9538..8b2da0d 100644
> --- a/daemon/remote.c
> +++ b/daemon/remote.c
> @@ -1885,6 +1885,70 @@ cleanup:
>      return rv;
>  }
> 
> +static int
> +remoteDispatchDomainGetBlockIoTune(virNetServerPtr server ATTRIBUTE_UNUSED,
> +                                   virNetServerClientPtr client ATTRIBUTE_UNUSED,
> +                                   virNetMessagePtr hdr ATTRIBUTE_UNUSED,
> +                                   virNetMessageErrorPtr rerr,
> +                                   remote_domain_get_block_io_tune_args *args,
> +                                   remote_domain_get_block_io_tune_ret *ret)
> +{
> +    virDomainPtr dom = NULL;
> +    int rv = -1;
> +    virTypedParameterPtr params;

Uninit...

> +    if (nparams > 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) {

...and can get to cleanup before allocation...

> +cleanup:
> +    if (rv < 0)
> +        virNetMessageSaveError(rerr);
> +    virTypedParameterArrayClear(params, nparams);
> +    VIR_FREE(params);

...which means death inside free().  Oops.

I'm squashing this in:

diff --git i/daemon/remote.c w/daemon/remote.c
index 12ac6c2..e1d208c 100644
--- i/daemon/remote.c
+++ w/daemon/remote.c
@@ -1901,7 +1901,7 @@ remoteDispatchDomainGetBlockIoTune(virNetServerPtr
server ATTRIBUTE_UNUSED,
 {
     virDomainPtr dom = NULL;
     int rv = -1;
-    virTypedParameterPtr params;
+    virTypedParameterPtr params = NULL;
     int nparams = args->nparams;
     struct daemonClientPrivate *priv =
         virNetServerClientGetPrivateData(client);


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111130/81459e71/attachment-0001.sig>


More information about the libvir-list mailing list