Configure ceph mon info on 2nd region compute host

compute hosts go to reboot loop after configuring nova_local
with remote backing. The reboot was due to nova go enabled test
failed. Because the ceph monitor info was not configured in
ceph.conf on the compute node, nova-compute process failed to
start due to error connecting to the cluster.

This update configured the ceph mon info on the compute hosts in a
secondary region when the cinder is configured as a shared service
and the region has ceph backend configured. The ceph mon info is
retrieved from the primary.

Change-Id: Ie37fa1126f30bae5318377c8e1d75acc8fa04be1
This commit is contained in:
Tao Liu 2018-03-19 12:47:13 -05:00 committed by Jack Ding
parent aa74264a26
commit 304d78b8c2
3 changed files with 61 additions and 2 deletions

View File

@ -30,13 +30,14 @@ class platform::ceph::params(
$rgw_gc_obj_min_wait = '600',
$rgw_gc_processor_max_time = '300',
$rgw_gc_processor_period = '300',
$configure_ceph_mon_info = false,
) { }
class platform::ceph
inherits ::platform::ceph::params {
if $service_enabled {
if $service_enabled or $configure_ceph_mon_info {
class { '::ceph':
fsid => $cluster_uuid,
authentication_type => $authentication_type,

View File

@ -112,6 +112,7 @@ class sysinv::api (
include sysinv::params
Sysinv_config<||> ~> Service['sysinv-api']
Sysinv_config<||> ~> Exec['sysinv-dbsync']
Sysinv_api_paste_ini<||> ~> Service['sysinv-api']
@ -234,7 +235,10 @@ class sysinv::api (
require => Package['sysinv'],
# Only do the db sync if both controllers are running the same software
# version. Avoids impacting mate controller during an upgrade.
onlyif => "test $::controller_sw_versions_match = true",
onlyif => [
"test $::controller_sw_versions_match = true",
"systemctl status postgresql"
]
}
}

View File

@ -106,6 +106,49 @@ class CephPuppet(openstack.OpenstackBasePuppet):
self._get_service_tenant_name(),
}
def _is_ceph_mon_required(self, host, operator):
# Two conditions that we need to check for:
# 1) If cinder is a shared service and it has a ceph backend
# 2) If remote instance backing is configured on the host
if (constants.SERVICE_TYPE_VOLUME in self._get_shared_services() and
operator.region_has_ceph_backend()):
lvgs = self.dbapi.ilvg_get_by_ihost(host.uuid)
for lvg in lvgs:
if lvg.capabilities.get(constants.LVG_NOVA_PARAM_BACKING) \
== constants.LVG_NOVA_BACKING_REMOTE:
return True
return False
def _get_remote_ceph_mon_info(self, operator):
# retrieve the ceph monitor information from the primary
ceph_mon_info = operator.get_ceph_mon_info()
if ceph_mon_info is None:
return None
cluster_id = ceph_mon_info['cluster_id']
mon_0_addr = self._format_ceph_mon_address(
ceph_mon_info['ceph-mon-0-ip'])
mon_1_addr = self._format_ceph_mon_address(
ceph_mon_info['ceph-mon-1-ip'])
mon_2_addr = self._format_ceph_mon_address(
ceph_mon_info['ceph-mon-2-ip'])
config = {
'platform::ceph::params::configure_ceph_mon_info': True,
'platform::ceph::params::cluster_uuid': cluster_id,
'platform::ceph::params::mon_0_host':
constants.CONTROLLER_0_HOSTNAME,
'platform::ceph::params::mon_1_host':
constants.CONTROLLER_1_HOSTNAME,
'platform::ceph::params::mon_2_host':
constants.STORAGE_0_HOSTNAME,
'platform::ceph::params::mon_0_addr': mon_0_addr,
'platform::ceph::params::mon_1_addr': mon_1_addr,
'platform::ceph::params::mon_2_addr': mon_2_addr,
}
return config
def get_host_config(self, host):
config = {}
if host.personality in [constants.CONTROLLER, constants.STORAGE]:
@ -113,6 +156,17 @@ class CephPuppet(openstack.OpenstackBasePuppet):
if host.personality == constants.STORAGE:
config.update(self._get_ceph_osd_config(host))
# if it is a compute node and on an secondary region,
# check if ceph mon configuration is required
if constants.COMPUTE in host.subfunctions and self._region_config():
from sysinv.conductor import openstack
op = openstack.OpenStackOperator(self.dbapi)
if self._is_ceph_mon_required(host, op):
ceph_mon_info = self._get_remote_ceph_mon_info(op)
if ceph_mon_info is not None:
config.update(ceph_mon_info)
return config
def get_public_url(self):