Implement nova placement service

Closes-Bug: #1660987
Depends-On: I30efc20e6d918e08860584c017455e6d5fa91a35
Change-Id: If0a79b6013f28871dc9f13c510c919078f3304d5
This commit is contained in:
Jeffrey Zhang 2017-02-01 21:46:32 +08:00 committed by Jeffrey Zhang
parent 68d3d8ba29
commit facfabf3bb
12 changed files with 179 additions and 0 deletions

View File

@ -172,6 +172,8 @@ glance_registry_port: "9191"
octavia_api_port: "9876" octavia_api_port: "9876"
octavia_health_manager_port: "5555" octavia_health_manager_port: "5555"
placement_api_port: "8780"
nova_api_port: "8774" nova_api_port: "8774"
nova_metadata_port: "8775" nova_metadata_port: "8775"
nova_novncproxy_port: "6080" nova_novncproxy_port: "6080"

View File

@ -175,6 +175,9 @@ control
[designate:children] [designate:children]
control control
[placement:children]
control
# Additional control implemented here. These groups allow you to control which # Additional control implemented here. These groups allow you to control which
# services run on which hosts at a per-service level. # services run on which hosts at a per-service level.
# #
@ -511,3 +514,7 @@ designate
[designate-backend-bind9:children] [designate-backend-bind9:children]
designate designate
# Placement
[placement-api:children]
placement

View File

@ -192,6 +192,9 @@ control
[designate:children] [designate:children]
control control
[placement:children]
control
# Additional control implemented here. These groups allow you to control which # Additional control implemented here. These groups allow you to control which
# services run on which hosts at a per-service level. # services run on which hosts at a per-service level.
# #
@ -528,3 +531,7 @@ designate
[designate-backend-bind9:children] [designate-backend-bind9:children]
designate designate
# Placement
[placement-api:children]
placement

View File

@ -115,6 +115,13 @@ listen nova_metadata
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ nova_metadata_port }} check inter 2000 rise 2 fall 5 server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ nova_metadata_port }} check inter 2000 rise 2 fall 5
{% endfor %} {% endfor %}
listen placement_api
bind {{ kolla_internal_vip_address }}:{{ placement_api_port }}
http-request del-header X-Forwarded-Proto
{% for host in groups['placement-api'] %}
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ placement_api_port }} check inter 2000 rise 2 fall 5
{% endfor %}
{% if nova_console == 'novnc' %} {% if nova_console == 'novnc' %}
listen nova_novncproxy listen nova_novncproxy
bind {{ kolla_internal_vip_address }}:{{ nova_novncproxy_port }} bind {{ kolla_internal_vip_address }}:{{ nova_novncproxy_port }}
@ -156,6 +163,14 @@ listen nova_metadata_external
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ nova_metadata_port }} check inter 2000 rise 2 fall 5 server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ nova_metadata_port }} check inter 2000 rise 2 fall 5
{% endfor %} {% endfor %}
listen placement_api_external
bind {{ kolla_internal_vip_address }}:{{ placement_api_port }}
http-request del-header X-Forwarded-Proto
http-request set-header X-Forwarded-Proto https if { ssl_fc }
{% for host in groups['placement-api'] %}
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ placement_api_port }} check inter 2000 rise 2 fall 5
{% endfor %}
{% if nova_console == 'novnc' %} {% if nova_console == 'novnc' %}
listen nova_novncproxy_external listen nova_novncproxy_external
bind {{ kolla_external_vip_address }}:{{ nova_novncproxy_port }} {{ tls_bind_info }} bind {{ kolla_external_vip_address }}:{{ nova_novncproxy_port }} {{ tls_bind_info }}

View File

@ -33,6 +33,15 @@ nova_services:
- "nova_compute:/var/lib/nova" - "nova_compute:/var/lib/nova"
- "/var/lib/nova/mnt:/var/lib/nova/mnt:shared" - "/var/lib/nova/mnt:/var/lib/nova/mnt:shared"
- "heka_socket:/var/lib/kolla/heka/" - "heka_socket:/var/lib/kolla/heka/"
placement-api:
container_name: "placement_api"
group: "placement-api"
image: "{{ placement_api_image_full }}"
enabled: True
volumes:
- "{{ node_config_directory }}/placement-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
nova-api: nova-api:
container_name: "nova_api" container_name: "nova_api"
group: "nova-api" group: "nova-api"
@ -200,6 +209,10 @@ nova_serialproxy_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{
nova_serialproxy_tag: "{{ openstack_release }}" nova_serialproxy_tag: "{{ openstack_release }}"
nova_serialproxy_image_full: "{{ nova_serialproxy_image }}:{{ nova_serialproxy_tag }}" nova_serialproxy_image_full: "{{ nova_serialproxy_image }}:{{ nova_serialproxy_tag }}"
placement_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-placement-api"
placement_api_tag: "{{ openstack_release }}"
placement_api_image_full: "{{ placement_api_image }}:{{ placement_api_tag }}"
#################### ####################
# OpenStack # OpenStack
#################### ####################
@ -211,8 +224,14 @@ nova_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ nova_a
nova_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ nova_api_port }}/v2.1/%(tenant_id)s" nova_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ nova_api_port }}/v2.1/%(tenant_id)s"
nova_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ nova_api_port }}/v2.1/%(tenant_id)s" nova_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ nova_api_port }}/v2.1/%(tenant_id)s"
placement_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ placement_api_port }}"
placement_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ placement_api_port }}"
placement_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ placement_api_port }}"
nova_logging_debug: "{{ openstack_logging_debug }}" nova_logging_debug: "{{ openstack_logging_debug }}"
openstack_nova_auth: "{{ openstack_auth }}" openstack_nova_auth: "{{ openstack_auth }}"
openstack_placement_auth: "{{ openstack_auth }}"
nova_ssh_port: "8022" nova_ssh_port: "8022"

View File

@ -46,6 +46,30 @@
or nova_libvirt_confs.changed | bool or nova_libvirt_confs.changed | bool
or nova_libvirt_container.changed | bool or nova_libvirt_container.changed | bool
- name: Restart placement-api container
vars:
service_name: "placement-api"
service: "{{ nova_services[service_name] }}"
config_json: "{{ config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
nova_conf: "{{ nova_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_json: "{{ policy_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
placement_api_container: "{{ check_nova_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
when:
- action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or nova_conf.changed | bool
or policy_json.changed | bool
or placement_api_wsgi_conf | changed
or placement_api_container.changed | bool
- name: Restart nova-api container - name: Restart nova-api container
vars: vars:
service_name: "nova-api" service_name: "nova-api"

View File

@ -35,6 +35,7 @@
- name: Copying over nova.conf - name: Copying over nova.conf
vars: vars:
services_require_nova_conf: services_require_nova_conf:
- placement-api
- nova-api - nova-api
- nova-compute - nova-compute
- nova-compute-ironic - nova-compute-ironic
@ -81,6 +82,19 @@
notify: notify:
- Restart nova-libvirt container - Restart nova-libvirt container
- name: Copying over placement-api wsgi configuration
vars:
service: "{{ nova_services['placement-api'] }}"
template:
src: "placement-api-wsgi.conf.j2"
dest: "{{ node_config_directory }}/placement-api/placement-api-wsgi.conf"
register: placement_api_wsgi_conf
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
notify:
- Restart placement-api container
- name: Copying files for nova-ssh - name: Copying files for nova-ssh
vars: vars:
service: "{{ nova_services['nova-ssh'] }}" service: "{{ nova_services['nova-ssh'] }}"
@ -106,6 +120,7 @@
- name: Copying over existing policy.json - name: Copying over existing policy.json
vars: vars:
services_require_policy_json: services_require_policy_json:
- placement-api
- nova-api - nova-api
- nova-compute - nova-compute
- nova-compute-ironic - nova-compute-ironic

View File

@ -25,6 +25,10 @@
- {'name': 'nova', 'service_type': 'compute', 'interface': 'admin', 'url': '{{ nova_admin_endpoint }}', 'description': 'OpenStack Compute Service'} - {'name': 'nova', 'service_type': 'compute', 'interface': 'admin', 'url': '{{ nova_admin_endpoint }}', 'description': 'OpenStack Compute Service'}
- {'name': 'nova', 'service_type': 'compute', 'interface': 'internal', 'url': '{{ nova_internal_endpoint }}', 'description': 'OpenStack Compute Service'} - {'name': 'nova', 'service_type': 'compute', 'interface': 'internal', 'url': '{{ nova_internal_endpoint }}', 'description': 'OpenStack Compute Service'}
- {'name': 'nova', 'service_type': 'compute', 'interface': 'public', 'url': '{{ nova_public_endpoint }}', 'description': 'OpenStack Compute Service'} - {'name': 'nova', 'service_type': 'compute', 'interface': 'public', 'url': '{{ nova_public_endpoint }}', 'description': 'OpenStack Compute Service'}
- {'name': 'placement', 'service_type': 'placement', 'interface': 'admin', 'url': '{{ placement_admin_endpoint }}', 'description': 'Placement Service'}
- {'name': 'placement', 'service_type': 'placement', 'interface': 'internal', 'url': '{{ placement_internal_endpoint }}', 'description': 'Placement Service'}
- {'name': 'placement', 'service_type': 'placement', 'interface': 'public', 'url': '{{ placement_public_endpoint }}', 'description': 'Placement Service'}
- name: Creating the Nova project, user, and role - name: Creating the Nova project, user, and role
kolla_toolbox: kolla_toolbox:
@ -43,3 +47,21 @@
retries: 10 retries: 10
delay: 5 delay: 5
run_once: True run_once: True
- name: Creating the placement project, user, and role
kolla_toolbox:
module_name: "kolla_keystone_user"
module_args:
project: "service"
user: "placement"
password: "{{ placement_keystone_password }}"
role: "admin"
region_name: "{{ openstack_region_name }}"
auth: "{{ '{{ openstack_placement_auth }}' }}"
module_extra_vars:
openstack_placement_auth: "{{ openstack_placement_auth }}"
register: placement_user
until: placement_user|success
retries: 10
delay: 5
run_once: True

View File

@ -215,3 +215,13 @@ api_paste_config = /etc/nova/api-paste.ini
[scheduler] [scheduler]
max_attempts = 10 max_attempts = 10
[placement]
auth_type = password
auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }}
username = placement
password = {{ placement_keystone_password }}
user_domain_name = default
project_name = service
project_domain_name = default
os_region_name = {{ openstack_region_name }}

View File

@ -0,0 +1,23 @@
{% set log_dir = '/var/log/kolla/nova' %}
{% set python_path = '/usr/lib/python2.7/site-packages' if kolla_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %}
{% set wsgi_directory = '/usr/bin' if kolla_install_type == 'binary' else '/var/lib/kolla/venv/bin' %}
Listen {{ api_interface_address }}:{{ placement_api_port }}
<VirtualHost *:{{ placement_api_port }}>
WSGIDaemonProcess placement-api processes={{ openstack_service_workers }} threads=1 user=nova group=nova display-name=%{GROUP} python-path={{ python_path }}
WSGIProcessGroup placement-api
WSGIScriptAlias / {{ wsgi_directory }}/nova-placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
ErrorLog "{{ log_dir }}/placement-api.log"
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat
CustomLog "{{ log_dir }}/placement-api-access.log" logformat
<Directory {{ wsgi_directory }}>
<Files nova-placement-api>
Require all granted
</Files>
</Directory>
</VirtualHost>

View File

@ -0,0 +1,33 @@
{% set apache_binary = 'apache2' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd' %}
{% set apache_conf_dir = 'apache2/conf-enabled' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd/conf.d' %}
{
"command": "/usr/sbin/{{ apache_binary }} -DFOREGROUND",
"config_files": [
{
"source": "{{ container_config_directory }}/nova.conf",
"dest": "/etc/nova/nova.conf",
"owner": "nova",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/policy.json",
"dest": "/etc/nova/policy.json",
"owner": "nova",
"perm": "0600",
"optional": true
},
{
"source": "{{ container_config_directory }}/placement-api-wsgi.conf",
"dest": "/etc/{{ apache_conf_dir }}/placement-api-wsgi.conf",
"owner": "nova",
"perm": "0644"
}
],
"permissions": [
{
"path": "/var/log/kolla/nova",
"owner": "nova:nova",
"recurse": true
}
]
}

View File

@ -49,6 +49,8 @@ nova_database_password:
nova_api_database_password: nova_api_database_password:
nova_keystone_password: nova_keystone_password:
placement_keystone_password:
neutron_database_password: neutron_database_password:
neutron_keystone_password: neutron_keystone_password:
metadata_secret: metadata_secret: