Wait until all tables for anaylytics are ready

During starting up contrail-collector creates all tables in Cassandra.
This process shouldn't  take place on all contrail-analytics nodes
simultaneously, because it may break Cassandra DB.

To prevent concurrent tables creating, wait_for_cassandra_keyspace is added.

Change-Id: I1a7302414abd542f24f944684c5a4810dbc2b8ad
Signed-off-by: Illia Polliul <ipolliul@mirantis.com>
This commit is contained in:
Pavel Chechetin 2016-12-21 22:04:09 -08:00 committed by Illia Polliul
parent a2e1f5a009
commit ddb2d6e8fb
4 changed files with 102 additions and 5 deletions

View File

@ -0,0 +1,18 @@
# Copyright 2016 Mirantis, 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.
notice('MODULAR: contrail/contrail-analytics-db-wait.pp')
include contrail
class { 'contrail::analytics_db_wait': }

View File

@ -0,0 +1,21 @@
# Copyright 2016 Mirantis, 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.
class contrail::analytics_db_wait {
wait_for_cassandra_keyspace { $contrail::analytics_keyspace:
ensure => ready,
host => $contrail::address,
tables => $contrail::analytics_tables,
}
}

View File

@ -226,4 +226,35 @@ class contrail {
$aaa_mode = pick($settings['aaa_mode'], 'cloud-admin')
$analytics_config_audit_ttl = pick($settings['analytics_config_audit_ttl'], '2160')
$analytics_statistics_ttl = pick($settings['analytics_statistics_ttl'], '24')
$analytics_flow_ttl = pick($settings['analytics_flow_ttl'], '2')
$analytics_data_ttl = pick($settings['analytics_data_ttl'], '48')
$analytics_keyspace = 'ContrailAnalyticsCql'
$analytics_tables = [
'flowrecordtable',
'flowtablevrouterver2',
'statstablebydbltagv3',
'objectvaluetable',
'messagetablemessagetype',
'messagetablekeyword',
'messagetabletimestamp',
'messagetablecategory',
'statstablebyu64strtagv3',
'statstablebyu64tagv3',
'messagetablesource',
'statstablebystrstrtagv3',
'systemobjecttable',
'flowtableprotdpver2',
'statstablebystru64tagv3',
'objecttable',
'statstablebyu64u64tagv3',
'flowtabledvndipver2',
'messagetable',
'statstablebystrtagv3',
'flowtableprotspver2',
'flowtablesvnsipver2',
'messagetablemoduleid'
]
}

View File

@ -284,16 +284,44 @@
type: parallel
###############
#8. Install Contrail Analytics
#8. Install and configure Contrail Analytics Node
###############
#
- id: primary-contrail-analytics-db-wait
type: puppet
version: 2.1.0
groups: [primary-contrail-analytics-db]
required_for: [deploy_end]
requires: [contrail-analytics-db, deploy_start]
cross-depends:
- name: primary-contrail-analytics-all
- name: /contrail-config(-primary|-all)/
- name: /contrail-config-provision(-primary|-all)/
parameters:
puppet_manifest: puppet/manifests/contrail-analytics-db-wait.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
- id: primary-contrail-analytics-all
type: puppet
version: 2.1.0
groups: [primary-contrail-analytics]
required_for: [deploy_end]
requires: [contrail-db-primary]
parameters:
puppet_manifest: puppet/manifests/contrail-analytics.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
- id: contrail-analytics-all
type: puppet
version: 2.1.0
groups: [primary-contrail-analytics,contrail-analytics]
groups: [contrail-analytics]
required_for: [deploy_end]
requires: [contrail-utils, deploy_start]
cross-depends:
- name: primary-contrail-analytics-db-wait
- name: primary-contrail-analytics-all
- name: /contrail-config(-primary|-all)/
- name: /contrail-config-provision(-primary|-all)/
parameters:
@ -305,12 +333,12 @@
#9. Provision Contrail Analytics
################
- id: contrail-analytics-provision-all
- id: contrail-analytics-provision
type: puppet
version: 2.1.0
groups: [primary-contrail-analytics,contrail-analytics]
required_for: [deploy_end]
requires: [contrail-analytics-all]
requires: [primary-contrail-analytics-all, contrail-analytics-all]
parameters:
puppet_manifest: puppet/manifests/contrail-analytics-provision.pp
puppet_modules: puppet/modules:/etc/puppet/modules
@ -423,7 +451,6 @@
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 1440
##############################################################
# Openstack Controller tasks section
##############################################################