[libvirt-users] Question on CPU pinning in Python

Stanley, Jon [Tech] Jon.Stanley at gs.com
Wed Sep 22 19:51:23 UTC 2010


Looking at the python API, once I have a domain object I can call domain.pinVcpu to pin a specific vcpu to a physical CPU. I found http://www.mail-archive.com/libvir-list@redhat.com/msg04562.html which mentioned some changes to the C API in the Python implementation, and was wondering if my understanding is correct.

Say that I have a host system with 16 logical CPU's, 0-15. If I wanted to pin vcpu1 of a domain to CPUs 2 and 4, I would pass:

domain.pinVcpu(1, (False, False, True, False, True, False....[and so on til I have 16 things]))

In other words, pinVcpu accepts as arguments the vCPU that I wish to act on, and a 16 (or however many CPU's are present on the host) item tuple of True/False values, in the same order as the CPU's I wish to mask (for example, item 0 of the tuple represents CPU0), True meaning that the vCPU thread is allowed to run there, and False meaning that it is not.

Just looking to confirm that my understanding of this call is correct.

Thanks!
-Jon





More information about the libvirt-users mailing list