[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCHv4 4/6] Add virDomain{G, S}etNumaParameters support to the remote driver



On 12/19/2011 08:13 PM, Eric Blake wrote:
> On 12/19/2011 05:42 PM, Eric Blake wrote:
>> From: Hu Tao <hutao cn fujitsu com>
>>
>> ---
>>  daemon/remote.c              |   64 ++++++++++++++++++++++++++++++++++++++++++
>>  src/remote/remote_driver.c   |   50 ++++++++++++++++++++++++++++++++
>>  src/remote/remote_protocol.x |   24 +++++++++++++++-
>>  src/remote_protocol-structs  |   22 ++++++++++++++
>>  4 files changed, 159 insertions(+), 1 deletions(-)
> 
> Squash in this, at least.
> 
> diff --git i/daemon/remote.c w/daemon/remote.c
> index 20193b1..bf7f02c 100644
> --- i/daemon/remote.c
> +++ w/daemon/remote.c
> @@ -1652,7 +1652,7 @@
> remoteDispatchDomainGetNumaParameters(virNetServerPtr server
> ATTRIBUTE_UNUSED,
> 
>      flags = args->flags;
> 
> -    if (nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) {
> +    if (nparams > REMOTE_DOMAIN_NUMA_PARAMETERS_MAX) {
>          virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
>          goto cleanup;
>      }

And as long as I'm at it, I found a pretty nasty bug with
TYPED_PARAM_STRING (thankfully untriggered - it requires that a driver
send a string prior to any other typed parameter to a receiver that
won't accept strings, but qemu always sends strings last), as well as
some memory leaks.

diff --git i/daemon/remote.c w/daemon/remote.c
index bf7f02c..8cc475f 100644
--- i/daemon/remote.c
+++ w/daemon/remote.c
@@ -759,7 +759,7 @@ cleanup:
     if (val) {
         for (i = 0; i < nparams; i++) {
             VIR_FREE(val[i].field);
-            if (params[i].type == VIR_TYPED_PARAM_STRING)
+            if (val[i].value.type == VIR_TYPED_PARAM_STRING)
                 VIR_FREE(val[i].value.remote_typed_param_value_u.s);
         }
         VIR_FREE(val);
@@ -898,9 +898,10 @@
remoteDispatchDomainGetSchedulerParameters(virNetServerPtr server
ATTRIBUTE_UNUS
 cleanup:
     if (rv < 0)
         virNetMessageSaveError(rerr);
+    virTypedParameterArrayClear(params, nparams);
+    VIR_FREE(params);
     if (dom)
         virDomainFree(dom);
-    VIR_FREE(params);
     return rv;

 no_memory:
@@ -953,9 +954,10 @@
remoteDispatchDomainGetSchedulerParametersFlags(virNetServerPtr server
ATTRIBUTE
 cleanup:
     if (rv < 0)
         virNetMessageSaveError(rerr);
+    virTypedParameterArrayClear(params, nparams);
+    VIR_FREE(params);
     if (dom)
         virDomainFree(dom);
-    VIR_FREE(params);
     return rv;

 no_memory:
@@ -1140,17 +1142,12 @@ success:
     rv = 0;

 cleanup:
-    if (rv < 0) {
+    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);
-        }
-    }
+    virTypedParameterArrayClear(params, nparams);
+    VIR_FREE(params);
     if (dom)
         virDomainFree(dom);
-    VIR_FREE(params);
     return rv;
 }

@@ -1623,9 +1620,10 @@ success:
 cleanup:
     if (rv < 0)
         virNetMessageSaveError(rerr);
+    virTypedParameterArrayClear(params, nparams);
+    VIR_FREE(params);
     if (dom)
         virDomainFree(dom);
-    VIR_FREE(params);
     return rv;
 }

@@ -1687,9 +1685,10 @@ success:
 cleanup:
     if (rv < 0)
         virNetMessageSaveError(rerr);
+    virTypedParameterArrayClear(params, nparams);
+    VIR_FREE(params);
     if (dom)
         virDomainFree(dom);
-    VIR_FREE(params);
     return rv;
 }

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

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]