Add gnocchi support to packstack
Change-Id: I215ff6dc678642c356712ef0f7cedab323c141af
This commit is contained in:
parent
bef00cf5b7
commit
1a519c733a
@ -62,6 +62,9 @@ Global Options
|
||||
**CONFIG_AODH_INSTALL**
|
||||
Specify 'y' to install OpenStack Telemetry Alarming (Aodh). Note Aodh requires Ceilometer to be installed as well. ['y', 'n']
|
||||
|
||||
**CONFIG_GNOCCHI_INSTALL**
|
||||
Specify 'y' to install OpenStack Metering as a Service (gnocchi). ['y', 'n']
|
||||
|
||||
**CONFIG_HEAT_INSTALL**
|
||||
Specify 'y' to install OpenStack Orchestration (heat). ['y', 'n']
|
||||
|
||||
@ -1064,6 +1067,17 @@ Aodh Config parameters
|
||||
**CONFIG_AODH_KS_PW**
|
||||
Password to use for Telemetry Alarming to authenticate with the Identity service.
|
||||
|
||||
|
||||
Gnocchi Config parameters
|
||||
-------------------------
|
||||
|
||||
**CONFIG_GNOCCHI_DB_PW**
|
||||
Password to use for Gnocchi to access the database.
|
||||
|
||||
**CONFIG_GNOCCHI_KS_PW**
|
||||
Password to use for Gnocchi to authenticate with the Identity service.
|
||||
|
||||
|
||||
Sahara Config parameters
|
||||
------------------------
|
||||
|
||||
|
119
packstack/plugins/gnocchi_820.py
Normal file
119
packstack/plugins/gnocchi_820.py
Normal file
@ -0,0 +1,119 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# 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.
|
||||
|
||||
"""
|
||||
Installs and configures Gnocchi
|
||||
"""
|
||||
|
||||
from packstack.installer import basedefs
|
||||
from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
|
||||
from packstack.modules.documentation import update_params_usage
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- Gnocchi Packstack Plugin Initialization --------------
|
||||
|
||||
PLUGIN_NAME = "OS-Gnocchi"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
|
||||
def initConfig(controller):
|
||||
gnocchi_params = {
|
||||
"GNOCCHI": [
|
||||
{"CONF_NAME": "CONFIG_GNOCCHI_DB_PW",
|
||||
"CMD_OPTION": "gnocchi-db-passwd",
|
||||
"PROMPT": "Enter the password for Gnocchi DB access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
{"CONF_NAME": "CONFIG_GNOCCHI_KS_PW",
|
||||
"CMD_OPTION": "gnocchi-ks-passwd",
|
||||
"PROMPT": "Enter the password for the Gnocchi Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False}
|
||||
]
|
||||
}
|
||||
|
||||
update_params_usage(basedefs.PACKSTACK_DOC, gnocchi_params)
|
||||
|
||||
def use_gnocchi(config):
|
||||
return (config['CONFIG_CEILOMETER_INSTALL'] == 'y' and
|
||||
config['CONFIG_GNOCCHI_INSTALL'] == 'y')
|
||||
|
||||
gnocchi_groups = [
|
||||
{"GROUP_NAME": "GNOCCHI",
|
||||
"DESCRIPTION": "Gnocchi Config parameters",
|
||||
"PRE_CONDITION": use_gnocchi,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
]
|
||||
for group in gnocchi_groups:
|
||||
paramList = gnocchi_params[group["GROUP_NAME"]]
|
||||
controller.addGroup(group, paramList)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
if (controller.CONF['CONFIG_GNOCCHI_INSTALL'] != 'y' or
|
||||
controller.CONF['CONFIG_CEILOMETER_INSTALL'] != 'y'):
|
||||
return
|
||||
|
||||
steps = [{'title': 'Adding Gnocchi manifest entries',
|
||||
'functions': [create_manifest]},
|
||||
{'title': 'Adding Gnocchi Keystone manifest entries',
|
||||
'functions': [create_keystone_manifest]}]
|
||||
controller.addSequence("Installing OpenStack Gnocchi", [], [],
|
||||
steps)
|
||||
|
||||
|
||||
# -------------------------- step functions --------------------------
|
||||
|
||||
def create_manifest(config, messages):
|
||||
manifestfile = "%s_gnocchi.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("gnocchi")
|
||||
|
||||
fw_details = dict()
|
||||
key = "gnocchi_api"
|
||||
fw_details.setdefault(key, {})
|
||||
fw_details[key]['host'] = "ALL"
|
||||
fw_details[key]['service_name'] = "gnocchi-api"
|
||||
fw_details[key]['chain'] = "INPUT"
|
||||
fw_details[key]['ports'] = ['8041']
|
||||
fw_details[key]['proto'] = "tcp"
|
||||
config['FIREWALL_GNOCCHI_RULES'] = fw_details
|
||||
manifestdata += createFirewallResources('FIREWALL_GNOCCHI_RULES')
|
||||
appendManifestFile(manifestfile, manifestdata, 'gnocchi')
|
||||
|
||||
|
||||
def create_keystone_manifest(config, messages):
|
||||
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("keystone_gnocchi")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
@ -122,7 +122,7 @@ def create_manifest(config, messages):
|
||||
|
||||
append_for("keystone", suffix)
|
||||
for mod in ['nova', 'cinder', 'glance', 'neutron', 'heat', 'sahara',
|
||||
'trove', 'ironic', 'manila']:
|
||||
'trove', 'ironic', 'manila', 'gnocchi']:
|
||||
if config['CONFIG_%s_INSTALL' % mod.upper()] == 'y':
|
||||
append_for(mod, suffix)
|
||||
|
||||
|
@ -219,6 +219,21 @@ def initConfig(controller):
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-gnocchi-install",
|
||||
"PROMPT": (
|
||||
"Should Packstack install OpenStack Resource Metering (Gnocchi)"
|
||||
),
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "y",
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_GNOCCHI_INSTALL",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
|
||||
{"CMD_OPTION": "os-sahara-install",
|
||||
"PROMPT": (
|
||||
"Should Packstack install OpenStack Clustering (Sahara)."
|
||||
|
@ -141,10 +141,10 @@ def run_cleanup(config, messages):
|
||||
|
||||
def copy_puppet_modules(config, messages):
|
||||
os_modules = ' '.join(('aodh', 'apache', 'ceilometer', 'certmonger',
|
||||
'cinder', 'concat', 'firewall', 'glance',
|
||||
'heat', 'horizon', 'inifile', 'ironic', 'keystone',
|
||||
'manila', 'memcached', 'mongodb', 'mysql',
|
||||
'neutron', 'nova', 'nssdb', 'openstack',
|
||||
'cinder', 'concat', 'firewall', 'glance', 'galera',
|
||||
'gnocchi', 'heat', 'horizon', 'inifile', 'ironic',
|
||||
'keystone', 'manila', 'memcached', 'mongodb',
|
||||
'mysql', 'neutron', 'nova', 'nssdb', 'openstack',
|
||||
'openstacklib', 'packstack', 'rabbitmq',
|
||||
'redis', 'remote', 'rsync', 'sahara', 'ssh',
|
||||
'stdlib', 'swift', 'sysctl', 'tempest', 'trove',
|
||||
|
44
packstack/puppet/templates/gnocchi.pp
Normal file
44
packstack/puppet/templates/gnocchi.pp
Normal file
@ -0,0 +1,44 @@
|
||||
$gnocchi_cfg_db_pw = hiera('CONFIG_GNOCCHI_DB_PW')
|
||||
$gnocchi_cfg_mariadb_host = hiera('CONFIG_MARIADB_HOST_URL')
|
||||
|
||||
class { '::apache':
|
||||
purge_configs => false,
|
||||
}
|
||||
|
||||
class { '::gnocchi::wsgi::apache':
|
||||
ssl => false,
|
||||
}
|
||||
if hiera('CONFIG_KEYSTONE_SERVICE_NAME') == 'httpd' {
|
||||
apache::listen { '5000': }
|
||||
apache::listen { '35357': }
|
||||
}
|
||||
|
||||
class { '::gnocchi':
|
||||
database_connection => "mysql+pymysql://gnocchi:${gnocchi_cfg_db_pw}@${gnocchi_cfg_mariadb_host}/gnocchi?charset=utf8",
|
||||
}
|
||||
|
||||
$bind_host = hiera('CONFIG_IP_VERSION') ? {
|
||||
'ipv6' => '::0',
|
||||
default => '0.0.0.0',
|
||||
}
|
||||
|
||||
class { '::gnocchi::api':
|
||||
host => $bind_host,
|
||||
keystone_identity_uri => hiera('CONFIG_KEYSTONE_ADMIN_URL'),
|
||||
keystone_password => hiera('CONFIG_GNOCCHI_KS_PW'),
|
||||
keystone_auth_uri => hiera('CONFIG_KEYSTONE_PUBLIC_URL'),
|
||||
service_name => 'httpd',
|
||||
}
|
||||
|
||||
# TO-DO: Remove this workaround as soon as module support is implemented (see rhbz#1300662)
|
||||
gnocchi_config {
|
||||
'keystone_authtoken/auth_version': value => hiera('CONFIG_KEYSTONE_API_VERSION');
|
||||
}
|
||||
|
||||
class { '::gnocchi::db::sync': }
|
||||
class { '::gnocchi::storage': }
|
||||
class { '::gnocchi::storage::file': }
|
||||
|
||||
class {'::gnocchi::metricd': }
|
||||
|
||||
include ::gnocchi::client
|
@ -65,6 +65,11 @@ if hiera('CONFIG_AODH_INSTALL') == 'y' {
|
||||
apache::listen { '8042': }
|
||||
}
|
||||
|
||||
if hiera('CONFIG_GNOCCHI_INSTALL') == 'y' {
|
||||
apache::listen { '8041': }
|
||||
}
|
||||
|
||||
|
||||
# hack for memcached, for now we bind to localhost on ipv6
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1210658
|
||||
$memcached_bind_host = hiera('CONFIG_IP_VERSION') ? {
|
||||
|
9
packstack/puppet/templates/keystone_gnocchi.pp
Normal file
9
packstack/puppet/templates/keystone_gnocchi.pp
Normal file
@ -0,0 +1,9 @@
|
||||
$gnocchi_keystone_host_url = hiera('CONFIG_KEYSTONE_HOST_URL')
|
||||
|
||||
class { '::gnocchi::keystone::auth':
|
||||
region => hiera('CONFIG_KEYSTONE_REGION'),
|
||||
password => hiera('CONFIG_GNOCCHI_KS_PW'),
|
||||
public_url => "http://${gnocchi_keystone_host_url}:8041",
|
||||
admin_url => "http://${gnocchi_keystone_host_url}:8041",
|
||||
internal_url => "http://${gnocchi_keystone_host_url}:8041",
|
||||
}
|
5
packstack/puppet/templates/mariadb_gnocchi_install.pp
Normal file
5
packstack/puppet/templates/mariadb_gnocchi_install.pp
Normal file
@ -0,0 +1,5 @@
|
||||
class { '::gnocchi::db::mysql':
|
||||
password => hiera('CONFIG_GNOCCHI_DB_PW'),
|
||||
host => '%%',
|
||||
allowed_hosts => '%%',
|
||||
}
|
29
packstack/puppet/templates/mariadb_gnocchi_noinstall.pp
Normal file
29
packstack/puppet/templates/mariadb_gnocchi_noinstall.pp
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
remote_database { 'gnocchi':
|
||||
ensure => 'present',
|
||||
charset => 'utf8',
|
||||
db_host => hiera('CONFIG_MARIADB_HOST'),
|
||||
db_user => hiera('CONFIG_MARIADB_USER'),
|
||||
db_password => hiera('CONFIG_MARIADB_PW'),
|
||||
provider => 'mysql',
|
||||
}
|
||||
|
||||
$gnocchi_cfg_db_pw = hiera('CONFIG_GNOCCHI_DB_PW')
|
||||
|
||||
remote_database_user { 'gnocchi@%%':
|
||||
password_hash => mysql_password($gnocchi_cfg_db_pw),
|
||||
db_host => hiera('CONFIG_MARIADB_HOST'),
|
||||
db_user => hiera('CONFIG_MARIADB_USER'),
|
||||
db_password => hiera('CONFIG_MARIADB_PW'),
|
||||
provider => 'mysql',
|
||||
require => Remote_database['gnocchi'],
|
||||
}
|
||||
|
||||
remote_database_grant { 'gnocchi@%%/gnocchi':
|
||||
privileges => 'all',
|
||||
db_host => hiera('CONFIG_MARIADB_HOST'),
|
||||
db_user => hiera('CONFIG_MARIADB_USER'),
|
||||
db_password => hiera('CONFIG_MARIADB_PW'),
|
||||
provider => 'mysql',
|
||||
require => Remote_database_user['gnocchi@%%'],
|
||||
}
|
@ -107,3 +107,7 @@ if hiera('CONFIG_KEYSTONE_SERVICE_NAME') == 'httpd' {
|
||||
if hiera('CONFIG_AODH_INSTALL') == 'y' {
|
||||
apache::listen { '8042': }
|
||||
}
|
||||
|
||||
if hiera('CONFIG_GNOCCHI_INSTALL') == 'y' {
|
||||
apache::listen { '8041': }
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ $nova_available = str2bool(hiera('CONFIG_NOVA_INSTALL'))
|
||||
$neutron_available = str2bool(hiera('CONFIG_NEUTRON_INSTALL'))
|
||||
$ceilometer_available = str2bool(hiera('CONFIG_CEILOMETER_INSTALL'))
|
||||
$aodh_available = str2bool(hiera('CONFIG_AODH_INSTALL'))
|
||||
$gnocchi_available = str2bool(hiera('CONFIG_GNOCCHI_INSTALL'))
|
||||
$trove_available = str2bool(hiera('CONFIG_TROVE_INSTALL'))
|
||||
$sahara_available = str2bool(hiera('CONFIG_SAHARA_INSTALL'))
|
||||
$heat_available = str2bool(hiera('CONFIG_HEAT_INSTALL'))
|
||||
@ -105,6 +106,7 @@ class { '::tempest':
|
||||
neutron_available => $neutron_available,
|
||||
ceilometer_available => $ceilometer_available,
|
||||
aodh_available => $aodh_available,
|
||||
gnocchi_available => $gnocchi_available,
|
||||
trove_available => $trove_available,
|
||||
sahara_available => $sahara_available,
|
||||
heat_available => $heat_available,
|
||||
|
@ -14,6 +14,7 @@ echo -e "Generating packstack config for:
|
||||
- cinder (lvm+iscsi)
|
||||
- ceilometer
|
||||
- aodh
|
||||
- gnocchi
|
||||
- trove
|
||||
- manila
|
||||
- nagios
|
||||
|
@ -23,6 +23,7 @@ echo
|
||||
packstack --allinone \
|
||||
--os-aodh-install=n \
|
||||
--os-ceilometer-install=n \
|
||||
--os-gnocchi-install=n \
|
||||
--os-cinder-install=n \
|
||||
--nagios-install=n \
|
||||
--glance-backend=swift \
|
||||
|
Loading…
Reference in New Issue
Block a user