Add Nova config for os_ironic role

This patch configures Nova for use with Ironic, noting that
without moving to cells, an openstack-ansible install can support
only one type of hypervisor at a time (i.e. kvm or ironic etc).
Setting the nova_virt_type determines whether Nova is configured
for Ironic. If it is left unset, the default kvm hypervisor
is used.

The nova virtualization types have all been moved into a single
nova_virt_types data structure which is used to define facts
for a specific supported virtualization type. This change is
compatible with older versions of overrides as the virt type
values are used to set host facts which could also be set
using user variables or any other means to predefine a default
value.

Change-Id: Ic8160fa00457d68ee223452f4dae6d38bffcdca0
Signed-off-by: Michael Davies <michael@the-davies.net>
Partially-implements: blueprint role-ironic
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Michael Davies 2016-03-16 08:42:26 +00:00
parent a29d162c3c
commit e2fc4b7b96
3 changed files with 67 additions and 5 deletions

View File

@ -90,8 +90,42 @@ nova_rpc_thread_pool_size: 64
nova_rpc_conn_pool_size: 30
nova_rpc_response_timeout: 60
## Nova virtualization Type, set to KVM if supported
# Current supported choice: qemu or kvm
## Nova virtualization Types
# The nova_virt_types dictionary contains global overrides used for
# specific compute types. Every variable inside of this dictionary
# will become an ansible fact. This gives the user the option to set
# or customize things based on their needs without having to redefine
# this entire data structure. Every supported compute type will be
# have its specific variable requirements set under its short name.
nova_virt_types:
ironic:
nova_compute_driver: nova.virt.ironic.IronicDriver
nova_scheduler_host_manager: nova.scheduler.ironic_host_manager.IronicHostManager
nova_reserved_host_memory_mb: 0
# NOTE(mrda): It's possible to use ironic.nova.compute.manager.ClusteredComputeManager
# here, but at the current time it's not recommended
nova_compute_manager: nova.compute.manager.ComputeManager
nova_firewall_driver: nova.virt.firewall.NoopFirewallDriver
nova_scheduler_use_baremetal_filters: True
nova_scheduler_tracks_instance_changes: False
kvm:
nova_compute_driver: libvirt.LibvirtDriver
nova_scheduler_host_manager: nova.scheduler.host_manager.HostManager
nova_reserved_host_memory_mb: 2048
nova_compute_manager: nova.compute.manager.ComputeManager
nova_firewall_driver: nova.virt.firewall.NoopFirewallDriver
nova_scheduler_use_baremetal_filters: False
nova_scheduler_tracks_instance_changes: True
qemu:
nova_compute_driver: libvirt.LibvirtDriver
nova_scheduler_host_manager: nova.scheduler.host_manager.HostManager
nova_reserved_host_memory_mb: 2048
nova_compute_manager: nova.compute.manager.ComputeManager
nova_firewall_driver: nova.virt.firewall.NoopFirewallDriver
nova_scheduler_use_baremetal_filters: False
nova_scheduler_tracks_instance_changes: True
# Current supported choice: qemu or kvm or ironic
# If this is not set, then the playbook will try to guess it.
#nova_virt_type: kvm
@ -166,6 +200,7 @@ nova_enable_instance_password: True
nova_compute_program_name: nova-compute
nova_force_config_drive: False
## Nova libvirt
nova_libvirt_inject_key: False
# inject partition options:
@ -200,8 +235,8 @@ nova_secure_proxy_ssl_header: HTTP_X_FORWARDED_PROTO
## Nova global config
nova_cpu_mode: host-model
nova_linuxnet_interface_driver: nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver
nova_firewall_driver: nova.virt.firewall.NoopFirewallDriver
nova_compute_driver: libvirt.LibvirtDriver
nova_max_age: 0
nova_remove_unused_resized_minimum_age_seconds: 3600
nova_image_cache_manager_interval: 0
@ -235,7 +270,7 @@ nova_max_io_ops_per_host: 10
nova_ram_allocation_ratio: 1.0
nova_ram_weight_multiplier: 5.0
nova_reserved_host_disk_mb: 2048
nova_reserved_host_memory_mb: 2048
nova_scheduler_driver_task_period: 60
nova_scheduler_host_subset_size: 10
nova_scheduler_max_attempts: 5
@ -342,6 +377,7 @@ nova_requires_pip_packages:
nova_compute_pip_packages:
- libvirt-python
- python-ironicclient
# Common pip packages
nova_pip_packages:

View File

@ -13,6 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE(cloudnull) this task is not in dict formation because it is
# dynamically loading facts from the nova_virt_types based on the
# nova_virt_type setting.
- name: Set nova config facts
set_fact: '{{ item.key }}="{{ item.value }}"'
with_dict: "{{ nova_virt_types[nova_virt_type] }}"
when:
- item.key not in hostvars[inventory_hostname] or item.key is undefined
tags:
- nova-config
- nova-post-install
- name: Generate nova config
config_template:
src: "{{ item.src }}"

View File

@ -52,6 +52,8 @@ scheduler_host_manager = {{ nova_scheduler_host_manager }}
scheduler_host_subset_size = {{ nova_scheduler_host_subset_size }}
scheduler_max_attempts = {{ nova_scheduler_max_attempts }}
scheduler_weight_classes = {{ nova_scheduler_weight_classes }}
scheduler_use_baremetal_filters = {{ nova_scheduler_use_baremetal_filters }}
scheduler_tracks_instance_changes = {{ nova_scheduler_tracks_instance_changes }}
# Compute
enable_instance_password = {{ nova_enable_instance_password }}
@ -62,6 +64,7 @@ api_paste_config = /etc/nova/api-paste.ini
allow_resize_to_same_host = True
image_cache_manager_interval = {{ nova_image_cache_manager_interval }}
resume_guests_state_on_host_boot = {{ nova_resume_guests_state_on_host_boot }}
compute_manager = {{ nova_compute_manager }}
{% if nova_console_user_ssl_cert is defined and nova_console_user_ssl_key is defined and inventory_hostname in groups['nova_console'] %}
# Console SSL keys
@ -236,6 +239,17 @@ rabbit_hosts = {{ rabbitmq_servers }}
rabbit_use_ssl = {{ rabbitmq_use_ssl }}
{% if nova_virt_type == 'ironic' %}
[ironic]
# TODO(mrda): These should be changed to support the Keystone v3 API
admin_username = {{ ironic_service_name }}
admin_password = {{ ironic_service_password }}
admin_tenant_name = {{ ironic_service_project_name }}
admin_url = {{ keystone_service_adminuri }}/v2.0
api_endpoint = {{ ironic_service_adminurl }}
{% endif %}
[libvirt]
inject_partition = {{ nova_libvirt_inject_partition }}
inject_password = {{ nova_libvirt_inject_password }}