Wait for nova-compute service registration
A race condition is caused when nova-compute is started for the first time because it takes a period of time for nova-compute to spin up, register itself with nova API, and become available for cell enrollment. Prior to this there was no wait condition when nova-compute restarts occurred, so the first time nova-compute started, often the compute service was not registered in the database and available for cell enrollment when the enrollment tasks ran. Change-Id: I510f0a957f53d15affa1fc23f809abff52208438
This commit is contained in:
parent
46c1576c1e
commit
b9b8e08ac0
@ -457,6 +457,7 @@ nova_requires_pip_packages:
|
||||
- virtualenv-tools
|
||||
- python-keystoneclient # Keystoneclient needed to OSA keystone lib
|
||||
- httplib2
|
||||
- python-openstackclient
|
||||
|
||||
nova_compute_pip_packages:
|
||||
- libvirt-python
|
||||
|
@ -23,6 +23,7 @@
|
||||
name: "{{ item.value.service_name }}"
|
||||
state: "restarted"
|
||||
with_dict: "{{ nova_services }}"
|
||||
register: nova_service_restart
|
||||
when:
|
||||
- inventory_hostname in groups[item.value.group]
|
||||
- "{{ item.value.condition | default(true) }}"
|
||||
|
@ -85,6 +85,13 @@
|
||||
- name: Flush handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- include: nova_compute_wait.yml
|
||||
when:
|
||||
- "{{ 'nova_compute' in group_names }}"
|
||||
- "{{ nova_service_restart | default(dict(changed=False)) | changed }}"
|
||||
tags:
|
||||
- nova-config
|
||||
|
||||
- include: nova_db_post_setup.yml
|
||||
when: inventory_hostname == groups['nova_api_os_compute'][0]
|
||||
tags:
|
||||
|
25
tasks/nova_compute_wait.yml
Normal file
25
tasks/nova_compute_wait.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
# Copyright 2017, Logan Vig <logan2211@gmail.com>
|
||||
#
|
||||
# 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: Wait for the nova-compute service to initialize
|
||||
command: openstack --os-cloud default compute service list -f json
|
||||
changed_when: false
|
||||
register: nova_service_list
|
||||
retries: 10
|
||||
delay: 5
|
||||
until: "{{ ansible_hostname in (nova_service_list.stdout
|
||||
| from_json
|
||||
| selectattr('Binary', 'equalto', 'nova-compute')
|
||||
| map(attribute='Host') | list) }}"
|
Loading…
x
Reference in New Issue
Block a user