Browse Source

Fix placement_wait_for_service

This fix the indent and volumes of the placement_wait_for_service
and the corresponding placement_wait_for_service.py to use the
config of the extracted placement service.

It also
* changes to set placement::keystone::authtoken::auth_url
instead of placement::keystone::authtoken::auth_uri as auth_uri is
deprecated and not supported by placement::keystone::authtoken.
* sets placement::keystone::authtoken::region_name

Related-Bug: 1842948

Change-Id: Ic24cf646efdd70ba1dbca42d3408847fe09a6e49
tags/12.0.0
Martin Schuppert 3 months ago
parent
commit
d80d948fe7
2 changed files with 45 additions and 35 deletions
  1. +22
    -17
      container_config_scripts/placement_wait_for_service.py
  2. +23
    -18
      deployment/placement/placement-api-container-puppet.yaml

+ 22
- 17
container_config_scripts/placement_wait_for_service.py View File

@@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.

# shell script to check if nova API DB migrations finished after X attempts.
# shell script to check if placement API is up after X attempts.
# Default max is 60 iterations with 10s (default) timeout in between.

from __future__ import print_function
@@ -52,30 +52,32 @@ else:
loglevel = logging.INFO

logging.basicConfig(stream=sys.stdout, level=loglevel)
LOG = logging.getLogger('nova_wait_for_placement_service')
LOG = logging.getLogger('placement_wait_for_service')

iterations = 60
timeout = 10
nova_cfg = '/etc/nova/nova.conf'
placement_cfg = '/etc/placement/placement.conf'

if __name__ == '__main__':
if os.path.isfile(nova_cfg):
if os.path.isfile(placement_cfg):
try:
config.read(nova_cfg)
config.read(placement_cfg)
except Exception:
LOG.exception('Error while reading nova.conf:')
LOG.exception('Error while reading placement.conf:')
else:
LOG.error('Nova configuration file %s does not exist', nova_cfg)
LOG.error('Placement configuration file %s does not exist',
placement_cfg)
sys.exit(1)

# get keystone client with details from [placement] section
# get keystone client with details from [keystone_authtoken] section
auth = v3.Password(
user_domain_name=config.get('placement', 'user_domain_name'),
username=config.get('placement', 'username'),
password=config.get('placement', 'password'),
project_name=config.get('placement', 'project_name'),
project_domain_name=config.get('placement', 'user_domain_name'),
auth_url=config.get('placement', 'auth_url') + '/v3')
user_domain_name=config.get('keystone_authtoken', 'user_domain_name'),
username=config.get('keystone_authtoken', 'username'),
password=config.get('keystone_authtoken', 'password'),
project_name=config.get('keystone_authtoken', 'project_name'),
project_domain_name=config.get('keystone_authtoken',
'project_domain_name'),
auth_url=config.get('keystone_authtoken', 'auth_url') + '/v3')
sess = session.Session(auth=auth, verify=False)
keystone = client.Client(session=sess, interface='internal')

@@ -88,11 +90,14 @@ if __name__ == '__main__':
placement_service_id = keystone.services.list(
name='placement')[0].id

# get placement endpoint (valid_interfaces)
# get placement endpoint
# Note: puppet-placement does not support setting the interface
# until we have https://review.opendev.org/688862.
# Lets hard code 'internal' for now.
placement_endpoint_url = keystone.endpoints.list(
service=placement_service_id,
region=config.get('placement', 'region_name'),
interface=config.get('placement', 'valid_interfaces'))[0].url
region=config.get('keystone_authtoken', 'region_name'),
interface='internal')[0].url
if not placement_endpoint_url:
LOG.error('Failed to get placement service endpoint!')
else:

+ 23
- 18
deployment/placement/placement-api-container-puppet.yaml View File

@@ -116,8 +116,8 @@ outputs:
placement::keystone::authtoken::project_name: 'service'
placement::keystone::authtoken::password: {get_param: PlacementPassword}
placement::keystone::authtoken::www_authenticate_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
placement::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
placement::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
placement::keystone::authtoken::region_name: {get_param: KeystoneRegion}
placement::wsgi::apache::api_port: '8778'
placement::wsgi::apache::ssl: {get_param: EnableInternalTLS}
# NOTE: bind IP is found in hiera replacing the network name with the local node IP
@@ -278,23 +278,28 @@ outputs:
- ''
environment:
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
placement_wait_for_service:
start_order: 2
image: *placement_api_image
user: root
net: host
privileged: false
detach: false
volumes:
- /var/lib/container-config-scripts/:/container-config-scripts/:z
- /var/lib/config-data/puppet-generated/placement/:/var/lib/kolla/config_files/src:ro
command: "/usr/bin/bootstrap_host_exec placement su placement -s /bin/bash -c '/container-config-scripts/pyshim.sh /container-config-scripts/placement_wait_for_service.py'"
environment:
__OS_DEBUG:
yaql:
expression: str($.data.debug)
data:
debug: {get_param: Debug}
placement_wait_for_service:
start_order: 2
image: *placement_api_image
user: root
net: host
privileged: false
detach: false
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- {get_attr: [PlacementLogging, volumes]}
-
- /var/lib/config-data/placement/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
- /var/lib/config-data/placement/etc/placement/:/etc/placement/:ro
- /var/lib/container-config-scripts/:/container-config-scripts/:z
command: "/usr/bin/bootstrap_host_exec placement su placement -s /bin/bash -c '/container-config-scripts/pyshim.sh /container-config-scripts/placement_wait_for_service.py'"
environment:
__OS_DEBUG:
yaql:
expression: str($.data.debug)
data:
debug: {get_param: Debug}
host_prep_tasks: {get_attr: [PlacementLogging, host_prep_tasks]}
upgrade_tasks: []
post_upgrade_tasks:

Loading…
Cancel
Save