Enable platform APIs from pods at bootstrap
This commit enables access to platform service APIs from within Kubernetes pods prior to initial controller unlock. Prior to this changes, service endpoints were only reconfigured right before the unlock making sysinv apis inaccessible to services running inside the pods as they can not reach the loopback IP (127.0.0.1). This is achieved by reconfiguring service endpoints a) during initial bootstrap play from loopback IP to the provided management and OAM IPs b) during subsequent replays with newly provided management and/or oam network config values. Tests performed: - Bootstrap with defaults, verify endpoints - Change management subnet value and replay, verify endpoints - Change oam floating IP and replay, verify endpoints - Configure host for unlock - Unlock controller Story: 2004695 Task: 30914 Related-Bug: #1828880 Change-Id: I9ef9d30bbf8713c75206b338aefd53c3e77db0cb Signed-off-by: Tee Ngo <tee.ngo@windriver.com>
This commit is contained in:
parent
9c2e2f76c8
commit
0dddabca4d
|
@ -5,20 +5,65 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# SUB-TASKS DESCRIPTION:
|
||||
# Start up FM, Maintenance
|
||||
# - Skip auth middleware for FM as it is not functional at this early
|
||||
# stage
|
||||
# - Restart Sysinv agent and api when applicable
|
||||
# - Restart Barbican
|
||||
# - Start up FM, skip auth middleware as it is not functional at this
|
||||
# early stage
|
||||
# - Start up Maintenance Agent
|
||||
# - Restart Maintenance Client to pick the new config which will update
|
||||
# the controller-0 status from offline to online.
|
||||
#
|
||||
|
||||
- block: # Bring up FM and MTC
|
||||
# If this is the initial play, wait for service endpoints reconfiguration to complete
|
||||
# and restart sysinv-api and agent to pick up the managment floating IP.
|
||||
- block:
|
||||
- name: Wait for service endpoints reconfiguration to complete
|
||||
wait_for:
|
||||
path: /etc/platform/.config_applied
|
||||
state: present
|
||||
timeout: 180
|
||||
msg: Timeout waiting for service endpoints reconfiguration to complete
|
||||
|
||||
- name: Update sysinv API bind host with management floating IP
|
||||
replace:
|
||||
path: /etc/sysinv/sysinv.conf
|
||||
regexp: "sysinv_api_bind_ip=.*$"
|
||||
replace: "sysinv_api_bind_ip={{ controller_floating_address }}"
|
||||
|
||||
- name: Restart sysinv-agent and sysinv-api
|
||||
command: "{{ item }}"
|
||||
with_items:
|
||||
- /etc/init.d/sysinv-agent restart
|
||||
- /usr/lib/ocf/resource.d/platform/sysinv-api reload
|
||||
environment:
|
||||
OCF_ROOT: "/usr/lib/ocf"
|
||||
|
||||
when: not replayed
|
||||
|
||||
- block:
|
||||
- name: Update barbican bind host with management floating IP
|
||||
replace:
|
||||
path: /etc/barbican/barbican.conf
|
||||
regexp: "bind_host=.*$"
|
||||
replace: "bind_host={{ controller_floating_address }}"
|
||||
|
||||
- name: Restart barbican
|
||||
systemd:
|
||||
state: restarted
|
||||
name: openstack-barbican-api
|
||||
|
||||
- name: Apply workaround for fm-api
|
||||
lineinfile:
|
||||
path: /etc/fm/api-paste.ini
|
||||
line: "pipeline=request_id api_v1"
|
||||
regex: "pipeline*"
|
||||
|
||||
- name: Update bind_host config parameter in fm config file
|
||||
replace:
|
||||
path: /etc/fm/fm.conf
|
||||
regexp: "bind_host=.*$"
|
||||
replace: "bind_host={{ controller_floating_address }}"
|
||||
|
||||
- name: Restart FM API and bring up FM Manager
|
||||
command: "{{ item }}"
|
||||
with_items:
|
||||
|
|
|
@ -10,29 +10,27 @@
|
|||
#
|
||||
|
||||
- block:
|
||||
- name: Set facts for IP address provisioning against loopback interface
|
||||
set_fact:
|
||||
mgmt_virtual: "{{ derived_network_params.controller_0_address }}/{{ management_subnet_prefix }}"
|
||||
cluster_virtual: "{{ controller_0_cluster_host }}/{{ cluster_subnet_prefix }}"
|
||||
pxe_virtual: "{{ controller_pxeboot_floating_address }}/{{ pxe_subnet_prefix }}"
|
||||
cluster_floating_virtual: "{{ cluster_floating_address }}/{{ cluster_subnet_prefix }}"
|
||||
mgmt_floating_virtual: "{{ controller_floating_address }}/{{ management_subnet_prefix }}"
|
||||
mgmt_nfs_1_virtual: "{{ derived_network_params.nfs_management_address_1 }}/{{ management_subnet_prefix }}"
|
||||
mgmt_nfs_2_virtual: "{{ derived_network_params.nfs_management_address_2 }}/{{ management_subnet_prefix }}"
|
||||
|
||||
- name: Add loopback interface
|
||||
# Had to resort to shell module as source is an internal shell command
|
||||
# Use shell instead of command module as source is an internal shell command
|
||||
shell: "{{ item }}"
|
||||
with_items:
|
||||
- source /etc/platform/openrc; system host-if-add controller-0 lo virtual none lo -c platform --networks mgmt -m 1500
|
||||
- source /etc/platform/openrc; system host-if-modify controller-0 -c platform --networks cluster-host lo
|
||||
- "ip addr add {{ cluster_virtual }} brd {{ cluster_broadcast }} dev lo scope host label lo:5"
|
||||
- "ip addr add {{ mgmt_virtual }} brd {{ management_broadcast }} dev lo scope host label lo:1"
|
||||
- "ip addr add {{ pxe_virtual }} dev lo scope host"
|
||||
- "ip addr add {{ cluster_floating_virtual }} dev lo scope host"
|
||||
- "ip addr add {{ mgmt_floating_virtual }} dev lo scope host"
|
||||
- "ip addr add {{ mgmt_nfs_1_virtual }} dev lo scope host"
|
||||
- "ip addr add {{ mgmt_nfs_2_virtual }} dev lo scope host"
|
||||
- ip addr add {{ cluster_virtual }} brd {{ cluster_broadcast }} dev lo scope host label lo:5
|
||||
- ip addr add {{ mgmt_virtual }} brd {{ management_broadcast }} dev lo scope host label lo:1
|
||||
- ip addr add {{ pxe_virtual }} dev lo scope host
|
||||
- ip addr add {{ cluster_floating_virtual }} dev lo scope host
|
||||
- ip addr add {{ mgmt_nfs_1_virtual }} dev lo scope host
|
||||
- ip addr add {{ mgmt_nfs_2_virtual }} dev lo scope host
|
||||
|
||||
- name: Add management floating adddress if this is the initial play
|
||||
command: ip addr add {{ mgmt_floating_virtual }} dev lo scope host
|
||||
when: not replayed
|
||||
|
||||
- name: Remove previous management floating address if management network config has changed
|
||||
command: ip addr delete {{ prev_mgmt_floating_virtual }} dev lo scope host
|
||||
when: reconfigure_endpoints and
|
||||
(mgmt_floating_virtual != prev_mgmt_floating_virtual)
|
||||
|
||||
- name: Refresh local DNS (i.e. /etc/hosts)
|
||||
include: refresh_local_dns.yml
|
||||
|
|
|
@ -98,6 +98,33 @@
|
|||
msg: "Failed to provision initial system configuration."
|
||||
when: populate_result.rc != 0
|
||||
|
||||
- block:
|
||||
# If this is a replay with management and/or oam network config change, must
|
||||
# wait for the keystone endpoint runtime manifest to complete and restart
|
||||
# sysinv.
|
||||
- name: Wait for service endpoints reconfiguration to complete
|
||||
wait_for:
|
||||
path: /etc/platform/.config_applied
|
||||
state: present
|
||||
timeout: 180
|
||||
msg: Timeout waiting for service endpoints reconfiguration to complete
|
||||
|
||||
- name: Update sysinv API bind host with new management floating IP
|
||||
replace:
|
||||
path: /etc/sysinv/sysinv.conf
|
||||
regexp: "sysinv_api_bind_ip=.*$"
|
||||
replace: "sysinv_api_bind_ip={{ controller_floating_address }}"
|
||||
|
||||
- name: Restart sysinv-agent and sysinv-api to pick up sysinv.conf update
|
||||
command: "{{ item }}"
|
||||
with_items:
|
||||
- /etc/init.d/sysinv-agent restart
|
||||
- /usr/lib/ocf/resource.d/platform/sysinv-api reload
|
||||
environment:
|
||||
OCF_ROOT: "/usr/lib/ocf"
|
||||
|
||||
when: reconfigure_endpoints
|
||||
|
||||
- block:
|
||||
- name: Ensure docker config directory exists
|
||||
file:
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
name: etcd
|
||||
state: restarted
|
||||
|
||||
- block: # Revert configurations to loopback interface
|
||||
# Revert configuration to loopback interface
|
||||
- block:
|
||||
- name: Set facts derived from previous network configurations
|
||||
set_fact:
|
||||
prev_management_subnet_prefix: "{{ prev_management_subnet | ipaddr('prefix') }}"
|
||||
|
@ -63,14 +64,30 @@
|
|||
prev_mgmt_virtual: "{{ prev_controller_0_address }}/{{ prev_management_subnet_prefix }}"
|
||||
prev_cluster_virtual: "{{ prev_controller_0_cluster_host }}/{{ prev_cluster_subnet_prefix }}"
|
||||
|
||||
- name: Remove loopback interface
|
||||
# Remove previous addresses associated with lo interface except the previous mgmt floating address
|
||||
# as we still need sysinv-api to be reachable at the previous address until the service endpoints
|
||||
# are reconfigured.
|
||||
- name: Remove loopback interface in sysinv db and associated addresses
|
||||
shell: "{{ item }}"
|
||||
with_items:
|
||||
- source /etc/platform/openrc; system host-if-delete controller-0 lo
|
||||
- "ip addr delete {{ prev_mgmt_nfs_2_virtual }} dev lo scope host"
|
||||
- "ip addr delete {{ prev_mgmt_nfs_1_virtual }} dev lo scope host"
|
||||
- "ip addr delete {{ prev_mgmt_floating_virtual }} dev lo scope host"
|
||||
- "ip addr delete {{ prev_cluster_floating_virtual }} dev lo scope host"
|
||||
- "ip addr delete {{ prev_pxe_virtual }} dev lo scope host"
|
||||
- "ip addr delete {{ prev_mgmt_virtual }} brd {{ management_broadcast }} dev lo:1 scope host"
|
||||
- "ip addr delete {{ prev_cluster_virtual }} brd {{ cluster_broadcast }} dev lo:5 scope host"
|
||||
|
||||
- block:
|
||||
- name: Remove the .config_applied flag from previous run before reconfiguring service endpoints
|
||||
file:
|
||||
path: /etc/platform/.config_applied
|
||||
state: absent
|
||||
|
||||
# Enable the new management floating address so that sysinv-api is reachable at this IP when
|
||||
# service endpoints have been reconfigured and sysinv-api restarted.
|
||||
- name: Add the new management address for service endpoints reconfiguration
|
||||
command: ip addr add {{ mgmt_floating_virtual }} dev lo scope host
|
||||
when: mgmt_floating_virtual != prev_mgmt_floating_virtual
|
||||
|
||||
when: reconfigure_endpoints
|
||||
|
|
|
@ -155,6 +155,7 @@
|
|||
use_docker_proxy: false
|
||||
use_unified_registry: false
|
||||
restart_services: false
|
||||
reconfigure_endpoints: false
|
||||
|
||||
- name: Set initial facts
|
||||
set_fact:
|
||||
|
@ -273,7 +274,7 @@
|
|||
(prev_timezone != timezone) or
|
||||
(prev_dns_servers.split(',') | sort != dns_servers | sort)
|
||||
|
||||
- name: Turn on docker reconfiguration flag
|
||||
- name: Turn on docker reconfiguration flag if docker config is changed
|
||||
set_fact:
|
||||
docker_config_update: true
|
||||
when: (prev_docker_registries.split(',') | sort != docker_registries | sort) or
|
||||
|
@ -282,52 +283,61 @@
|
|||
prev_docker_https_proxy != docker_https_proxy or
|
||||
prev_docker_no_proxy != docker_no_proxy))
|
||||
|
||||
- name: Turn on restart services flag if any of the management, cluster and docker settings is changed
|
||||
- name: Turn on service endpoints reconfiguration flag if management and/or oam network config is changed
|
||||
set_fact:
|
||||
restart_services: true
|
||||
reconfigure_endpoints: true
|
||||
when: (prev_management_subnet != management_subnet) or
|
||||
(prev_cluster_host_subnet != cluster_host_subnet) or
|
||||
(prev_cluster_pod_subnet != cluster_pod_subnet) or
|
||||
(prev_cluster_service_subnet != cluster_service_subnet) or
|
||||
docker_config_update
|
||||
|
||||
- name: Turn on network reconfiguration flag if any of the network related settings is changed
|
||||
set_fact:
|
||||
network_config_update: true
|
||||
when: (prev_pxeboot_subnet != pxeboot_subnet) or
|
||||
(prev_management_subnet != management_subnet) or
|
||||
(prev_cluster_host_subnet != cluster_host_subnet) or
|
||||
(prev_cluster_pod_subnet != cluster_pod_subnet) or
|
||||
(prev_cluster_service_subnet != cluster_service_subnet) or
|
||||
(prev_management_start_address != management_start_address) or
|
||||
(prev_external_oam_subnet != external_oam_subnet) or
|
||||
(prev_external_oam_gateway_address != external_oam_gateway_address) or
|
||||
(prev_external_oam_floating_address != external_oam_floating_address) or
|
||||
(prev_management_multicast_subnet != management_multicast_subnet) or
|
||||
(prev_dynamic_address_allocation != dynamic_address_allocation) or
|
||||
(prev_pxeboot_start_address != pxeboot_start_address) or
|
||||
(prev_pxeboot_end_address != pxeboot_end_address) or
|
||||
(prev_management_start_address != management_start_address) or
|
||||
(prev_management_end_address != management_end_address) or
|
||||
(prev_cluster_host_start_address != cluster_host_start_address) or
|
||||
(prev_cluster_host_end_address != cluster_host_end_address) or
|
||||
(prev_cluster_pod_start_address != cluster_pod_start_address) or
|
||||
(prev_cluster_pod_end_address != cluster_pod_end_address) or
|
||||
(prev_cluster_service_start_address != cluster_service_start_address) or
|
||||
(prev_cluster_service_end_address != cluster_service_end_address) or
|
||||
(prev_external_oam_start_address != external_oam_start_address) or
|
||||
(prev_external_oam_end_address != external_oam_end_address) or
|
||||
(prev_management_multicast_start_address != management_multicast_start_address) or
|
||||
(prev_management_multicast_end_address != management_multicast_end_address) or
|
||||
(prev_external_oam_node_0_address != external_oam_node_0_address) or
|
||||
(prev_external_oam_node_1_address != external_oam_node_1_address)
|
||||
|
||||
- name: Turn on network reconfiguration flag if any of the network related config is changed
|
||||
set_fact:
|
||||
network_config_update: true
|
||||
when: reconfigure_endpoints or
|
||||
(prev_dynamic_address_allocation != dynamic_address_allocation) or
|
||||
(prev_management_end_address != management_end_address) or
|
||||
(prev_pxeboot_subnet != pxeboot_subnet) or
|
||||
(prev_pxeboot_start_address != pxeboot_start_address) or
|
||||
(prev_pxeboot_end_address != pxeboot_end_address) or
|
||||
(prev_management_multicast_subnet != management_multicast_subnet) or
|
||||
(prev_management_multicast_start_address != management_multicast_start_address) or
|
||||
(prev_management_multicast_end_address != management_multicast_end_address) or
|
||||
(prev_cluster_host_subnet != cluster_host_subnet) or
|
||||
(prev_cluster_host_start_address != cluster_host_start_address) or
|
||||
(prev_cluster_host_end_address != cluster_host_end_address) or
|
||||
(prev_cluster_pod_subnet != cluster_pod_subnet) or
|
||||
(prev_cluster_pod_start_address != cluster_pod_start_address) or
|
||||
(prev_cluster_pod_end_address != cluster_pod_end_address) or
|
||||
(prev_cluster_service_subnet != cluster_service_subnet) or
|
||||
(prev_cluster_service_start_address != cluster_service_start_address) or
|
||||
(prev_cluster_service_end_address != cluster_service_end_address)
|
||||
|
||||
- name: Turn on restart services flag if management/oam/cluster network or docker config is changed
|
||||
set_fact:
|
||||
restart_services: true
|
||||
when: reconfigure_endpoints or
|
||||
docker_config_update or
|
||||
(prev_cluster_host_subnet != cluster_host_subnet) or
|
||||
(prev_cluster_pod_subnet != cluster_pod_subnet) or
|
||||
(prev_cluster_service_subnet != cluster_service_subnet)
|
||||
|
||||
# Re-evaluate the condition to generate the python keyring
|
||||
- name: Turn off save_password flag if admin password has not changed
|
||||
set_fact:
|
||||
save_password: false
|
||||
username: "{{ prev_admin_username }}"
|
||||
password: "{{ prev_admin_password }}"
|
||||
# TODO(tngo): there seems to be a puppet/sysinv limitation that prevents password
|
||||
# reconfiguration to work without an extra boot. Temporarily disable
|
||||
# it for replay for now.
|
||||
when: prev_admin_password == admin_password|hash('sha1')
|
||||
or replayed
|
||||
|
||||
# Re-evaluate condition to persist config data to sysinv database
|
||||
- name: Turn off save_config flag if system, network, and docker configurations have not changed
|
||||
|
@ -424,6 +434,7 @@
|
|||
network_config_update flag: {{ network_config_update }},
|
||||
docker_config_update flag: {{ docker_config_update }},
|
||||
restart_services flag: {{ restart_services }},
|
||||
endpoints_reconfiguration_flag: {{ reconfigure_endpoints }},
|
||||
save_password flag: {{ save_password }},
|
||||
save_config flag: {{ save_config }},
|
||||
skip_play flag: {{ skip_play }}
|
||||
|
|
|
@ -243,6 +243,15 @@
|
|||
controller_0_cluster_host: "{{ cluster_floating_address|ipmath(1) }}"
|
||||
controller_1_cluster_host: "{{ cluster_floating_address|ipmath(2) }}"
|
||||
|
||||
- name: Set facts for IP address provisioning against loopback interface
|
||||
set_fact:
|
||||
mgmt_virtual: "{{ derived_network_params.controller_0_address }}/{{ management_subnet_prefix }}"
|
||||
cluster_virtual: "{{ controller_0_cluster_host }}/{{ cluster_subnet_prefix }}"
|
||||
pxe_virtual: "{{ controller_pxeboot_floating_address }}/{{ pxe_subnet_prefix }}"
|
||||
cluster_floating_virtual: "{{ cluster_floating_address }}/{{ cluster_subnet_prefix }}"
|
||||
mgmt_floating_virtual: "{{ controller_floating_address }}/{{ management_subnet_prefix }}"
|
||||
mgmt_nfs_1_virtual: "{{ derived_network_params.nfs_management_address_1 }}/{{ management_subnet_prefix }}"
|
||||
mgmt_nfs_2_virtual: "{{ derived_network_params.nfs_management_address_2 }}/{{ management_subnet_prefix }}"
|
||||
|
||||
# Docker config validation
|
||||
- block:
|
||||
|
@ -418,6 +427,7 @@
|
|||
- "DOCKER_REGISTRIES={{ docker_registries | join(',') }}"
|
||||
- "USE_DEFAULT_REGISTRIES={{ use_default_registries }}"
|
||||
- "IS_SECURE_REGISTRY={{ is_secure_registry | default(True) }}"
|
||||
- "RECONFIGURE_ENDPOINTS={{ reconfigure_endpoints }}"
|
||||
|
||||
- name: Write simplex flag
|
||||
file:
|
||||
|
|
|
@ -108,7 +108,6 @@ FIRST_BOOT_FLAG = os.path.join(
|
|||
PUPPET_HIERADATA_PATH = os.path.join(tsc.PUPPET_PATH, 'hieradata')
|
||||
|
||||
LOCK_AGENT_ACTION = 'agent-exclusive-action'
|
||||
UNLOCK_READY_FLAG = os.path.join(tsc.PLATFORM_CONF_PATH, ".unlock_ready")
|
||||
|
||||
|
||||
class FakeGlobalSectionHead(object):
|
||||
|
@ -1546,28 +1545,20 @@ class AgentManager(service.PeriodicService):
|
|||
LOG.info('Runtime manifest apply completed for classes %s.' %
|
||||
applied_classes)
|
||||
|
||||
# Following an Ansible bootstrap, keystone endpoint manifest needs
|
||||
# to be applied to reconfigure service endpoints from loopback IP
|
||||
# to management/oam floating IPs right before the initial unlock.
|
||||
#
|
||||
# For AIO, grub update manifests must also be applied to account
|
||||
# for any cpu reconfigurations that might have occurred during
|
||||
# initial host bootstrap or configurations.
|
||||
# Following Ansible bootstrap in AIO, grub update manifests must
|
||||
# be applied to account for any cpu reconfigurations that might
|
||||
# have occurred during initial host bootstrap or configurations.
|
||||
#
|
||||
# NOTE: Don't create and add new puppet manifests to this list.
|
||||
# If there are configurations that must be applied
|
||||
# a) during bootstrap, implement in Ansible playbook
|
||||
# b) during initial host configurations, implement in sysinv
|
||||
if (os.path.isfile(constants.ANSIBLE_BOOTSTRAP_FLAG) and
|
||||
(applied_classes ==
|
||||
['openstack::keystone::endpoint::runtime'] or
|
||||
applied_classes ==
|
||||
['openstack::keystone::endpoint::runtime',
|
||||
'platform::compute::grub::runtime',
|
||||
'platform::compute::config::runtime'])):
|
||||
applied_classes == ['platform::compute::grub::runtime',
|
||||
'platform::compute::config::runtime']):
|
||||
# Set ready flag for maintenance to proceed with the unlock of
|
||||
# the initial controller.
|
||||
utils.touch(UNLOCK_READY_FLAG)
|
||||
utils.touch(constants.UNLOCK_READY_FLAG)
|
||||
except Exception:
|
||||
LOG.exception("failed to apply runtime manifest")
|
||||
raise
|
||||
|
|
|
@ -1405,6 +1405,13 @@ class HostController(rest.RestController):
|
|||
pecan.request.rpcapi.configure_ihost(
|
||||
pecan.request.context,
|
||||
controller_ihost)
|
||||
# As part of the initial controller host creation during
|
||||
# Ansible bootstrap, reconfigure the service endpoints to use
|
||||
# the management floating IP instead of the loopback IP.
|
||||
if os.path.isfile(constants.ANSIBLE_BOOTSTRAP_FLAG):
|
||||
pecan.request.rpcapi.reconfigure_service_endpoints(
|
||||
pecan.request.context, controller_ihost)
|
||||
|
||||
return Host.convert_with_links(controller_ihost)
|
||||
|
||||
if ihost_dict['personality'] in (constants.CONTROLLER, constants.STORAGE):
|
||||
|
@ -4955,7 +4962,8 @@ class HostController(rest.RestController):
|
|||
|
||||
hostupdate.configure_required = True
|
||||
if (os.path.isfile(constants.ANSIBLE_BOOTSTRAP_FLAG) and
|
||||
hostupdate.ihost_patch['hostname'] == 'controller-0'):
|
||||
hostupdate.ihost_patch['hostname'] ==
|
||||
constants.CONTROLLER_0_HOSTNAME):
|
||||
# For the first unlock of the initial controller bootstrapped by
|
||||
# Ansible, don't notify vim.
|
||||
hostupdate.notify_vim = False
|
||||
|
|
|
@ -316,6 +316,18 @@ class NetworkController(rest.RestController):
|
|||
|
||||
self._create_network_addresses(pool, network)
|
||||
|
||||
# If the host has already been created, make an RPC request
|
||||
# reconfigure the service endpoints. As oam network is processed
|
||||
# after management network, check only for NETWORK_TYPE_OAM to
|
||||
# avoid potentially making two reconfigure_service_endpoints
|
||||
# rpc requests in succession.
|
||||
chosts = pecan.request.dbapi.ihost_get_by_personality(
|
||||
constants.CONTROLLER)
|
||||
if (len(chosts) == 1 and
|
||||
network['type'] == constants.NETWORK_TYPE_OAM):
|
||||
pecan.request.rpcapi.reconfigure_service_endpoints(
|
||||
pecan.request.context, chosts[0])
|
||||
|
||||
return Network.convert_with_links(result)
|
||||
|
||||
@wsme_pecan.wsexpose(NetworkCollection,
|
||||
|
|
|
@ -156,6 +156,7 @@ CONTROLLER_GATEWAY = '%s-gateway' % CONTROLLER_HOSTNAME
|
|||
CONTROLLER_PLATFORM_NFS = '%s-platform-nfs' % CONTROLLER_HOSTNAME
|
||||
CONTROLLER_CGCS_NFS = '%s-nfs' % CONTROLLER_HOSTNAME
|
||||
CONTROLLER_CINDER = '%s-cinder' % CONTROLLER_HOSTNAME
|
||||
CONTROLLER_0_MGMT = '%s-mgmt' % CONTROLLER_0_HOSTNAME
|
||||
|
||||
PXECONTROLLER_HOSTNAME = 'pxecontroller'
|
||||
OAMCONTROLLER_HOSTNAME = 'oamcontroller'
|
||||
|
@ -1557,3 +1558,4 @@ DEFAULT_DNS_SERVICE_IP = '10.96.0.10'
|
|||
|
||||
# Ansible bootstrap
|
||||
ANSIBLE_BOOTSTRAP_FLAG = os.path.join(tsc.VOLATILE_PATH, ".ansible_bootstrap")
|
||||
UNLOCK_READY_FLAG = os.path.join(tsc.PLATFORM_CONF_PATH, ".unlock_ready")
|
||||
|
|
|
@ -1317,7 +1317,7 @@ class ConductorManager(service.PeriodicService):
|
|||
- Update the puppet hiera data configuration for host
|
||||
- Allocates management address if none exists
|
||||
- Set up PXE configuration to run installer
|
||||
- Update keystone endpoint on initial controller config
|
||||
- Update grub for AIO before initial unlock
|
||||
|
||||
:param context: request context
|
||||
:param host: host object
|
||||
|
@ -1340,27 +1340,26 @@ class ConductorManager(service.PeriodicService):
|
|||
self._update_pxe_config(host)
|
||||
self._ceph_mon_create(host)
|
||||
|
||||
# Apply the manifest to reconfigure the service endpoints and update grub
|
||||
# right before the unlock. The Ansible bootstrap flag only exists during
|
||||
# the bootstrap of the initial controller. It's cleared after the controller
|
||||
# is unlocked.
|
||||
#
|
||||
# The manifest set created here will trigger the unlock after they have
|
||||
# been applied by sysinv agent.
|
||||
if (os.path.isfile(constants.ANSIBLE_BOOTSTRAP_FLAG) and
|
||||
host.availability == constants.AVAILABILITY_ONLINE):
|
||||
# This must be the initial controller host unlock request.
|
||||
personalities = [constants.CONTROLLER]
|
||||
if not utils.is_aio_system(self.dbapi):
|
||||
# Standard system, touch the unlock ready flag
|
||||
cutils.touch(constants.UNLOCK_READY_FLAG)
|
||||
else:
|
||||
# AIO, must update grub before the unlock. Sysinv agent expects
|
||||
# this exact set of manifests in order to touch the unlock ready
|
||||
# flag after they have been applied.
|
||||
config_uuid = self._config_update_hosts(context, personalities)
|
||||
if self._config_is_reboot_required(host.config_target):
|
||||
config_uuid = self._config_set_reboot_required(config_uuid)
|
||||
classes = ['openstack::keystone::endpoint::runtime']
|
||||
if utils.is_aio_system(self.dbapi):
|
||||
classes.extend(['platform::compute::grub::runtime',
|
||||
'platform::compute::config::runtime'])
|
||||
|
||||
config_dict = {
|
||||
"personalities": personalities,
|
||||
"host_uuids": [host.uuid],
|
||||
"classes": classes
|
||||
"classes": ['platform::compute::grub::runtime',
|
||||
'platform::compute::config::runtime']
|
||||
}
|
||||
self._config_apply_runtime_manifest(
|
||||
context, config_uuid, config_dict, force=True)
|
||||
|
@ -10702,3 +10701,34 @@ class ConductorManager(service.PeriodicService):
|
|||
|
||||
"""
|
||||
return self._app.perform_app_delete(rpc_app)
|
||||
|
||||
def reconfigure_service_endpoints(self, context, host):
|
||||
"""Reconfigure the service endpoints upon the creation of initial
|
||||
controller host and management/oam network change during bootstrap
|
||||
playbook play and replay.
|
||||
|
||||
:param contex: request context.
|
||||
:param host: an ihost object
|
||||
|
||||
"""
|
||||
if (os.path.isfile(constants.ANSIBLE_BOOTSTRAP_FLAG) and
|
||||
host.hostname == constants.CONTROLLER_0_HOSTNAME):
|
||||
|
||||
controller_0_address = self.dbapi.address_get_by_name(
|
||||
constants.CONTROLLER_0_MGMT)
|
||||
if controller_0_address.address != host.mgmt_ip:
|
||||
self.dbapi.ihost_update(host.uuid,
|
||||
{'mgmt_ip': controller_0_address.address})
|
||||
|
||||
personalities = [constants.CONTROLLER]
|
||||
config_uuid = self._config_update_hosts(context, personalities)
|
||||
config_dict = {
|
||||
"personalities": personalities,
|
||||
"host_uuids": [host.uuid],
|
||||
"classes": ['openstack::keystone::endpoint::runtime']
|
||||
}
|
||||
self._config_apply_runtime_manifest(
|
||||
context, config_uuid, config_dict, force=True)
|
||||
else:
|
||||
LOG.error("Received a request to reconfigure service endpoints "
|
||||
"for host %s under the wrong condition." % host.hostname)
|
||||
|
|
|
@ -1758,3 +1758,15 @@ class ConductorAPI(sysinv.openstack.common.rpc.proxy.RpcProxy):
|
|||
return self.call(context,
|
||||
self.make_msg('perform_app_delete',
|
||||
rpc_app=rpc_app))
|
||||
|
||||
def reconfigure_service_endpoints(self, context, host):
|
||||
"""Synchronously, reconfigure service endpoints upon the creation of
|
||||
initial controller host and management/oam network change during
|
||||
bootstrap playbook play and replay.
|
||||
|
||||
:param context: request context.
|
||||
:param host: an ihost object
|
||||
"""
|
||||
return self.call(context,
|
||||
self.make_msg('reconfigure_service_endpoints',
|
||||
host=host))
|
||||
|
|
Loading…
Reference in New Issue