Support configuration of resource providers with config files

Resource providers can be configured using the API or CLI, or they
can also be configured on a per-compute node basis using config
files stored in /etc/nova/provider_config.

This patch adds support for a user defined list of provider config
files to be created on the compute nodes. This can be specified in
user_variables or perhaps more usefully in group_vars/host_vars.
A typical use case would be describing the resources made available
as a result of GPU or other hardware installed in a compute node.

Change-Id: I13d70a1030b1173b1bc051f00323e6fb0781872b
This commit is contained in:
Jonathan Rosser 2023-01-16 15:11:22 +00:00
parent e8049ceaea
commit b0fcbce66f
4 changed files with 51 additions and 0 deletions

View File

@ -406,6 +406,31 @@ nova_api_threads: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['proces
# "compute:create": ""
# "compute:create:attach_network": ""
## Resource provider vars
# Optionally specify a set of resource providers that a particular compute node exposes
# See https://docs.openstack.org/nova/latest/admin/managing-resource-providers.html
nova_provider_overrides: []
# nova_provider_overrides:
# - name: my_provider
# content:
# meta:
# schema_version: '1.0'
# providers:
# - identification:
# name: 'EXAMPLE_RESOURCE_PROVIDER'
# inventories:
# additional:
# - CUSTOM_EXAMPLE_RESOURCE_CLASS:
# total: 100
# reserved: 0
# min_unit: 1
# max_unit: 10
# step_size: 1
# allocation_ratio: 1.0
# traits:
# additional:
# - 'CUSTOM_EXAMPLE_TRAIT'
nova_service_in_ldap: "{{ service_ldap_backend_enabled | default(False) }}"
## libvirtd config options

View File

@ -0,0 +1,7 @@
---
features:
- |
Support is added to the os_nova ansible role to deploy resource provider
config files to nova compute nodes. This allows automatic configuraion
of resource providers without having to use the openstack API or
command line.

View File

@ -93,6 +93,22 @@
- nova-config
- nova-policy-override
- name: Implement compute host provider.yaml if there are overrides configured
openstack.config_template.config_template:
content: "{{ item.content }}"
dest: "/etc/nova/provider_config/{{ item.name }}.yaml"
owner: "root"
group: "{{ nova_system_group_name }}"
mode: 0640
config_type: yaml
with_items:
- "{{ nova_provider_overrides }}"
when:
- nova_services['nova-compute']['group'] in group_names
tags:
- nova-config
- nova-provider-override
- name: Remove legacy policy.yaml file
file:
path: "/etc/nova/policy.yaml"

View File

@ -93,6 +93,9 @@
state: link
force: true
condition: "{{ nova_install_method == 'source' }}"
- path: "/etc/nova/provider_config"
owner: "root"
mode: "0640"
- path: "/etc/sudoers.d"
mode: "0750"
owner: "root"