Hi all, I am working with libvirt and I am trying to set cpu affinity. Now I can always use virsh vcpupin <domain_name> <vcpu> <pcpu> to pin vcpus to pcpus. I want to do it using Python API. Now, there is function pinVcpu which is supposed to do that. But this is not working. For example I gave dom.pinVcpu(0,1) but still my vcpu affinity is for all the pcpus. The function returns 0 (success). Any idea what am I doing wrong? Thanks. ~Peeyush Gupta
Hi Peeyush, If we want to pin vcpu1 of a domain to CPUs 3 and 4, we need to pass: dom.pinVcpu(1, (False, False, False, True, True, False....[and so on, til number of logical CPUs of host])) Can you please check this? Regards, Saurabh Deochake [NTT DATA] On Fri, Jul 19, 2013 at 11:45 AM, Peeyush Gupta <gpeeyush@ymail.com> wrote:> Hi all, > > I am working with libvirt and I am trying to set cpu affinity. Now I can > always use > > virsh vcpupin <domain_name> <vcpu> <pcpu> > > to pin vcpus to pcpus. I want to do it using Python API. Now, there is > function pinVcpu which is supposed to do that. But this is not working. For > example I gave > > dom.pinVcpu(0,1) > > but still my vcpu affinity is for all the pcpus. The function returns 0 > (success). > Any idea what am I doing wrong? > > Thanks. > > ~Peeyush Gupta > > _______________________________________________ > libvirt-users mailing list > libvirt-users@redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-users >
Hi Saurabh, I checked that out and it's working. Looks like I wasn't able to understand how to define cpumap. Anyways, thanks for your answer. ~Peeyush Gupta ________________________________ From: Saurabh Deochake <saurabh.d04@gmail.com> To: Peeyush Gupta <gpeeyush@ymail.com> Cc: "libvirt-users@redhat.com" <libvirt-users@redhat.com> Sent: Saturday, 27 July 2013 2:13 PM Subject: Re: [libvirt-users] pinVcpu not working Hi Peeyush, If we want to pin vcpu1 of a domain to CPUs 3 and 4, we need to pass: dom.pinVcpu(1, (False, False, False, True, True, False....[and so on, til number of logical CPUs of host])) Can you please check this? Regards, Saurabh Deochake [NTT DATA] On Fri, Jul 19, 2013 at 11:45 AM, Peeyush Gupta <gpeeyush@ymail.com> wrote: Hi all,> > >I am working with libvirt and I am trying to set cpu affinity. Now I can always use > > > virsh vcpupin <domain_name> <vcpu> <pcpu> > > >to pin vcpus to pcpus. I want to do it using Python API. Now, there is function pinVcpu which is supposed to do that. But this is not working. For example I gave > > > dom.pinVcpu(0,1) > > >but still my vcpu affinity is for all the pcpus. The function returns 0 (success). >Any idea what am I doing wrong? > > >Thanks. >~Peeyush Gupta >_______________________________________________ >libvirt-users mailing list >libvirt-users@redhat.com >https://www.redhat.com/mailman/listinfo/libvirt-users >