This change separates CaaS default allocation from platform allocation by making an own CPU allocation for it.
Change-Id: I443e8df96b27d9734ae01f5638ec2360987c9803
Signed-off-by: Krisztian Lengyel <krisztian.lengyel@nokia.com>
# limitations under the License.
# Number of platform CPUs to allocate per service by default.
-cloud_default_platform_cpus:
+platform_cpus:
default:
controller:
own: 1
compute:
shared: 1
caas_master:
- own: 2
+ shared: 1
caas_worker:
- own: 1
+ shared: 1
single:
controller:
own: 1
compute:
shared: 1
caas_master:
- own: 1
+ shared: 1
caas_worker:
- own: 1
+ shared: 1
virtual:
controller:
shared: 2
compute:
shared: 1
caas_master:
- shared: 2
+ shared: 1
caas_worker:
shared: 1
+caas_default_pool_cpus:
+ default:
+ caas_master:
+ own: 2
+ caas_worker:
+ own: 1
+ single:
+ caas_master:
+ own: 2
+ caas_worker:
+ own: 1
+ virtual:
+ caas_master:
+ own: 2
+ caas_worker:
+ own: 1
+
caas_service_profiles:
- caas_master
- caas_worker
-allocation_fact_file: "/etc/ansible/facts.d/cloud_cpu_allocation.fact"
+allocation_fact_file: "/etc/ansible/facts.d/cpu_allocation.fact"
cpu_set_mapping:
ovs_dpdk:
opt: exclusive_pool_percentage
caas_shared:
opt: shared_pool_percentage
+
+caas_cpu_pool_share_default: 50
---
-
# Copyright 2019 Nokia
# Licensed under the Apache License, Version 2.0 (the "License");
- name: Prepare.
set_fact:
- cloud_cpu_remain: []
- cloud_cpu_sets: {}
+ cpu_remain: []
+ cpu_sets: {}
- name: Get CPU topology.
get_cpu_topology:
- var: cloud_cpu_topology
+ var: cpu_topology
- debug:
- var: cloud_cpu_topology
+ var: cpu_topology
- name: Make default performance profile.
set_fact:
perf_profile: {
- platform_cpus: "{{ cloud_cpu_topology | cpu_topology_defaults(hosts[hostname]['service_profiles'], cloud_default_platform_cpus, virtual_env, hosts | length < 2) }}"
+ platform_cpus: "{{ cpu_topology | cpu_topology_defaults(hosts[hostname]['service_profiles'], platform_cpus, virtual_env, hosts | length < 2) }}"
}
- debug:
var: perf_profile
- name: Set collocated VM CPU set.
set_fact:
- vm_share_percent: "{{ 100 - (perf_profile['caas_cpu_pool_share'] | default(100) | int) }}"
+ vm_share_percent: "{{ 100 - (perf_profile['caas_cpu_pool_share'] | default(caas_cpu_pool_share_default) | int) }}"
when:
- "'compute' in hosts[hostname]['service_profiles']"
- hosts[hostname]['service_profiles'] | intersect(caas_service_profiles)
loop_control:
loop_var: cpu_set
with_items:
- - { 'name': 'vm', 'request': "{{ cloud_cpu_topology | get_cpu_count_by_percent(vm_share_percent) }}", 'where': 'tail' }
+ - { 'name': 'vm', 'request': "{{ cpu_topology | get_cpu_count_by_percent(vm_share_percent) }}", 'where': 'tail' }
when:
- "'compute' in hosts[hostname]['service_profiles']"
+- name: Make CaaS default CPU set.
+ include_tasks: make_cpu_sets.yaml
+ loop_control:
+ loop_var: cpu_set
+ with_items:
+ - { 'name': 'caas_default', 'request': "{{ cpu_topology | cpu_topology_defaults(hosts[hostname]['service_profiles'], caas_default_pool_cpus, virtual_env, hosts | length < 2) }}", 'where': 'tail' }
+ when:
+ - hosts[hostname]['service_profiles'] | intersect(caas_service_profiles)
+
- name: Calculate CaaS CPU counts
set_fact:
- perf_profile: "{{ perf_profile | combine({ item.key: cloud_cpu_topology | get_cpu_count_by_percent(item.value) }) }}"
+ perf_profile: "{{ perf_profile | combine({ item.key: cpu_topology | get_cpu_count_by_percent(item.value) }) }}"
with_dict: "{{ perf_profile['caas_cpu_pools'] | default({}) }}"
when: hosts[hostname]['service_profiles'] | intersect(caas_service_profiles)
- name: Make set of remaining CPUs.
set_fact:
- cloud_cpu_remain: "{{ cloud_cpu_remain | union(item) }}"
- with_items: "{{ cloud_cpu_topology.values() }}"
+ cpu_remain: "{{ cpu_remain | union(item) }}"
+ with_items: "{{ cpu_topology.values() }}"
- debug:
- var: cloud_cpu_remain
+ var: cpu_remain
+
+- name: Allocate remaining CPUs to CaaS default.
+ set_fact:
+ cpu_sets: "{{ cpu_sets | combine({ 'caas_default': cpu_sets['caas_default'] | default([]) | union(cpu_remain) }) }}"
+ cpu_remain: []
+ when:
+ - "cpu_remain | length > 0"
+ - hosts[hostname]['service_profiles'] | intersect(caas_service_profiles)
- name: Allocate remaining CPUs to platform.
set_fact:
- cloud_cpu_sets: "{{ cloud_cpu_sets | combine({ 'platform': cloud_cpu_sets['platform'] | default([]) | union(cloud_cpu_remain) }) }}"
- cloud_cpu_remain: []
- when: "cloud_cpu_remain | length > 0"
+ cpu_sets: "{{ cpu_sets | combine({ 'platform': cpu_sets['platform'] | default([]) | union(cpu_remain) }) }}"
+ cpu_remain: []
+ when:
+ - "cpu_remain | length > 0"
+ - not hosts[hostname]['service_profiles'] | intersect(caas_service_profiles)
- debug:
- var: cloud_cpu_sets
+ var: cpu_sets
- name: Make sure facts directory exists.
file:
- name: Save CPU allocation.
template:
- src: cloud_cpu_allocation.fact.j2
+ src: cpu_allocation.fact.j2
dest: "{{ allocation_fact_file }}"
register: cpu_allocation
---
-# Copyright (C) 2019 Nokia
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
- name: Set requested CPUs.
set_fact:
- name: Allocate CPU set.
set_fact:
- allocated_cpu_set: "{{ cloud_cpu_topology | cpu_topology_alloc(cpu_request, cpu_set.where) }}"
+ allocated_cpu_set: "{{ cpu_topology | cpu_topology_alloc(cpu_request, cpu_set.where) }}"
- name: Append allocated CPU set.
set_fact:
- combined_cpu_set: "{{ allocated_cpu_set | union(cloud_cpu_sets[cpu_set.name] | default([])) | sort }}"
+ combined_cpu_set: "{{ allocated_cpu_set | union(cpu_sets[cpu_set.name] | default([])) | sort }}"
- name: Make CPU set.
set_fact:
- cloud_cpu_sets: "{{ cloud_cpu_sets | combine({ cpu_set.name: combined_cpu_set }) }}"
- cloud_cpu_topology: "{{ cloud_cpu_topology | cpu_topology_trim(cpu_request, cpu_set.where) }}"
+ cpu_sets: "{{ cpu_sets | combine({ cpu_set.name: combined_cpu_set }) }}"
+ cpu_topology: "{{ cpu_topology | cpu_topology_trim(cpu_request, cpu_set.where) }}"
- name: Show created CPU sets.
debug:
- var: cloud_cpu_sets
+ var: cpu_sets
- name: Show CPU topology after sets creation.
debug:
- var: cloud_cpu_topology
+ var: cpu_topology
+++ /dev/null
-{# Copyright (C) 2018 Nokia #}
-{
-{% for s in cloud_cpu_sets %}
- "{{ s }}": {
- "set" : {{ cloud_cpu_sets[s] | sort }},
- "list": "{{ cloud_cpu_sets[s] | set_to_cpulist }}"
- }{{ "," if not loop.last else "" }}
-{% endfor %}
-}
--- /dev/null
+{#
+Copyright 2019 Nokia
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+#}
+{
+{% for s in cpu_sets %}
+ "{{ s }}": {
+ "set" : {{ cpu_sets[s] | sort }},
+ "list": "{{ cpu_sets[s] | set_to_cpulist }}"
+ }{{ "," if not loop.last else "" }}
+{% endfor %}
+}
- name: Get configuration.
set_fact:
perf_profile: "{{ performance_profiles[hosts[hostname]['performance_profiles'][0]] if 'performance_profiles' in hosts[hostname] else {} }}"
- cpu_alloc: "{{ ansible_local.cloud_cpu_allocation | default([]) }}"
+ cpu_alloc: "{{ ansible_local.cpu_allocation | default([]) }}"
- debug:
var: perf_profile
- debug:
- debug:
msg:
- - "DPDK cores {{ ansible_local.cloud_cpu_allocation['ovs_dpdk']['list'] }}"
- - "Platform cores {{ ansible_local.cloud_cpu_allocation['platform']['list'] }}"
+ - "DPDK cores {{ ansible_local.cpu_allocation['ovs_dpdk']['list'] }}"
+ - "Platform cores {{ ansible_local.cpu_allocation['platform']['list'] }}"
- "Host VPUs {{ansible_processor_vcpus}}, Processor cores {{ansible_processor_cores}}"
- "Threads per core {{ansible_processor_threads_per_core}}, Sockets {{ansible_processor_count}}"
script: >
configure_ovsdpdk.py --cores {{ansible_processor_vcpus}} --pcore {{ansible_processor_cores}}
--tcore {{ansible_processor_threads_per_core}} --sockets {{ansible_processor_count}}
- --dpdkcores {{ ansible_local.cloud_cpu_allocation['ovs_dpdk']['list'] }}
+ --dpdkcores {{ ansible_local.cpu_allocation['ovs_dpdk']['list'] }}
register: result
changed_when: result.rc == 0
failed_when: result.rc == 2
# limitations under the License.
- name: Set vcpu_pin_set
- ini_file: dest=/etc/nova/nova.conf section=DEFAULT option=vcpu_pin_set value={{ ansible_local.cloud_cpu_allocation['vm']['list'] }} backup=no
+ ini_file: dest=/etc/nova/nova.conf section=DEFAULT option=vcpu_pin_set value={{ ansible_local.cpu_allocation['vm']['list'] }} backup=no
register: nova1_result
- name: Get performance profile configuration