[libvirt] [PATCHv3 3/4] python: Use virNodeGetCPUMap where possible

Eric Blake eblake at redhat.com
Thu Nov 15 16:01:14 UTC 2012


On 11/13/2012 05:54 AM, Viktor Mihajlovski wrote:
> Modified the places where virNodeGetInfo was used for the purpose
> of obtaining the maximum node CPU number. Transparently falling
> back to virNodeGetInfo in case of failure.
> Wrote a utility function getPyNodeCPUCount for that purpose.
> 
> Signed-off-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
> ---
> V2 Changes:
> Implemented Eric Blake's suggestion to remove code bloat 
> introduced by first patch version.
> New helper function getPyNodeCPUCount is now used to calculate
> the number of node CPUs.
> 
>  python/libvirt-override.c | 87 ++++++++++++++++++++++++++++-------------------
>  1 file changed, 52 insertions(+), 35 deletions(-)
> 

> @@ -1599,23 +1620,19 @@ libvirt_virDomainGetVcpuPinInfo(PyObject *self ATTRIBUTE_UNUSED,
>                                  PyObject *args) {

>  
> -    LIBVIRT_BEGIN_ALLOW_THREADS;
> -    i_retval = virNodeGetInfo(virDomainGetConnect(domain), &nodeinfo);
> -    LIBVIRT_END_ALLOW_THREADS;
> -    if (i_retval < 0)
> -        return VIR_PY_NONE;
> +    if ((cpunum = getPyNodeCPUCount(virDomainGetConnect(domain))) < 0)
> +        return VIR_PY_INT_FAIL;

Oops - unintentional type change, due to too much copy-n-paste.

ACK with that fixed, and pushed.

-- 
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: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121115/f377f897/attachment-0001.sig>


More information about the libvir-list mailing list