Move nova cell v2 discovery to deploy_steps_tasks
Recent changes for e.g edge scenarios caused intended move of discovery
from controller to bootstrap compute node. The task is triggered by
deploy-identifier to make sure it gets run on any deploy,scale, ... run.
If deploy run is triggered with --skip-deploy-identifier flag, discovery
will not be triggered at and as result causing failures in previously
supported scenarios.
This change moves the host discovery task to be an ansible
deploy_steps_tasks that it gets triggered even if --skip-deploy-identifier
is used, or the compute bootstrap node is blacklisted.
Closes-Bug: #1831711
Change-Id: I4bd8489e4f79e3e1bfe9338ed3043241dd605dcb
(cherry picked from commit f8779e5023
)
This commit is contained in:
parent
7b3df6196d
commit
b82417126b
|
@ -1,62 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2018 Red Hat Inc.
|
||||
#
|
||||
# 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.
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
random.seed()
|
||||
|
||||
debug = os.getenv('__OS_DEBUG', 'false')
|
||||
|
||||
if debug.lower() == 'true':
|
||||
loglevel = logging.DEBUG
|
||||
else:
|
||||
loglevel = logging.INFO
|
||||
|
||||
logging.basicConfig(stream=sys.stdout, level=loglevel)
|
||||
LOG = logging.getLogger('nova_cell_v2_discover_hosts')
|
||||
|
||||
iterations = 10
|
||||
timeout_max = 30
|
||||
nova_cfg = '/etc/nova/nova.conf'
|
||||
|
||||
if __name__ == '__main__':
|
||||
if not os.path.isfile(nova_cfg):
|
||||
LOG.error('Nova configuration file %s does not exist', nova_cfg)
|
||||
sys.exit(1)
|
||||
|
||||
for i in range(iterations):
|
||||
try:
|
||||
subprocess.check_call([
|
||||
'/usr/bin/nova-manage',
|
||||
'cell_v2',
|
||||
'discover_hosts',
|
||||
'--by-service',
|
||||
'--verbose'
|
||||
])
|
||||
sys.exit(0)
|
||||
except subprocess.CalledProcessError as e:
|
||||
LOG.error('Cell v2 discovery failed with exit code %d, retrying',
|
||||
e.returncode)
|
||||
except Exception as e:
|
||||
LOG.exception('Error during host discovery')
|
||||
time.sleep(random.randint(1, timeout_max))
|
||||
sys.exit(1)
|
||||
|
||||
# vim: set et ts=4 sw=4 :
|
|
@ -43,9 +43,30 @@ outputs:
|
|||
nova_wait_for_placement_service.py:
|
||||
mode: "0755"
|
||||
content: { get_file: ../../container_config_scripts/nova_wait_for_placement_service.py }
|
||||
nova_cell_v2_discover_hosts.py:
|
||||
mode: "0755"
|
||||
content: { get_file: ../../container_config_scripts/nova_cell_v2_discover_hosts.py }
|
||||
nova_wait_for_compute_service.py:
|
||||
mode: "0755"
|
||||
content: { get_file: ../../container_config_scripts/nova_wait_for_compute_service.py }
|
||||
|
||||
nova_compute_common_deploy_steps_tasks:
|
||||
description: Common host prep tasks for nova-compute services (compute + ironic)
|
||||
value: &nova_compute_common_deploy_steps_tasks
|
||||
- when: step|int == 5
|
||||
block:
|
||||
- name: discover via nova_compute?
|
||||
set_fact:
|
||||
delegate_host: "{{ groups['nova_compute'][0] }}"
|
||||
when:
|
||||
- groups['nova_compute'] is defined and (groups['nova_compute']|length>0)
|
||||
- name: discover via nova_ironic?
|
||||
set_fact:
|
||||
delegate_host: "{{ groups['nova_ironic'][0] }}"
|
||||
when:
|
||||
- delegate_host is not defined
|
||||
- groups['nova_ironic'] is defined and (groups['nova_ironic']|length>0)
|
||||
- name: Discovering nova hosts
|
||||
command: "{{ container_cli }} exec nova_compute nova-manage cell_v2 discover_hosts --by-service"
|
||||
become: true
|
||||
changed_when: False
|
||||
when:
|
||||
- delegate_host is defined
|
||||
- inventory_hostname == delegate_host
|
||||
|
|
|
@ -673,39 +673,6 @@ outputs:
|
|||
data:
|
||||
debug: {get_attr: [NovaBase, role_data, config_settings, 'nova::logging::debug']}
|
||||
- {}
|
||||
step_5:
|
||||
if:
|
||||
- is_not_additional_cell
|
||||
- nova_cell_v2_discover_hosts:
|
||||
start_order: 0
|
||||
image: *nova_compute_image
|
||||
net: host
|
||||
detach: false
|
||||
volumes:
|
||||
list_concat:
|
||||
- {get_attr: [ContainersCommon, volumes]}
|
||||
-
|
||||
- /var/lib/config-data/nova_libvirt/etc/my.cnf.d/:/etc/my.cnf.d/:ro
|
||||
- /var/lib/config-data/nova_libvirt/etc/nova/:/etc/nova/:ro
|
||||
- /var/log/containers/nova:/var/log/nova
|
||||
- /var/lib/container-config-scripts/:/container-config-scripts/
|
||||
user: root
|
||||
command: "/usr/bin/bootstrap_host_exec nova_compute su nova -s /bin/bash -c '/container-config-scripts/pyshim.sh /container-config-scripts/nova_cell_v2_discover_hosts.py'"
|
||||
environment:
|
||||
# NOTE: this should force this container to re-run on each
|
||||
# update (scale-out, etc.)
|
||||
- list_join:
|
||||
- ''
|
||||
- - 'TRIPLEO_DEPLOY_IDENTIFIER='
|
||||
- {get_param: DeployIdentifier}
|
||||
- list_join:
|
||||
- ''
|
||||
- - '__OS_DEBUG='
|
||||
- yaql:
|
||||
expression: str($.data.debug)
|
||||
data:
|
||||
debug: {get_attr: [NovaBase, role_data, config_settings, 'nova::logging::debug']}
|
||||
- {}
|
||||
host_prep_tasks:
|
||||
list_concat:
|
||||
- {get_attr: [NovaLogging, host_prep_tasks]}
|
||||
|
@ -895,6 +862,7 @@ outputs:
|
|||
with_items:
|
||||
- ksm.service
|
||||
- ksmtuned.service
|
||||
deploy_steps_tasks: {get_attr: [NovaComputeCommon, nova_compute_common_deploy_steps_tasks]}
|
||||
upgrade_tasks:
|
||||
- name: Remove openstack-nova-compute and python-nova package during upgrade
|
||||
package:
|
||||
|
|
|
@ -165,22 +165,6 @@ outputs:
|
|||
- /var/lib/container-config-scripts/:/container-config-scripts/
|
||||
user: root
|
||||
command: "/container-config-scripts/pyshim.sh /container-config-scripts/nova_wait_for_compute_service.py"
|
||||
step_5:
|
||||
nova_cell_v2_discover_hosts:
|
||||
start_order: 0
|
||||
image: *nova_ironic_image
|
||||
net: host
|
||||
detach: false
|
||||
volumes:
|
||||
list_concat:
|
||||
- {get_attr: [ContainersCommon, volumes]}
|
||||
-
|
||||
- /var/lib/config-data/nova/etc/my.cnf.d/:/etc/my.cnf.d/:ro
|
||||
- /var/lib/config-data/nova/etc/nova/:/etc/nova/:ro
|
||||
- /var/log/containers/nova:/var/log/nova
|
||||
- /var/lib/container-config-scripts/:/container-config-scripts/
|
||||
user: root
|
||||
command: "/usr/bin/bootstrap_host_exec nova_ironic su nova -s /bin/bash -c '/container-config-scripts/pyshim.sh /container-config-scripts/nova_cell_v2_discover_hosts.py'"
|
||||
host_prep_tasks:
|
||||
- name: create persistent directories
|
||||
file:
|
||||
|
@ -203,6 +187,7 @@ outputs:
|
|||
name: virt_sandbox_use_netlink
|
||||
persistent: yes
|
||||
state: yes
|
||||
deploy_steps_tasks: {get_attr: [NovaComputeCommon, nova_compute_common_deploy_steps_tasks]}
|
||||
post_upgrade_tasks:
|
||||
- when: step|int == 1
|
||||
import_role:
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Recent changes for e.g edge scenarios caused intended move of discovery
|
||||
from controller to bootstrap compute node. The task is triggered by
|
||||
deploy-identifier to make sure it gets run on any deploy,scale, ... run.
|
||||
If deploy run is triggered with --skip-deploy-identifier flag, discovery
|
||||
will not be triggered at and as result causing failures in previously
|
||||
supported scenarios.
|
||||
This change moves the host discovery task to be an ansible
|
||||
deploy_steps_tasks that it gets triggered even if --skip-deploy-identifier
|
||||
is used, or the compute bootstrap node is blacklisted.
|
Loading…
Reference in New Issue