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

Eric Blake eblake at redhat.com
Tue Dec 20 03:38:11 UTC 2011


On 12/19/2011 08:13 PM, Eric Blake wrote:
> On 12/19/2011 05:42 PM, Eric Blake wrote:
>> From: Hu Tao <hutao at 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 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/20111219/343672c1/attachment-0001.sig>


More information about the libvir-list mailing list