Re: [PATCHv3 4/8] Implement main entries of virDomain{G, S}etNumaParameters

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

 



On 12/15/2011 03:50 AM, Hu Tao wrote:
> ---
>  src/libvirt.c |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 113 insertions(+), 0 deletions(-)

I've reviewed 1-4, and the first three look fine; however, I'm going to
squash 3 and 4 into a single patch (it's easier to see the documentation
in libvirt.c alongside the entry points added in libvirt.h in the same
commit).  Also,

> +/**
> + * virDomainGetNumaParameters:
> + * @domain: pointer to domain object
> + * @params: pointer to numa parameter object
> + *          (return value, allocated by the caller)
> + * @nparams: pointer to number of numa parameters
> + * @flags: one of virDomainModificationImpact
> + *
> + * This function may require privileged access to the hypervisor. This function
> + * expects the caller to allocate the @params.

You didn't document how to set @params and @nparams.  So I squashed in:

diff --git i/src/libvirt.c w/src/libvirt.c
index e61d91e..574be16 100644
--- i/src/libvirt.c
+++ w/src/libvirt.c
@@ -3772,7 +3772,7 @@ error:
  * virDomainSetNumaParameters:
  * @domain: pointer to domain object
  * @params: pointer to numa parameter objects
- * @nparams: number of numa parameter (this value can be the same or
+ * @nparams: number of numa parameters (this value can be the same or
  *          less than the number of parameters supported)
  * @flags: bitwise-OR of virDomainModificationImpact
  *
@@ -3781,9 +3781,10 @@ error:
  *
  * Returns -1 in case of error, 0 in case of success.
  */
-int     virDomainSetNumaParameters(virDomainPtr domain,
-                                   virTypedParameterPtr params,
-                                   int nparams, unsigned int flags)
+int
+virDomainSetNumaParameters(virDomainPtr domain,
+                           virTypedParameterPtr params,
+                           int nparams, unsigned int flags)
 {
     virConnectPtr conn;

@@ -3812,7 +3813,8 @@ int     virDomainSetNumaParameters(virDomainPtr
domain,

     if (conn->driver->domainSetNumaParameters) {
         int ret;
-        ret = conn->driver->domainSetNumaParameters (domain, params,
nparams, flags);
+        ret = conn->driver->domainSetNumaParameters(domain, params,
nparams,
+                                                    flags);
         if (ret < 0)
             goto error;
         return ret;
@@ -3831,7 +3833,20 @@ error:
  * @params: pointer to numa parameter object
  *          (return value, allocated by the caller)
  * @nparams: pointer to number of numa parameters
- * @flags: one of virDomainModificationImpact
+ * @flags: bitwise-OR of virDomainModificationImpact and
virTypedParameterFlags
+ *
+ * Get all numa parameters.  On input, @nparams gives the size of the
+ * @params array; on output, @nparams gives how many slots were filled
+ * with parameter information, which might be less but will not exceed
+ * the input value.
+ *
+ * As a special case, calling with @params as NULL and @nparams as 0 on
+ * input will cause @nparams on output to contain the number of parameters
+ * supported by the hypervisor. The caller should then allocate @params
+ * array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call
the API
+ * again.
+ *
+ * See virDomainGetMemoryParameters() for an equivalent usage example.
  *
  * This function may require privileged access to the hypervisor. This
function
  * expects the caller to allocate the @params.
@@ -3869,7 +3884,8 @@ virDomainGetNumaParameters(virDomainPtr domain,

     if (conn->driver->domainGetNumaParameters) {
         int ret;
-        ret = conn->driver->domainGetNumaParameters (domain, params,
nparams, flags);
+        ret = conn->driver->domainGetNumaParameters(domain, params,
nparams,
+                                                    flags);
         if (ret < 0)
             goto error;
         return ret;

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

Attachment: signature.asc
Description: OpenPGP digital signature

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]