Merge "Support for Ceilometer installation."

This commit is contained in:
Jenkins 2013-09-06 09:24:31 +00:00 committed by Gerrit Code Review
commit c9504604ba
14 changed files with 219 additions and 10 deletions

6
.gitmodules vendored
View File

@ -76,3 +76,9 @@
[submodule "packstack/puppet/modules/haproxy"]
path = packstack/puppet/modules/haproxy
url = https://github.com/puppetlabs/puppetlabs-haproxy.git
[submodule "packstack/puppet/modules/ceilometer"]
path = packstack/puppet/modules/ceilometer
url = https://github.com/packstack/puppet-ceilometer.git
[submodule "packstack/puppet/modules/mongodb"]
path = packstack/puppet/modules/mongodb
url = https://github.com/puppetlabs/puppetlabs-mongodb.git

View File

@ -0,0 +1,103 @@
# -*- coding: utf-8 -*-
"""
Installs and configures Ceilometer
"""
import logging
import os
import uuid
from packstack.installer import utils
from packstack.installer import validators
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name
PLUGIN_NAME = "OS-Ceilometer"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controllerObject):
global controller
controller = controllerObject
logging.debug("Adding OpenStack Ceilometer configuration")
paramsList = [
{"CMD_OPTION" : "ceilometer-host",
"USAGE" : ("The IP address of the server on which "
"to install Ceilometer"),
"PROMPT" : ("Enter the IP address of the Ceilometer "
"server"),
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_CEILOMETER_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False},
{"CMD_OPTION" : "ceilometer-secret",
"USAGE" : "Secret key for signing metering messages.",
"PROMPT" : "Enter the Ceilometer secret key",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CEILOMETER_SECRET",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False},
{"CMD_OPTION" : "ceilometer-ks-passwd",
"USAGE" : "The password to use for Ceilometer to authenticate with Keystone",
"PROMPT" : "Enter the password for the Ceilometer Keystone access",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CEILOMETER_KS_PW",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False},
]
groupDict = {"GROUP_NAME" : "CEILOMETER",
"DESCRIPTION" : "Ceilometer Config parameters",
"PRE_CONDITION" : "CONFIG_CEILOMETER_INSTALL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH": True}
controller.addGroup(groupDict, paramsList)
def initSequences(controller):
if controller.CONF['CONFIG_CEILOMETER_INSTALL'] != 'y':
return
steps = [{'title': 'Adding Ceilometer manifest entries',
'functions': [create_manifest]},
{'title': 'Adding Ceilometer Keystone manifest entries',
'functions': [create_keystone_manifest]}]
controller.addSequence("Installing OpenStack Ceilometer",[], [],
steps)
def create_manifest(config):
manifestfile = "%s_ceilometer.pp" % config['CONFIG_CEILOMETER_HOST']
manifestdata = getManifestTemplate("ceilometer.pp")
appendManifestFile(manifestfile, manifestdata)
def create_keystone_manifest(config):
manifestfile = "%s_keystone.pp" % config['CONFIG_KEYSTONE_HOST']
manifestdata = getManifestTemplate("keystone_ceilometer.pp")
appendManifestFile(manifestfile, manifestdata)

View File

@ -356,9 +356,11 @@ def create_manifest(config):
manifestfile = "%s_cinder.pp" % controller.CONF['CONFIG_CINDER_HOST']
manifestdata = getManifestTemplate("cinder.pp")
if controller.CONF['CONFIG_CINDER_BACKEND'] == "gluster":
if config['CONFIG_CINDER_BACKEND'] == "gluster":
manifestdata += getManifestTemplate("cinder_gluster.pp")
if controller.CONF['CONFIG_CINDER_BACKEND'] == "nfs":
if config['CONFIG_CINDER_BACKEND'] == "nfs":
manifestdata += getManifestTemplate("cinder_nfs.pp")
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
manifestdata += getManifestTemplate('glance_ceilometer.pp')
appendManifestFile(manifestfile, manifestdata)

View File

@ -95,4 +95,6 @@ def createkeystonemanifest(config):
def createmanifest(config):
manifestfile = "%s_glance.pp" % controller.CONF['CONFIG_GLANCE_HOST']
manifestdata = getManifestTemplate("glance.pp")
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
manifestdata += getManifestTemplate('glance_ceilometer.pp')
appendManifestFile(manifestfile, manifestdata)

View File

@ -456,6 +456,9 @@ def createcomputemanifest(config):
# just warn user to do it by himself
controller.MESSAGES.append(str(ex))
if controller.CONF['CONFIG_CEILOMETER_INSTALL'] == 'y':
manifestdata += getManifestTemplate("nova_ceilometer.pp")
appendManifestFile(manifestfile, manifestdata + "\n" + nova_config_options.getManifestEntry())

View File

@ -107,6 +107,18 @@ def initConfig(controllerObject):
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-ceilometer-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Metering (Ceilometer)",
"PROMPT" : "Should Packstack install OpenStack Metering (Ceilometer)",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CEILOMETER_INSTALL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-client-install",
"USAGE" : "Set to 'y' if you would like Packstack to install the OpenStack Client packages. An admin \"rc\" file will also be installed",
"PROMPT" : "Should Packstack install OpenStack client tools",

View File

@ -75,14 +75,14 @@ def installdeps(config):
def copyPuppetModules(config):
os_modules = ' '.join(('apache', 'cinder', 'concat',
'create_resources', 'firewall',
'glance', 'horizon', 'inifile',
'keystone', 'memcached', 'mysql',
'nova', 'openstack', 'packstack',
'qpid', 'neutron', 'rsync', 'ssh', 'stdlib',
'swift', 'sysctl', 'tempest', 'vcsrepo',
'vlan', 'vswitch', 'xinetd'))
os_modules = ' '.join(('apache', 'ceilometer', 'cinder', 'concat',
'create_resources', 'firewall', 'glance',
'horizon', 'inifile', 'keystone',
'memcached', 'mongodb', 'mysql', 'neutron',
'nova', 'openstack', 'packstack', 'qpid',
'rsync', 'ssh', 'stdlib', 'swift', 'sysctl',
'tempest', 'vcsrepo', 'vlan', 'vswitch',
'xinetd'))
# write puppet manifest to disk
manifestfiles.writeManifests()

@ -0,0 +1 @@
Subproject commit 6aea6ac832835361dd4520e6cd1b501dec682cd4

@ -0,0 +1 @@
Subproject commit 3a0574a4a664cfcff197829eb70976c4862db57a

View File

@ -0,0 +1,44 @@
class { 'mongodb':
enable_10gen => false,
port => '27017',
before => Class['ceilometer::db'],
require => Firewall['001 mongodb incoming localhost'],
}
firewall { '001 mongodb incoming localhost':
proto => 'tcp',
dport => ['27017'],
iniface => 'lo',
#source => 'localhost',
#destination => 'localhost',
action => 'accept',
}
class { 'ceilometer':
metering_secret => '%(CONFIG_CEILOMETER_SECRET)s',
qpid_hostname => '%(CONFIG_QPID_HOST)s',
rpc_backend => 'ceilometer.openstack.common.rpc.impl_qpid',
verbose => true,
debug => true,
}
class { 'ceilometer::db':
database_connection => 'mongodb://localhost:27017/ceilometer',
require => Class['mongodb'],
}
class { 'ceilometer::collector':
require => Class['mongodb'],
}
class { 'ceilometer::agent::central':
auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
auth_password => '%(CONFIG_CEILOMETER_KS_PW)s',
}
class { 'ceilometer::api':
keystone_host => '%(CONFIG_KEYSTONE_HOST)s',
keystone_password => '%(CONFIG_CEILOMETER_KS_PW)s',
require => Class['mongodb'],
}

View File

@ -0,0 +1,4 @@
cinder_config{
'DEFAULT/notification_driver': value => 'cinder.openstack.common.notifier.rpc_notifier'
}

View File

@ -0,0 +1,4 @@
glance_api_config {
'DEFAULT/notifier_strategy': value => 'qpid'
}

View File

@ -0,0 +1,7 @@
class { 'ceilometer::keystone::auth':
password => '%(CONFIG_CEILOMETER_KS_PW)s',
public_address => "%(CONFIG_CEILOMETER_HOST)s",
admin_address => "%(CONFIG_CEILOMETER_HOST)s",
internal_address => "%(CONFIG_CEILOMETER_HOST)s",
}

View File

@ -0,0 +1,20 @@
class { 'ceilometer':
metering_secret => '%(CONFIG_CEILOMETER_SECRET)s',
qpid_hostname => '%(CONFIG_QPID_HOST)s',
rpc_backend => 'ceilometer.openstack.common.rpc.impl_qpid',
verbose => true,
debug => true,
}
class { 'ceilometer::agent::compute':
auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
auth_password => '%(CONFIG_CEILOMETER_KS_PW)s',
}
# if fqdn is not set correctly we have to tell compute agent which host it should query
if !$::fqdn or $::fqdn != $::hostname {
ceilometer_config {
'DEFAULT/host': value => $::hostname
}
}