<div dir="ltr">Hi Steve,<div><br></div><div>Thank you so much for your reply and detailed steps to go forward.</div><div><br></div><div>I am using devstack setup and nova master commit. As I could not able to see CPUPinningFilter implementation in source, I have used NUMATopologyFilter.</div><div><br></div><div>But same problem exists. I could not able to see any vcpupin in the guest xml. Please see the section of vcpu from xml below.</div><div><br></div><div><div><font color="#0000ff"><metadata></font></div><div><font color="#0000ff">    <nova:instance xmlns:nova="<a href="http://openstack.org/xmlns/libvirt/nova/1.0">http://openstack.org/xmlns/libvirt/nova/1.0</a>"></font></div><div><font color="#0000ff">      <nova:package version="2015.1"/></font></div><div><font color="#0000ff">      <nova:name>test_pinning</nova:name></font></div><div><font color="#0000ff">      <nova:creationTime>2014-12-29 07:30:04</nova:creationTime></font></div><div><font color="#0000ff">      <nova:flavor name="pinned.medium"></font></div><div><font color="#0000ff">        <nova:memory>2048</nova:memory></font></div><div><font color="#0000ff">        <nova:disk>20</nova:disk></font></div><div><font color="#0000ff">        <nova:swap>0</nova:swap></font></div><div><font color="#0000ff">        <nova:ephemeral>0</nova:ephemeral></font></div><div><font color="#0000ff">        <nova:vcpus>2</nova:vcpus></font></div><div><font color="#0000ff">      </nova:flavor></font></div><div><font color="#0000ff">      <nova:owner></font></div><div><font color="#0000ff">        <nova:user uuid="d72f55401b924e36ac88efd223717c75">admin</nova:user></font></div><div><font color="#0000ff">        <nova:project uuid="4904cdf59c254546981f577351b818de">admin</nova:project></font></div><div><font color="#0000ff">      </nova:owner></font></div><div><font color="#0000ff">      <nova:root type="image" uuid="fe017c19-6b4e-4625-93b1-2618dc5ce323"/></font></div><div><font color="#0000ff">    </nova:instance></font></div><div><font color="#0000ff">  </metadata></font></div><div><font color="#0000ff">  <memory unit='KiB'>2097152</memory></font></div><div><font color="#0000ff">  <currentMemory unit='KiB'>2097152</currentMemory></font></div><div><font color="#0000ff">  <vcpu placement='static' cpuset='0-3'>2</vcpu></font></div></div><div><font color="#0000ff"><br></font></div><div><font color="#000000">Kindly suggest me which branch of NOVA I need to take to validated pinning feature. Alse let me know CPUPinningFilter is required to validate pinning feature?</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Thanks a lot,</font></div><div><font color="#000000">Srinivas.</font></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 27, 2014 at 4:37 AM, Steve Gordon <span dir="ltr"><<a href="mailto:sgordon@redhat.com" target="_blank">sgordon@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">----- Original Message -----<br>
> From: "Srinivasa Rao Ragolu" <<a href="mailto:sragolu@mvista.com">sragolu@mvista.com</a>><br>
> To: "joejiang" <<a href="mailto:ifzing@126.com">ifzing@126.com</a>><br>
><br>
> Hi Joejing,<br>
><br>
> Thanks for quick reply. Above xml is getting generated fine if I set<br>
> "vcpu_pin_set=1-12" in /etc/nova/nova.conf.<br>
><br>
> But how to pin each vcpu with pcpu something like below<br>
><br>
> <cputune><br>
>    <vcpupin vcpu=‘0’ cpuset=‘1-5,12-17’/><br>
><br>
>    <vcpupin vcpu=‘1’ cpuset=‘2-3,12-17’/><br>
><br>
> </cputune><br>
><br>
><br>
> One more questions is Are Numa nodes are compulsory for pin each vcpu to<br>
> pcpu?<br>
<br>
</span>The specification for the CPU pinning functionality recently implemented in Nova is here:<br>
<br>
    <a href="http://specs.openstack.org/openstack/nova-specs/specs/kilo/approved/virt-driver-cpu-pinning.html" target="_blank">http://specs.openstack.org/openstack/nova-specs/specs/kilo/approved/virt-driver-cpu-pinning.html</a><br>
<br>
Note that exact vCPU to pCPU pinning is not exposed to the user as this would require them to have direct knowledge of the host pCPU layout. Instead they request that the instance receive "dedicated" CPU resourcing and Nova handles allocation of pCPUs and pinning of vCPUs to them.<br>
<br>
Example usage:<br>
<br>
* Create a host aggregate and add set metadata on it to indicate it is to be used for pinning, 'pinned' is used for the example but any key value can be used. The same key must used be used in later steps though::<br>
<br>
    $ nova aggregate-create cpu_pinning<br>
    $ nova aggregate-set-metadata 1 pinned=true<br>
<br>
  NB: For aggregates/flavors that wont be dedicated set pinned=false.<br>
<br>
* Set all existing flavors to avoid this aggregate::<br>
<br>
    $ for FLAVOR in `nova flavor-list | cut -f 2 -d ' ' | grep -o [0-9]*`; do nova flavor-key ${FLAVOR} set "aggregate_instance_extra_specs:pinned"="false"; done<br>
<br>
* Create flavor that has extra spec "hw:cpu_policy" set to "dedicated". In this example it is created with ID of 6, 2048 MB of RAM, 20 GB drive, and 2 vCPUs::<br>
<br>
    $ nova flavor-create pinned.medium 6 2048 20 2<br>
    $ nova flavor-key 6 set "hw:cpu_policy"="dedicated"<br>
<br>
* Set the flavor to require the aggregate set aside for dedicated pinning of guests::<br>
<br>
    $ nova flavor-key 6 set "aggregate_instance_extra_specs:pinned"="true"<br>
<br>
* Add a compute host to the created aggregate (see nova host-list to get the host name(s))::<br>
<br>
    $ nova aggregate-add-host 1 my_packstack_host_name<br>
<br>
* Add the AggregateInstanceExtraSpecsFilter and CPUPinningFilter filters to the scheduler_default_filters in /etc/nova.conf::<br>
<br>
    scheduler_default_filters = RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,<br>
                                ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,<br>
                                AggregateInstanceExtraSpecsFilter,CPUPinningFilter<br>
<br>
  NB: On Kilo code base I believe the filter is NUMATopologyFilter<br>
<br>
* Restart the scheduler::<br>
<br>
    # systemctl restart openstack-nova-scheduler<br>
<br>
* After the above - with a normal (non-admin user) try to boot an instance with the newly created flavor::<br>
<br>
    $ nova boot --image fedora --flavor 6 test_pinning<br>
<br>
* Confirm the instance has succesfully booted and that it's vCPU's are pinned to _a single_ host CPU by observing<br>
  the <cputune> element of the generated domain XML::<br>
<br>
    # virsh list<br>
     Id    Name                           State<br>
    ----------------------------------------------------<br>
     2     instance-00000001              running<br>
    # virsh dumpxml instance-00000001<br>
    ...<br>
    <vcpu placement='static' cpuset='0-3'>2</vcpu><br>
      <cputune><br>
        <vcpupin vcpu='0' cpuset='0'/><br>
        <vcpupin vcpu='1' cpuset='1'/><br>
    </cputune><br>
<br>
<br>
-Steve<br>
<br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</blockquote></div><br></div>