Plugins refactor

- Replaced CONFIG_<OS-component>_HOST(S) parameters for CONFIG_CONTROLLER_HOST,
  CONFIG_COMPUTE_HOSTS and CONFIG_NETWORK_HOSTS to minimize count of potential
  deployment architecture to maintainable level
- Unified coding style in plugins, PEP8-tized and forced pep8 check on them

Implements: blueprint simplification

Change-Id: I597f209b62d8d0c3709bb446cb33c804509eef9f
This commit is contained in:
Martin Magr 2014-05-06 14:53:23 +02:00
parent 8f2f18b302
commit 3d92f24ccc
60 changed files with 3129 additions and 3221 deletions

View File

@ -26,15 +26,16 @@ class Step(object):
"Object %s is not callable." % function)
self.function = function
def run(self, config=None):
config = config or {}
def run(self, config=None, messages=None):
config = config if config is not None else {}
messages = messages if messages is not None else []
# TO-DO: complete logger name when logging will be setup correctly
logger = logging.getLogger()
logger.debug('Running step %s.' % self.name)
# execute and report state
try:
self.function(config)
self.function(config, messages)
except Exception, ex:
logger.debug(traceback.format_exc())
state = utils.state_message(self.title, 'ERROR', 'red')
@ -75,16 +76,17 @@ class Sequence(object):
result = config.get(self.condition)
return result == self.cond_match
def run(self, config=None, step=None):
def run(self, config=None, messages=None, step=None):
"""
Runs sequence of steps. Runs only specific step if step's name
is given via 'step' parameter.
"""
config = config or {}
config = config if config is not None else {}
messages = messages if messages is not None else []
if not self.validate_condition(config):
return
if step:
self.steps[step].run(config=config)
self.steps[step].run(config=config, messages=messages)
return
logger = logging.getLogger()
@ -93,4 +95,4 @@ class Sequence(object):
sys.stdout.write('%s\n' % self.title)
sys.stdout.flush()
for step in self.steps.itervalues():
step.run(config=config)
step.run(config=config, messages=messages)

View File

@ -671,15 +671,12 @@ def single_step_install(options):
hosts = [host.strip() for host in hosts.split(',')]
for group in controller.getAllGroups():
for param in group.parameters.itervalues():
# we don't need magic in case CONFIG_NEUTRON_LBAAS_HOSTS
if param.CONF_NAME == 'CONFIG_NEUTRON_LBAAS_HOSTS':
continue
# and directives that contain _HOST are set to the controller node
if param.CONF_NAME.find("_HOST") != -1:
overrides[param.CONF_NAME] = hosts[0]
# If there are more than one host, all but the first are a compute nodes
if len(hosts) > 1:
overrides["CONFIG_NOVA_COMPUTE_HOSTS"] = ','.join(hosts[1:])
overrides["CONFIG_COMPUTE_HOSTS"] = ','.join(hosts[1:])
# We can also override defaults with command line options
_set_command_line_values(options)

View File

@ -35,22 +35,6 @@ class Controller(object):
self.__single = object.__new__(self, *args, **kwargs)
return self.__single
def __init__(self):
# Resources that should be copied to each host along with the puppet
# files, on the remote host the file will be placed in
# $PACKSTACK_VAR_DIR/resources. This controller should copy the files,
# for now the puppet plugin is doing it format
# {'host':[('/path/to/fileordirectory', 'filenameonremotehost'), ..]}
self.resources = {}
def addResource(self, host, localpath, remotename):
""" Populates self.resources """
current_value_for_host = self.resources.get(host, [])
current_value_for_host.append((localpath,remotename))
self.resources[host] = current_value_for_host
# PLugins
def addPlugin(self, plugObj):
self.__PLUGINS.append(plugObj)
@ -81,7 +65,7 @@ class Controller(object):
def runAllSequences(self):
for sequence in self.__SEQUENCES:
sequence.run(self.CONF)
sequence.run(config=self.CONF, messages=self.MESSAGES)
def getSequenceByDesc(self, desc):
for sequence in self.getAllSequences():

View File

@ -2,4 +2,4 @@
def get_mq(config, plugin):
return plugin + "_%s.pp" % config.get('CONFIG_AMQP_SERVER')
return plugin + "_%s.pp" % config.get('CONFIG_AMQP_BACKEND')

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Installs and configures amqp
"""
@ -11,214 +13,221 @@ from packstack.installer import basedefs
from packstack.installer import utils
from packstack.modules.common import filtered_hosts
from packstack.modules.ospluginutils import gethostlist,\
getManifestTemplate,\
appendManifestFile
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name
PLUGIN_NAME = "OS-AMQP"
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "AMQP"
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 AMQP configuration")
paramsList = [
{"CMD_OPTION" : "amqp-server",
"USAGE" : "Set the server for the AMQP service",
"PROMPT" : "Set the server for the AMQP service (qpid, rabbitmq)? ",
"OPTION_LIST" : ["qpid", "rabbitmq"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "rabbitmq",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_AMQP_SERVER",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "amqp-host",
"USAGE" : "The IP address of the server on which to install the AMQP service",
"PROMPT" : "Enter the IP address of the AMQP service",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_AMQP_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "amqp-enable-ssl",
"USAGE" : "Enable SSL for the AMQP service",
"PROMPT" : "Enable SSL for the AMQP service?",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "n",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_AMQP_ENABLE_SSL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "amqp-enable-auth",
"USAGE" : "Enable Authentication for the AMQP service",
"PROMPT" : "Enable Authentication for the AMQP service?",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "n",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_AMQP_ENABLE_AUTH",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
def initConfig(controller):
params = [
{"CMD_OPTION": "amqp-backend",
"USAGE": ("Set the AMQP service backend. Allowed values are: "
"qpid, rabbitmq"),
"PROMPT": "Set the AMQP service backend",
"OPTION_LIST": ["qpid", "rabbitmq"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "rabbitmq",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_AMQP_BACKEND",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "amqp-host",
"USAGE": ("The IP address of the server on which to install the "
"AMQP service"),
"PROMPT": "Enter the IP address of the AMQP service",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_ssh],
"DEFAULT_VALUE": utils.get_localhost_ip(),
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_AMQP_HOST",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
groupDict = { "GROUP_NAME" : "AMQPLANCE",
"DESCRIPTION" : "AMQP Config parameters",
"PRE_CONDITION" : False,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
{"CMD_OPTION": "amqp-enable-ssl",
"USAGE": "Enable SSL for the AMQP service",
"PROMPT": "Enable SSL for the AMQP service?",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_AMQP_ENABLE_SSL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
controller.addGroup(groupDict, paramsList)
{"CMD_OPTION": "amqp-enable-auth",
"USAGE": "Enable Authentication for the AMQP service",
"PROMPT": "Enable Authentication for the AMQP service?",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_AMQP_ENABLE_AUTH",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "AMQP",
"DESCRIPTION": "AMQP Config parameters",
"PRE_CONDITION": False,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
paramsList = [
{"CMD_OPTION" : "amqp-nss-certdb-pw",
"USAGE" : "The password for the NSS certificate database of the AMQP service",
"PROMPT" : "Enter the password for NSS certificate database",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:32],
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_AMQP_NSS_CERTDB_PW",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "amqp-ssl-port",
"USAGE" : "The port in which the AMQP service listens to SSL connections",
"PROMPT" : "Enter the SSL port for the AMQP service",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "5671",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_AMQP_SSL_PORT",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "amqp-ssl-cert-file",
"USAGE" : "The filename of the certificate that the AMQP service is going to use",
"PROMPT" : "Enter the filename of the SSL certificate for the AMQP service",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "/etc/pki/tls/certs/amqp_selfcert.pem",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_AMQP_SSL_CERT_FILE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "amqp-ssl-key-file",
"USAGE" : "The filename of the private key that the AMQP service is going to use",
"PROMPT" : "Enter the private key filename",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "/etc/pki/tls/private/amqp_selfkey.pem",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_AMQP_SSL_KEY_FILE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "amqp-ssl-self-signed",
"USAGE" : "Auto Generates self signed SSL certificate and key",
"PROMPT" : "Generate Self Signed SSL Certificate",
"OPTION_LIST" : ["y","n"],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_AMQP_SSL_SELF_SIGNED",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
params = [
{"CMD_OPTION": "amqp-nss-certdb-pw",
"USAGE": ("The password for the NSS certificate database of the AMQP "
"service"),
"PROMPT": "Enter the password for NSS certificate database",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:32],
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_AMQP_NSS_CERTDB_PW",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
groupDict = { "GROUP_NAME" : "AMQPSSL",
"DESCRIPTION" : "AMQP Config SSL parameters",
"PRE_CONDITION" : "CONFIG_AMQP_ENABLE_SSL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
{"CMD_OPTION": "amqp-ssl-port",
"USAGE": ("The port in which the AMQP service listens to SSL "
"connections"),
"PROMPT": "Enter the SSL port for the AMQP service",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "5671",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_AMQP_SSL_PORT",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
controller.addGroup(groupDict, paramsList)
{"CMD_OPTION": "amqp-ssl-cert-file",
"USAGE": ("The filename of the certificate that the AMQP service "
"is going to use"),
"PROMPT": ("Enter the filename of the SSL certificate for the AMQP "
"service"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "/etc/pki/tls/certs/amqp_selfcert.pem",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_AMQP_SSL_CERT_FILE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
paramsList = [
{"CMD_OPTION" : "amqp-auth-user",
"USAGE" : "User for amqp authentication",
"PROMPT" : "Enter the user for amqp authentication",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "amqp_user",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_AMQP_AUTH_USER",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "amqp-auth-password",
"USAGE" : "Password for user authentication",
"PROMPT" : "Enter the password for user authentication",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_AMQP_AUTH_PASSWORD",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION": "amqp-ssl-key-file",
"USAGE": ("The filename of the private key that the AMQP service "
"is going to use"),
"PROMPT": "Enter the private key filename",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "/etc/pki/tls/private/amqp_selfkey.pem",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_AMQP_SSL_KEY_FILE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
{"CMD_OPTION": "amqp-ssl-self-signed",
"USAGE": "Auto Generates self signed SSL certificate and key",
"PROMPT": "Generate Self Signed SSL Certificate",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "y",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_AMQP_SSL_SELF_SIGNED",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "AMQPSSL",
"DESCRIPTION": "AMQP Config SSL parameters",
"PRE_CONDITION": "CONFIG_AMQP_ENABLE_SSL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
groupDict = { "GROUP_NAME" : "AMQPAUTH",
"DESCRIPTION" : "AMQP Config Athentication parameters",
"PRE_CONDITION" : "CONFIG_AMQP_ENABLE_AUTH",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
params = [
{"CMD_OPTION": "amqp-auth-user",
"USAGE": "User for amqp authentication",
"PROMPT": "Enter the user for amqp authentication",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "amqp_user",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_AMQP_AUTH_USER",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "amqp-auth-password",
"USAGE": "Password for user authentication",
"PROMPT": "Enter the password for user authentication",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_AMQP_AUTH_PASSWORD",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "AMQPAUTH",
"DESCRIPTION": "AMQP Config Athentication parameters",
"PRE_CONDITION": "CONFIG_AMQP_ENABLE_AUTH",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def initSequences(controller):
amqpsteps = [
{'title': 'Adding AMQP manifest entries', 'functions':[createmanifest]}
{'title': 'Adding AMQP manifest entries',
'functions': [create_manifest]}
]
controller.addSequence("Installing AMQP", [], [], amqpsteps)
def createmanifest(config):
manifestfile = "%s_amqp.pp"%config['CONFIG_AMQP_HOST']
manifestdata = ""
#-------------------------- step functions --------------------------
def create_manifest(config, messages):
server = utils.ScriptRunner(config['CONFIG_AMQP_HOST'])
if config['CONFIG_AMQP_ENABLE_SSL'] == 'y':
config['CONFIG_AMQP_ENABLE_SSL'] = 'true'
config['CONFIG_AMQP_PROTOCOL'] = 'ssl'
config['CONFIG_AMQP_CLIENTS_PORT'] = "5671"
if config['CONFIG_AMQP_SSL_SELF_SIGNED'] == 'y':
server.append( "openssl req -batch -new -x509 -nodes -keyout %s -out %s -days 1095"
% (config['CONFIG_AMQP_SSL_KEY_FILE'], config['CONFIG_AMQP_SSL_CERT_FILE']) )
server.append(
"openssl req -batch -new -x509 -nodes -keyout %s "
"-out %s -days 1095"
% (config['CONFIG_AMQP_SSL_KEY_FILE'],
config['CONFIG_AMQP_SSL_CERT_FILE'])
)
server.execute()
else:
#Set default values
# Set default values
config['CONFIG_AMQP_CLIENTS_PORT'] = "5672"
config['CONFIG_AMQP_SSL_PORT'] = "5671"
config['CONFIG_AMQP_SSL_CERT_FILE'] = ""
@ -231,11 +240,12 @@ def createmanifest(config):
config['CONFIG_AMQP_AUTH_PASSWORD'] = 'guest'
config['CONFIG_AMQP_AUTH_USER'] = 'guest'
manifestfile = "%s_amqp.pp" % config['CONFIG_AMQP_HOST']
manifestdata = getManifestTemplate('amqp.pp')
#All hosts should be able to talk to amqp
# All hosts should be able to talk to amqp
config['FIREWALL_SERVICE_NAME'] = "amqp"
config['FIREWALL_PORTS'] = "'5671', '5672'"
config['FIREWALL_PORTS'] = "'5671', '5672'"
config['FIREWALL_CHAIN'] = "INPUT"
for host in filtered_hosts(config, exclude=False):
config['FIREWALL_ALLOWED'] = "'%s'" % host

View File

@ -14,98 +14,81 @@ from packstack.modules.shortcuts import get_mq
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name
#------------------ oVirt installer initialization ------------------
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")
def initConfig(controller):
ceilometer_params = {
"CEILOMETER" : [
{"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,
"CEILOMETER": [
{"CONF_NAME": "CONFIG_CEILOMETER_SECRET",
"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,
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
{"CONF_NAME": "CONFIG_CEILOMETER_KS_PW",
"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},
],
"MONGODB" : [
{"CMD_OPTION" : "mongodb-host",
"USAGE" : ("The IP address of the server on which "
"to install mongodb"),
"PROMPT" : ("Enter the IP address of the mongodb server"),
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
],
"MONGODB": [
{"CMD_OPTION": "mongodb-host",
"USAGE": ("The IP address of the server on which to install "
"MongoDB"),
"PROMPT": "Enter the IP address of the MongoDB server",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_ssh],
"DEFAULT_VALUE": utils.get_localhost_ip(),
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_MONGODB_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False},
"CONF_NAME": "CONFIG_MONGODB_HOST",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
}
ceilometer_groups = [
{"GROUP_NAME" : "CEILOMETER",
"DESCRIPTION" : "Ceilometer Config parameters",
"PRE_CONDITION" : "CONFIG_CEILOMETER_INSTALL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
{"GROUP_NAME": "CEILOMETER",
"DESCRIPTION": "Ceilometer Config parameters",
"PRE_CONDITION": "CONFIG_CEILOMETER_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME" : "MONGODB",
"DESCRIPTION" : "MONGODB Config parameters",
"PRE_CONDITION" : "CONFIG_CEILOMETER_INSTALL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
{"GROUP_NAME": "MONGODB",
"DESCRIPTION": "MONGODB Config parameters",
"PRE_CONDITION": "CONFIG_CEILOMETER_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
]
for group in ceilometer_groups:
paramList = ceilometer_params[group["GROUP_NAME"]]
controller.addGroup(group, paramList)
def initSequences(controller):
if controller.CONF['CONFIG_CEILOMETER_INSTALL'] != 'y':
return
@ -116,14 +99,17 @@ def initSequences(controller):
'functions': [create_manifest]},
{'title': 'Adding Ceilometer Keystone manifest entries',
'functions': [create_keystone_manifest]}]
controller.addSequence("Installing OpenStack Ceilometer",[], [],
controller.addSequence("Installing OpenStack Ceilometer", [], [],
steps)
def create_manifest(config):
manifestfile = "%s_ceilometer.pp" % config['CONFIG_CEILOMETER_HOST']
#-------------------------- step functions --------------------------
def create_manifest(config, messages):
manifestfile = "%s_ceilometer.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate(get_mq(config, "ceilometer"))
manifestdata += getManifestTemplate("ceilometer.pp")
config['FIREWALL_ALLOWED'] = "'ALL'"
config['FIREWALL_SERVICE_NAME'] = 'ceilometer-api'
config['FIREWALL_SERVICE_ID'] = 'ceilometer_api'
@ -136,16 +122,18 @@ def create_manifest(config):
manifestdata += getManifestTemplate("ceilometer_nova_disabled.pp")
appendManifestFile(manifestfile, manifestdata)
def create_mongodb_manifest(config):
def create_mongodb_manifest(config, messages):
manifestfile = "%s_mongodb.pp" % config['CONFIG_MONGODB_HOST']
manifestdata = getManifestTemplate("mongodb.pp")
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CEILOMETER_HOST']
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST']
config['FIREWALL_SERVICE_NAME'] = 'mongodb-server'
config['FIREWALL_PORTS'] = "'27017'"
manifestdata += getManifestTemplate("firewall.pp")
appendManifestFile(manifestfile, manifestdata, 'pre')
def create_keystone_manifest(config):
manifestfile = "%s_keystone.pp" % config['CONFIG_KEYSTONE_HOST']
def create_keystone_manifest(config, messages):
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone_ceilometer.pp")
appendManifestFile(manifestfile, manifestdata)

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Installs and configures Cinder
"""
@ -15,211 +17,188 @@ from packstack.installer.utils import split_hosts
from packstack.installer import basedefs
from packstack.installer import utils
from packstack.modules.shortcuts import get_mq
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
from packstack.installer import exceptions
from packstack.installer import output_messages
# Controller object will
# be initialized from main flow
controller = None
# Plugin name
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Cinder"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controller):
params = [
{"CMD_OPTION": "cinder-db-passwd",
"USAGE": "The password to use for the Cinder to access DB",
"PROMPT": "Enter the password for the Cinder DB access",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_CINDER_DB_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
def initConfig(controllerObject):
global controller
controller = controllerObject
logging.debug("Adding OpenStack Cinder configuration")
paramsList = [
{"CMD_OPTION" : "cinder-host",
"USAGE" : "The IP address of the server on which to install Cinder",
"PROMPT" : "Enter the IP address of the Cinder server",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_CINDER_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "cinder-db-passwd",
"USAGE" : "The password to use for the Cinder to access DB",
"PROMPT" : "Enter the password for the Cinder DB access",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CINDER_DB_PW",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
{"CMD_OPTION" : "cinder-ks-passwd",
"USAGE" : "The password to use for the Cinder to authenticate with Keystone",
"PROMPT" : "Enter the password for the Cinder Keystone access",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CINDER_KS_PW",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
{"CMD_OPTION" : "cinder-backend",
"USAGE" : ("The Cinder backend to use, valid options are: "
"lvm, gluster, nfs, vmdk"),
"PROMPT" : "Enter the Cinder backend to be configured",
"OPTION_LIST" : ["lvm", "gluster", "nfs", "vmdk"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "lvm",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CINDER_BACKEND",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
{"CMD_OPTION": "cinder-ks-passwd",
"USAGE": ("The password to use for the Cinder to authenticate with "
"Keystone"),
"PROMPT": "Enter the password for the Cinder Keystone access",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_CINDER_KS_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
groupDict = { "GROUP_NAME" : "CINDER",
"DESCRIPTION" : "Cinder Config parameters",
"PRE_CONDITION" : "CONFIG_CINDER_INSTALL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
{"CMD_OPTION": "cinder-backend",
"USAGE": ("The Cinder backend to use, valid options are: lvm, "
"gluster, nfs"),
"PROMPT": "Enter the Cinder backend to be configured",
"OPTION_LIST": ["lvm", "gluster", "nfs"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "lvm",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_CINDER_BACKEND",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "CINDER",
"DESCRIPTION": "Cinder Config parameters",
"PRE_CONDITION": "CONFIG_CINDER_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_lvm_options(config):
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'lvm')
paramsList = [
{"CMD_OPTION" : "cinder-volumes-create",
"USAGE" : ("Create Cinder's volumes group. This should only be done for "
"testing on a proof-of-concept installation of Cinder. This "
"will create a file-backed volume group and is not suitable "
"for production usage."),
"PROMPT" : ("Should Cinder's volumes group be created (for proof-of-concept "
"installation)?"),
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CINDER_VOLUMES_CREATE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
groupDict = { "GROUP_NAME" : "CINDERVOLUMECREATE",
"DESCRIPTION" : "Cinder volume create Config parameters",
"PRE_CONDITION" : check_lvm_options,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
params = [
{"CMD_OPTION": "cinder-volumes-create",
"USAGE": ("Create Cinder's volumes group. This should only be done "
"for testing on a proof-of-concept installation of Cinder. "
"This will create a file-backed volume group and is not "
"suitable for production usage."),
"PROMPT": ("Should Cinder's volumes group be created (for "
"proof-of-concept installation)?"),
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_CINDER_VOLUMES_CREATE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "CINDERVOLUMECREATE",
"DESCRIPTION": "Cinder volume create Config parameters",
"PRE_CONDITION": check_lvm_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_lvm_vg_options(config):
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'lvm' and
config.get('CONFIG_CINDER_VOLUMES_CREATE', 'y') == 'y')
paramsList = [
{"CMD_OPTION" : "cinder-volumes-size",
"USAGE" : ("Cinder's volumes group size. Note that actual volume size "
"will be extended with 3% more space for VG metadata."),
"PROMPT" : "Enter Cinder's volumes group usable size",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "20G",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CINDER_VOLUMES_SIZE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
groupDict = { "GROUP_NAME" : "CINDERVOLUMESIZE",
"DESCRIPTION" : "Cinder volume size Config parameters",
"PRE_CONDITION" : check_lvm_vg_options,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
params = [
{"CMD_OPTION": "cinder-volumes-size",
"USAGE": ("Cinder's volumes group size. Note that actual volume size "
"will be extended with 3% more space for VG metadata."),
"PROMPT": "Enter Cinder's volumes group usable size",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "20G",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_CINDER_VOLUMES_SIZE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "CINDERVOLUMESIZE",
"DESCRIPTION": "Cinder volume size Config parameters",
"PRE_CONDITION": check_lvm_vg_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_gluster_options(config):
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'gluster')
paramsList = [
{"CMD_OPTION" : "cinder-gluster-mounts",
"USAGE" : ("A single or comma separated list of gluster volume shares "
"to mount, eg: ip-address:/vol-name, domain:/vol-name "),
"PROMPT" : ("Enter a single or comma separated list of gluster volume "
"shares to use with Cinder"),
"OPTION_LIST" : ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'", \
"^'[a-zA-Z0-9][\-\.\w]*:/.*'"],
"VALIDATORS" : [validators.validate_multi_regexp],
"PROCESSORS" : [processors.process_add_quotes_around_values],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_CINDER_GLUSTER_MOUNTS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
groupDict = { "GROUP_NAME" : "CINDERGLUSTERMOUNTS",
"DESCRIPTION" : "Cinder gluster Config parameters",
"PRE_CONDITION" : check_gluster_options,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
params = [
{"CMD_OPTION": "cinder-gluster-mounts",
"USAGE": ("A single or comma separated list of gluster volume shares "
"to mount, eg: ip-address:/vol-name, domain:/vol-name "),
"PROMPT": ("Enter a single or comma separated list of gluster volume "
"shares to use with Cinder"),
"OPTION_LIST": ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'",
"^'[a-zA-Z0-9][\-\.\w]*:/.*'"],
"VALIDATORS": [validators.validate_multi_regexp],
"PROCESSORS": [processors.process_add_quotes_around_values],
"DEFAULT_VALUE": "",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_CINDER_GLUSTER_MOUNTS",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "CINDERGLUSTERMOUNTS",
"DESCRIPTION": "Cinder gluster Config parameters",
"PRE_CONDITION": check_gluster_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_nfs_options(config):
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'nfs')
paramsList = [
{"CMD_OPTION" : "cinder-nfs-mounts",
"USAGE" : ("A single or comma seprated list of NFS exports to mount, "
"eg: ip-address:/export-name "),
"PROMPT" : ("Enter a single or comma seprated list of NFS exports to "
"use with Cinder"),
"OPTION_LIST" : ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'"],
"VALIDATORS" : [validators.validate_multi_regexp],
"PROCESSORS" : [processors.process_add_quotes_around_values],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_CINDER_NFS_MOUNTS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
groupDict = { "GROUP_NAME" : "CINDERNFSMOUNTS",
"DESCRIPTION" : "Cinder NFS Config parameters",
"PRE_CONDITION" : check_nfs_options,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
params = [
{"CMD_OPTION": "cinder-nfs-mounts",
"USAGE": ("A single or comma seprated list of NFS exports to mount, "
"eg: ip-address:/export-name "),
"PROMPT": ("Enter a single or comma seprated list of NFS exports to "
"use with Cinder"),
"OPTION_LIST": ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'"],
"VALIDATORS": [validators.validate_multi_regexp],
"PROCESSORS": [processors.process_add_quotes_around_values],
"DEFAULT_VALUE": "",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_CINDER_NFS_MOUNTS",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "CINDERNFSMOUNTS",
"DESCRIPTION": "Cinder NFS Config parameters",
"PRE_CONDITION": check_nfs_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def initSequences(controller):
@ -227,30 +206,40 @@ def initSequences(controller):
return
cinder_steps = [
{'title': 'Installing dependencies for Cinder', 'functions':[install_cinder_deps]},
{'title': 'Adding Cinder Keystone manifest entries', 'functions':[create_keystone_manifest]},
{'title': 'Adding Cinder manifest entries', 'functions':[create_manifest]}
{'title': 'Installing dependencies for Cinder',
'functions': [install_cinder_deps]},
{'title': 'Adding Cinder Keystone manifest entries',
'functions': [create_keystone_manifest]},
{'title': 'Adding Cinder manifest entries',
'functions': [create_manifest]}
]
if controller.CONF['CONFIG_CINDER_BACKEND'] == 'lvm':
cinder_steps.append({'title': 'Checking if the Cinder server has a cinder-volumes vg', 'functions':[check_cinder_vg]})
cinder_steps.append(
{'title': 'Checking if the Cinder server has a cinder-volumes vg',
'functions': [check_cinder_vg]})
controller.addSequence("Installing OpenStack Cinder", [], [], cinder_steps)
def install_cinder_deps(config):
server = utils.ScriptRunner(config['CONFIG_CINDER_HOST'])
#-------------------------- step functions --------------------------
def install_cinder_deps(config, messages):
server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
pkgs = []
if config['CONFIG_CINDER_BACKEND'] == 'lvm':
pkgs.append('lvm2')
for p in pkgs:
server.append("rpm -q --whatprovides %(package)s || yum install -y %(package)s" % dict(package=p))
server.append("rpm -q --whatprovides %(package)s || "
"yum install -y %(package)s" % dict(package=p))
server.execute()
def check_cinder_vg(config):
def check_cinder_vg(config, messages):
cinders_volume = 'cinder-volumes'
# Do we have a cinder-volumes vg?
have_cinders_volume = False
server = utils.ScriptRunner(config['CONFIG_CINDER_HOST'])
server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
server.append('vgdisplay %s' % cinders_volume)
try:
server.execute()
@ -259,7 +248,7 @@ def check_cinder_vg(config):
pass
# Configure system LVM settings (snapshot_autoextend)
server = utils.ScriptRunner(config['CONFIG_CINDER_HOST'])
server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
server.append('sed -i -r "s/^ *snapshot_autoextend_threshold +=.*/'
' snapshot_autoextend_threshold = 80/" '
'/etc/lvm/lvm.conf')
@ -271,18 +260,18 @@ def check_cinder_vg(config):
except exceptions.ScriptRuntimeError:
logging.info("Warning: Unable to set system LVM settings.")
if config["CONFIG_CINDER_VOLUMES_CREATE"] != "y":
if not have_cinders_volume:
raise exceptions.MissingRequirements("The cinder server should"
" contain a cinder-volumes volume group")
raise exceptions.MissingRequirements("The cinder server should "
"contain a cinder-volumes "
"volume group")
else:
if have_cinders_volume:
controller.MESSAGES.append(
messages.append(
output_messages.INFO_CINDER_VOLUMES_EXISTS)
return
server = utils.ScriptRunner(config['CONFIG_CINDER_HOST'])
server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
server.append('systemctl')
try:
server.execute()
@ -292,8 +281,6 @@ def check_cinder_vg(config):
server.clear()
logging.info("A new cinder volumes group will be created")
err = "Cinder's volume group '%s' could not be created" % \
cinders_volume
cinders_volume_path = '/var/lib/cinder'
server.append('mkdir -p %s' % cinders_volume_path)
@ -311,7 +298,7 @@ def check_cinder_vg(config):
cinders_volume_size = cinders_volume_size + cinders_reserve
cinders_volume_path = os.path.join(cinders_volume_path, cinders_volume)
server.append('dd if=/dev/zero of=%s bs=1 count=0 seek=%sM'
% (cinders_volume_path, cinders_volume_size))
% (cinders_volume_path, cinders_volume_size))
server.append('LOFI=$(losetup --show -f %s)' % cinders_volume_path)
server.append('pvcreate $LOFI')
server.append('vgcreate %s $LOFI' % cinders_volume)
@ -319,8 +306,8 @@ def check_cinder_vg(config):
# Add the loop device on boot
server.append('grep %(volume)s /etc/rc.d/rc.local || '
'echo "losetup -f %(path)s && '
'vgchange -a y %(volume)s && '
'%(restart_cmd)s" '
'vgchange -a y %(volume)s && '
'%(restart_cmd)s" '
'>> /etc/rc.d/rc.local' %
{'volume': cinders_volume, 'restart_cmd': rst_cmd,
'path': cinders_volume_path})
@ -338,26 +325,27 @@ def check_cinder_vg(config):
# fails.
try:
logging.debug("Release loop device, volume creation failed")
server = utils.ScriptRunner(controller.CONF['CONFIG_CINDER_HOST'])
server.append('losetup -d $(losetup -j %s | cut -d : -f 1)' %
cinders_volume_path
)
server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
server.append('losetup -d $(losetup -j %s | cut -d : -f 1)'
% cinders_volume_path)
server.execute()
except:
pass
raise exceptions.MissingRequirements(err)
raise exceptions.MissingRequirements("Cinder's volume group '%s' "
"could not be created"
% cinders_volume)
def create_keystone_manifest(config):
manifestfile = "%s_keystone.pp" % controller.CONF['CONFIG_KEYSTONE_HOST']
def create_keystone_manifest(config, messages):
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone_cinder.pp")
appendManifestFile(manifestfile, manifestdata)
def create_manifest(config):
def create_manifest(config, messages):
manifestdata = getManifestTemplate(get_mq(config, "cinder"))
manifestfile = "%s_cinder.pp" % controller.CONF['CONFIG_CINDER_HOST']
manifestfile = "%s_cinder.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata += getManifestTemplate("cinder.pp")
if config['CONFIG_CINDER_BACKEND'] == "gluster":
@ -369,15 +357,15 @@ def create_manifest(config):
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
manifestdata += getManifestTemplate('cinder_ceilometer.pp')
if config['CONFIG_SWIFT_INSTALL'] == 'y':
config['CONFIG_SWIFT_PROXY'] = config['CONFIG_SWIFT_PROXY_HOSTS'].split(',')[0].strip()
manifestdata += getManifestTemplate('cinder_backup.pp')
config['FIREWALL_SERVICE_NAME'] = "cinder"
config['FIREWALL_PORTS'] = "'3260', '8776'"
config['FIREWALL_CHAIN'] = "INPUT"
if (config['CONFIG_NOVA_INSTALL'] == 'y' and config['CONFIG_VMWARE_BACKEND']=='n'):
for host in split_hosts(config['CONFIG_NOVA_COMPUTE_HOSTS']):
if (config['CONFIG_NOVA_INSTALL'] == 'y' and
config['CONFIG_VMWARE_BACKEND'] == 'n'):
for host in split_hosts(config['CONFIG_COMPUTE_HOSTS']):
config['FIREWALL_ALLOWED'] = "'%s'" % host
config['FIREWALL_SERVICE_ID'] = "cinder_%s" % host
manifestdata += getManifestTemplate("firewall.pp")

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Installs and configures OpenStack Horizon
"""
@ -11,92 +13,80 @@ from packstack.installer import basedefs, output_messages
from packstack.installer import exceptions
from packstack.installer import utils
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name
PLUGIN_NAME = "OS-HORIZON"
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Horizon"
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 Horizon configuration")
paramsList = [
{"CMD_OPTION" : "os-horizon-host",
"USAGE" : "The IP address of the server on which to install Horizon",
"PROMPT" : "Enter the IP address of the Horizon server",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_HORIZON_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-horizon-ssl",
"USAGE" : "To set up Horizon communication over https set this to \"y\"",
"PROMPT" : "Would you like to set up Horizon communication over https",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "n",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_HORIZON_SSL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
def initConfig(controller):
params = [
{"CMD_OPTION": "os-horizon-ssl",
"USAGE": "To set up Horizon communication over https set this to 'y'",
"PROMPT": "Would you like to set up Horizon communication over https",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_HORIZON_SSL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "OSHORIZON",
"DESCRIPTION": "OpenStack Horizon Config parameters",
"PRE_CONDITION": "CONFIG_HORIZON_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
groupDict = { "GROUP_NAME" : "OSHORIZON",
"DESCRIPTION" : "OpenStack Horizon Config parameters",
"PRE_CONDITION" : "CONFIG_HORIZON_INSTALL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
params = [
{"CMD_OPTION": "os-ssl-cert",
"USAGE": ("PEM encoded certificate to be used for ssl on the https "
"server, leave blank if one should be generated, this "
"certificate should not require a passphrase"),
"PROMPT": ("Enter the path to a PEM encoded certificate to be used "
"on the https server, leave blank if one should be "
"generated, this certificate should not require "
"a passphrase"),
"OPTION_LIST": [],
"VALIDATORS": [],
"DEFAULT_VALUE": '',
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_SSL_CERT",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
controller.addGroup(groupDict, paramsList)
paramsList = [
{"CMD_OPTION" : "os-ssl-cert",
"USAGE" : "PEM encoded certificate to be used for ssl on the https server, leave blank if one should be generated, this certificate should not require a passphrase",
"PROMPT" : "Enter the path to a PEM encoded certificate to be used on the https server, leave blank if one should be generated, this certificate should not require a passphrase",
"OPTION_LIST" : [],
"VALIDATORS" : [],
"DEFAULT_VALUE" : '',
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_SSL_CERT",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-ssl-key",
"USAGE" : "Keyfile corresponding to the certificate if one was entered",
"PROMPT" : "Enter the keyfile corresponding to the certificate if one was entered",
"OPTION_LIST" : [],
"VALIDATORS" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_SSL_KEY",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
groupDict = { "GROUP_NAME" : "OSSSL",
"DESCRIPTION" : "SSL Config parameters",
"PRE_CONDITION" : "CONFIG_HORIZON_SSL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
{"CMD_OPTION": "os-ssl-key",
"USAGE": ("SSL keyfile corresponding to the certificate if one was "
"entered"),
"PROMPT": ("Enter the SSL keyfile corresponding to the certificate "
"if one was entered"),
"OPTION_LIST": [],
"VALIDATORS": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_SSL_KEY",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "OSSSL",
"DESCRIPTION": "SSL Config parameters",
"PRE_CONDITION": "CONFIG_HORIZON_SSL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def initSequences(controller):
@ -104,28 +94,31 @@ def initSequences(controller):
return
steps = [
{'title': 'Adding Horizon manifest entries', 'functions': [createmanifest]}
{'title': 'Adding Horizon manifest entries',
'functions': [create_manifest]}
]
controller.addSequence("Installing OpenStack Horizon", [], [], steps)
def createmanifest(config):
controller.CONF["CONFIG_HORIZON_SECRET_KEY"] = uuid.uuid4().hex
horizon_host = controller.CONF['CONFIG_HORIZON_HOST']
#-------------------------- step functions --------------------------
def create_manifest(config, messages):
config["CONFIG_HORIZON_SECRET_KEY"] = uuid.uuid4().hex
horizon_host = config['CONFIG_CONTROLLER_HOST']
manifestfile = "%s_horizon.pp" % horizon_host
proto = "http"
controller.CONF["CONFIG_HORIZON_PORT"] = "'80'"
config["CONFIG_HORIZON_PORT"] = "'80'"
sslmanifestdata = ''
if controller.CONF["CONFIG_HORIZON_SSL"] == 'y':
controller.CONF["CONFIG_HORIZON_PORT"] = "'443'"
if config["CONFIG_HORIZON_SSL"] == 'y':
config["CONFIG_HORIZON_PORT"] = "'443'"
proto = "https"
sslmanifestdata += getManifestTemplate("https.pp")
# Are we using the users cert/key files
if controller.CONF["CONFIG_SSL_CERT"]:
ssl_cert = controller.CONF["CONFIG_SSL_CERT"]
ssl_key = controller.CONF["CONFIG_SSL_KEY"]
if config["CONFIG_SSL_CERT"]:
ssl_cert = config["CONFIG_SSL_CERT"]
ssl_key = config["CONFIG_SSL_KEY"]
if not os.path.exists(ssl_cert):
raise exceptions.ParamValidationError(
@ -135,13 +128,13 @@ def createmanifest(config):
raise exceptions.ParamValidationError(
"The file %s doesn't exist" % ssl_key)
controller.addResource(horizon_host, ssl_cert, 'ssl_ps_server.crt')
resources = config.setdefault('RESOURCES', {})
host_resources = resources.setdefault(horizon_host, [])
host_resources.append((ssl_cert, 'ssl_ps_server.crt'))
if ssl_key:
controller.addResource(
horizon_host, ssl_key, 'ssl_ps_server.key'
)
host_resources.append(ssl_key, 'ssl_ps_server.key')
else:
controller.MESSAGES.append(
messages.append(
"%sNOTE%s : A certificate was generated to be used for ssl, "
"You should change the ssl certificate configured in "
"/etc/httpd/conf.d/ssl.conf on %s to use a CA signed cert."
@ -151,8 +144,8 @@ def createmanifest(config):
manifestdata += sslmanifestdata
appendManifestFile(manifestfile, manifestdata)
msg = "To access the OpenStack Dashboard browse to %s://%s/dashboard .\n" \
"Please, find your login credentials stored in the keystonerc_admin" \
" in your home directory." % \
(proto, controller.CONF['CONFIG_HORIZON_HOST'])
controller.MESSAGES.append(msg)
msg = ("To access the OpenStack Dashboard browse to %s://%s/dashboard .\n"
"Please, find your login credentials stored in the keystonerc_admin"
" in your home directory."
% (proto, config['CONFIG_CONTROLLER_HOST']))
messages.append(msg)

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Installs and configures Glance
"""
@ -11,68 +13,51 @@ from packstack.installer import utils
from packstack.installer.utils import split_hosts
from packstack.modules.shortcuts import get_mq
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
# Controller object will be initialized from main flow
controller = None
#------------------ oVirt installer initialization ------------------
# Plugin name
PLUGIN_NAME = "OS-Glance"
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 Glance configuration")
paramsList = [
{"CMD_OPTION" : "glance-host",
"USAGE" : "The IP address of the server on which to install Glance",
"PROMPT" : "Enter the IP address of the Glance server",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_GLANCE_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "glance-db-passwd",
"USAGE" : "The password to use for the Glance to access DB",
"PROMPT" : "Enter the password for the Glance DB access",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_GLANCE_DB_PW",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
{"CMD_OPTION" : "glance-ks-passwd",
"USAGE" : "The password to use for the Glance to authenticate with Keystone",
"PROMPT" : "Enter the password for the Glance Keystone access",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_GLANCE_KS_PW",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
]
def initConfig(controller):
params = [
{"CMD_OPTION": "glance-db-passwd",
"USAGE": "The password to use for the Glance to access DB",
"PROMPT": "Enter the password for the Glance DB access",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_GLANCE_DB_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
groupDict = { "GROUP_NAME" : "GLANCE",
"DESCRIPTION" : "Glance Config parameters",
"PRE_CONDITION" : "CONFIG_GLANCE_INSTALL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
{"CMD_OPTION": "glance-ks-passwd",
"USAGE": ("The password to use for the Glance to authenticate "
"with Keystone"),
"PROMPT": "Enter the password for the Glance Keystone access",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_GLANCE_KS_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
]
group = {"GROUP_NAME": "GLANCE",
"DESCRIPTION": "Glance Config parameters",
"PRE_CONDITION": "CONFIG_GLANCE_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def initSequences(controller):
@ -84,27 +69,34 @@ def initSequences(controller):
return
glancesteps = [
{'title': 'Adding Glance Keystone manifest entries', 'functions':[createkeystonemanifest]},
{'title': 'Adding Glance manifest entries', 'functions':[createmanifest]}
{'title': 'Adding Glance Keystone manifest entries',
'functions': [create_keystone_manifest]},
{'title': 'Adding Glance manifest entries',
'functions': [create_manifest]}
]
controller.addSequence("Installing OpenStack Glance", [], [], glancesteps)
def createkeystonemanifest(config):
manifestfile = "%s_keystone.pp" % controller.CONF['CONFIG_KEYSTONE_HOST']
#-------------------------- step functions --------------------------
def create_keystone_manifest(config, messages):
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone_glance.pp")
appendManifestFile(manifestfile, manifestdata)
def createmanifest(config):
manifestfile = "%s_glance.pp" % controller.CONF['CONFIG_GLANCE_HOST']
def create_manifest(config, messages):
manifestfile = "%s_glance.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("glance.pp")
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
manifestdata += getManifestTemplate(get_mq(config, "glance_ceilometer"))
mq_template = get_mq(config, "glance_ceilometer")
manifestdata += getManifestTemplate(mq_template)
config['FIREWALL_SERVICE_NAME'] = "glance"
config['FIREWALL_PORTS'] = "'9292'"
config['FIREWALL_CHAIN'] = "INPUT"
if config['CONFIG_NOVA_INSTALL'] == 'y':
for host in split_hosts(config['CONFIG_NOVA_COMPUTE_HOSTS']):
for host in split_hosts(config['CONFIG_COMPUTE_HOSTS']):
config['FIREWALL_ALLOWED'] = "'%s'" % host
config['FIREWALL_SERVICE_ID'] = "glance_%s" % host
manifestdata += getManifestTemplate("firewall.pp")

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Installs and configures heat
"""
@ -14,216 +16,141 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
manifestfiles,
appendManifestFile)
controller = None
# Plugin name
PLUGIN_NAME = "OS-HEAT"
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Heat"
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 Heat configuration")
def initConfig(controller):
parameters = [
{"CMD_OPTION" : "heat-host",
"USAGE" : ('The IP address of the server on which '
'to install Heat service'),
"PROMPT" : 'Enter the IP address of the Heat service',
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_HEAT_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "heat-mysql-password",
"USAGE" : 'The password used by Heat user to authenticate against MySQL',
"PROMPT" : "Enter the password for the Heat MySQL user",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
{"CMD_OPTION": "os-heat-mysql-password",
"USAGE": ('The password used by Heat user to authenticate against '
'MySQL'),
"PROMPT": "Enter the password for the Heat MySQL user",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_HEAT_DB_PW",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
"CONF_NAME": "CONFIG_HEAT_DB_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
{"CMD_OPTION" : "heat-auth-encryption-key",
"USAGE" : "The encryption key to use for authentication info in database",
"PROMPT" : "Enter the authentication key for Heat to use for authenticate info in database",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
{"CMD_OPTION": "heat-auth-encryption-key",
"USAGE": ("The encryption key to use for authentication info "
"in database"),
"PROMPT": ("Enter the authentication key for Heat to use for "
"authenticate info in database"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_HEAT_AUTH_ENC_KEY",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
"CONF_NAME": "CONFIG_HEAT_AUTH_ENC_KEY",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
{"CMD_OPTION" : "heat-ks-passwd",
"USAGE" : "The password to use for the Heat to authenticate with Keystone",
"PROMPT" : "Enter the password for the Heat Keystone access",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
{"CMD_OPTION": "os-heat-ks-passwd",
"USAGE": ("The password to use for the Heat to authenticate "
"with Keystone"),
"PROMPT": "Enter the password for the Heat Keystone access",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_HEAT_KS_PW",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
"CONF_NAME": "CONFIG_HEAT_KS_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
{"CMD_OPTION" : "os-heat-cloudwatch-install",
"USAGE" : ("Set to 'y' if you would like Packstack to "
"install Heat CloudWatch API"),
"PROMPT" : "Should Packstack install Heat CloudWatch API",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "n",
"MASK_INPUT" : False,
{"CMD_OPTION": "os-heat-cloudwatch-install",
"USAGE": ("Set to 'y' if you would like Packstack to install Heat "
"CloudWatch API"),
"PROMPT": "Should Packstack install Heat CloudWatch API",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_HEAT_CLOUDWATCH_INSTALL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
"CONF_NAME": "CONFIG_HEAT_CLOUDWATCH_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION" : "os-heat-cfn-install",
"USAGE" : ("Set to 'y' if you would like Packstack to "
"install Heat CloudFormation API"),
"PROMPT" : "Should Packstack install Heat CloudFormation API",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "n",
"MASK_INPUT" : False,
{"CMD_OPTION": "os-heat-cfn-install",
"USAGE": ("Set to 'y' if you would like Packstack to install Heat "
"CloudFormation API"),
"PROMPT": "Should Packstack install Heat CloudFormation API",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_HEAT_CFN_INSTALL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
group = {"GROUP_NAME" : "Heat",
"DESCRIPTION" : "Heat Config parameters",
"PRE_CONDITION" : "CONFIG_HEAT_INSTALL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, parameters)
parameters = [
{"CMD_OPTION" : "heat-api-cloudwatch-host",
"USAGE" : ('The IP address of the server on which '
'to install Heat CloudWatch API service'),
"PROMPT" : ('Enter the IP address of the Heat CloudWatch API '
'server'),
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_HEAT_CLOUDWATCH_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
"CONF_NAME": "CONFIG_HEAT_CFN_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
def check_cloudwatch(config):
return config["CONFIG_HEAT_INSTALL"] == 'y' and \
config["CONFIG_HEAT_CLOUDWATCH_INSTALL"] == 'y'
group = {"GROUP_NAME" : "Heat CloudWatch API",
"DESCRIPTION" : "Heat CloudWatch API config parameters",
"PRE_CONDITION" : check_cloudwatch,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, parameters)
parameters = [
{"CMD_OPTION" : "heat-api-cfn-host",
"USAGE" : ('The IP address of the server on which '
'to install Heat CloudFormation API service'),
"PROMPT" : ('Enter the IP address of the Heat CloudFormation '
'API server'),
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_HEAT_CFN_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
def check_cloudformation(config):
return config["CONFIG_HEAT_INSTALL"] == 'y' and \
config["CONFIG_HEAT_CFN_INSTALL"] == 'y'
group = {"GROUP_NAME" : "Heat CloudFormation API",
"DESCRIPTION" : "Heat CloudFormation API config parameters",
"PRE_CONDITION" : check_cloudformation,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
group = {"GROUP_NAME": "Heat",
"DESCRIPTION": "Heat Config parameters",
"PRE_CONDITION": "CONFIG_HEAT_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, parameters)
def initSequences(controller):
if controller.CONF['CONFIG_HEAT_INSTALL'] != 'y':
config = controller.CONF
if config['CONFIG_HEAT_INSTALL'] != 'y':
return
steps = [{'title': 'Adding Heat manifest entries',
'functions': [create_manifest]},
{'title': 'Adding Heat Keystone manifest entries',
'functions':[create_keystone_manifest]}]
steps = [
{'title': 'Adding Heat manifest entries',
'functions': [create_manifest]},
{'title': 'Adding Heat Keystone manifest entries',
'functions': [create_keystone_manifest]}
]
if controller.CONF.get('CONFIG_HEAT_CLOUDWATCH_INSTALL', 'n') == 'y':
steps.append({'title': 'Adding Heat CloudWatch API manifest entries',
'functions': [create_cloudwatch_manifest]})
if controller.CONF.get('CONFIG_HEAT_CFN_INSTALL', 'n') == 'y':
steps.append({'title': 'Adding Heat CloudFormation API manifest entries',
'functions': [create_cfn_manifest]})
if config.get('CONFIG_HEAT_CLOUDWATCH_INSTALL', 'n') == 'y':
steps.append(
{'title': 'Adding Heat CloudWatch API manifest entries',
'functions': [create_cloudwatch_manifest]})
if config.get('CONFIG_HEAT_CFN_INSTALL', 'n') == 'y':
steps.append(
{'title': 'Adding Heat CloudFormation API manifest entries',
'functions': [create_cfn_manifest]})
controller.addSequence("Installing Heat", [], [], steps)
def create_manifest(config):
if config['CONFIG_HEAT_CLOUDWATCH_INSTALL'] == 'y':
config['CONFIG_HEAT_WATCH_HOST'] = config['CONFIG_HEAT_CLOUDWATCH_HOST']
else:
config['CONFIG_HEAT_WATCH_HOST'] = config['CONFIG_HEAT_HOST']
if config['CONFIG_HEAT_CFN_INSTALL'] == 'y':
config['CONFIG_HEAT_METADATA_HOST'] = config['CONFIG_HEAT_CFN_HOST']
else:
config['CONFIG_HEAT_METADATA_HOST'] = config['CONFIG_HEAT_HOST']
#-------------------------- step functions --------------------------
manifestfile = "%s_heat.pp" % controller.CONF['CONFIG_HEAT_HOST']
def create_manifest(config, messages):
manifestfile = "%s_heat.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate(get_mq(config, "heat"))
manifestdata += getManifestTemplate("heat.pp")
appendManifestFile(manifestfile, manifestdata)
def create_keystone_manifest(config):
manifestfile = "%s_keystone.pp" % controller.CONF['CONFIG_KEYSTONE_HOST']
def create_keystone_manifest(config, messages):
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone_heat.pp")
appendManifestFile(manifestfile, manifestdata)
def create_cloudwatch_manifest(config):
manifestfile = "%s_heatcw.pp" % controller.CONF['CONFIG_HEAT_CLOUDWATCH_HOST']
def create_cloudwatch_manifest(config, messages):
manifestfile = "%s_heatcw.pp" % controller.CONF['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate(get_mq(config, "heat"))
manifestdata += getManifestTemplate("heat_cloudwatch.pp")
appendManifestFile(manifestfile, manifestdata, marker='heat')
def create_cfn_manifest(config):
manifestfile = "%s_heatcnf.pp" % controller.CONF['CONFIG_HEAT_CFN_HOST']
def create_cfn_manifest(config, messages):
manifestfile = "%s_heatcnf.pp" % controller.CONF['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate(get_mq(config, "heat"))
manifestdata += getManifestTemplate("heat_cfn.pp")
appendManifestFile(manifestfile, manifestdata, marker='heat')

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Installs and configures Keystone
"""
@ -9,122 +11,112 @@ from packstack.installer import validators
from packstack.installer import basedefs
from packstack.installer import utils
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
from packstack.installer.utils import host_iter
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Keystone"
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 Keystone configuration")
paramsList = [
{"CMD_OPTION" : "keystone-host",
"USAGE" : "The IP address of the server on which to install Keystone",
"PROMPT" : "Enter the IP address of the Keystone server",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_KEYSTONE_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "keystone-db-passwd",
"USAGE" : "The password to use for the Keystone to access DB",
"PROMPT" : "Enter the password for the Keystone DB access",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_KEYSTONE_DB_PW",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
{"CMD_OPTION" : "keystone-admin-token",
"USAGE" : "The token to use for the Keystone service api",
"PROMPT" : "The token to use for the Keystone service api",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex,
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_KEYSTONE_ADMIN_TOKEN",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "keystone-admin-passwd",
"USAGE" : "The password to use for the Keystone admin user",
"PROMPT" : "Enter the password for the Keystone admin user",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_KEYSTONE_ADMIN_PW",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : True,
"CONDITION" : False },
{"CMD_OPTION" : "keystone-demo-passwd",
"USAGE" : "The password to use for the Keystone demo user",
"PROMPT" : "Enter the password for the Keystone demo user",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_KEYSTONE_DEMO_PW",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : True,
"CONDITION" : False },
{"CMD_OPTION" : "keystone-token-format",
"USAGE" : "Kestone token format. Use either UUID or PKI",
"PROMPT" : "Enter the Keystone token format.",
"OPTION_LIST" : ['UUID', 'PKI'],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : 'PKI',
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : 'CONFIG_KEYSTONE_TOKEN_FORMAT',
"USE_DEFAULT" : True,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
def initConfig(controller):
params = [
{"CMD_OPTION": "keystone-db-passwd",
"USAGE": "The password to use for the Keystone to access DB",
"PROMPT": "Enter the password for the Keystone DB access",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_KEYSTONE_DB_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
groupDict = { "GROUP_NAME" : "KEYSTONE",
"DESCRIPTION" : "Keystone Config parameters",
"PRE_CONDITION" : lambda x: 'yes',
"PRE_CONDITION_MATCH" : "yes",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
{"CMD_OPTION": "keystone-admin-token",
"USAGE": "The token to use for the Keystone service api",
"PROMPT": "The token to use for the Keystone service api",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex,
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_KEYSTONE_ADMIN_TOKEN",
"USE_DEFAULT": True,
"NEED_CONFIRM": False,
"CONDITION": False},
controller.addGroup(groupDict, paramsList)
{"CMD_OPTION": "keystone-admin-passwd",
"USAGE": "The password to use for the Keystone admin user",
"PROMPT": "Enter the password for the Keystone admin user",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_KEYSTONE_ADMIN_PW",
"USE_DEFAULT": False,
"NEED_CONFIRM": True,
"CONDITION": False},
{"CMD_OPTION": "keystone-demo-passwd",
"USAGE": "The password to use for the Keystone demo user",
"PROMPT": "Enter the password for the Keystone demo user",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_KEYSTONE_DEMO_PW",
"USE_DEFAULT": False,
"NEED_CONFIRM": True,
"CONDITION": False},
{"CMD_OPTION": "keystone-token-format",
"USAGE": "Kestone token format. Use either UUID or PKI",
"PROMPT": "Enter the Keystone token format.",
"OPTION_LIST": ['UUID', 'PKI'],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": 'PKI',
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": 'CONFIG_KEYSTONE_TOKEN_FORMAT',
"USE_DEFAULT": True,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "KEYSTONE",
"DESCRIPTION": "Keystone Config parameters",
"PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def initSequences(controller):
keystonesteps = [
{'title': 'Adding Keystone manifest entries',
'functions': [create_manifest]},
'functions': [create_manifest]},
]
controller.addSequence("Installing OpenStack Keystone", [], [],
keystonesteps)
def create_manifest(config):
manifestfile = "%s_keystone.pp" % config['CONFIG_KEYSTONE_HOST']
#-------------------------- step functions --------------------------
def create_manifest(config, messages):
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone.pp")
config['FIREWALL_ALLOWED'] = "'ALL'"
config['FIREWALL_SERVICE_NAME'] = "keystone"
config['FIREWALL_SERVICE_ID'] = "keystone"
config['FIREWALL_PORTS'] = "'5000', '35357'"
config['FIREWALL_CHAIN'] = "INPUT"
manifestdata += getManifestTemplate("firewall.pp")
appendManifestFile(manifestfile, manifestdata)

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Installs and configures MySQL
"""
@ -9,79 +11,79 @@ from packstack.installer import validators
from packstack.installer import utils
from packstack.installer.utils import split_hosts
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name
PLUGIN_NAME = "OS-MySQL"
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "MySQL"
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 MySQL OpenStack configuration")
paramsList = [
{"CMD_OPTION" : "mysql-host",
"USAGE" : "The IP address of the server on which to install MySQL",
"PROMPT" : "Enter the IP address of the MySQL server",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_MYSQL_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "mysql-user",
"USAGE" : "Username for the MySQL admin user",
"PROMPT" : "Enter the username for the MySQL admin user",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "root",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_MYSQL_USER",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "mysql-pw",
"USAGE" : "Password for the MySQL admin user",
"PROMPT" : "Enter the password for the MySQL admin user",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_MYSQL_PW",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : True,
"CONDITION" : False },
]
def initConfig(controller):
params = [
{"CMD_OPTION": "mysql-host",
"USAGE": ("The IP address of the server on which to install MySQL or "
"IP address of DB server to use if MySQL installation was "
"not selected"),
"PROMPT": "Enter the IP address of the MySQL server",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_ssh],
"DEFAULT_VALUE": utils.get_localhost_ip(),
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_MYSQL_HOST",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
groupDict = { "GROUP_NAME" : "MYSQL",
"DESCRIPTION" : "MySQL Config parameters",
"PRE_CONDITION" : lambda x: 'yes',
"PRE_CONDITION_MATCH" : "yes",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
{"CMD_OPTION": "mysql-user",
"USAGE": "Username for the MySQL admin user",
"PROMPT": "Enter the username for the MySQL admin user",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "root",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_MYSQL_USER",
"USE_DEFAULT": True,
"NEED_CONFIRM": False,
"CONDITION": False},
controller.addGroup(groupDict, paramsList)
{"CMD_OPTION": "mysql-pw",
"USAGE": "Password for the MySQL admin user",
"PROMPT": "Enter the password for the MySQL admin user",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_MYSQL_PW",
"USE_DEFAULT": False,
"NEED_CONFIRM": True,
"CONDITION": False},
]
group = {"GROUP_NAME": "MYSQL",
"DESCRIPTION": "MySQL Config parameters",
"PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def initSequences(controller):
mysqlsteps = [
{'title': 'Adding MySQL manifest entries',
'functions':[createmanifest]}
{'title': 'Adding MySQL manifest entries',
'functions': [create_manifest]}
]
controller.addSequence("Installing MySQL", [], [], mysqlsteps)
def createmanifest(config):
#-------------------------- step functions --------------------------
def create_manifest(config, messages):
if config['CONFIG_MYSQL_INSTALL'] == 'y':
install = True
suffix = 'install'
@ -89,11 +91,7 @@ def createmanifest(config):
install = False
suffix = 'noinstall'
# In case we are not installing MySQL server, mysql* manifests have
# to be run from Keystone host
host = install and config['CONFIG_MYSQL_HOST'] \
or config['CONFIG_KEYSTONE_HOST']
manifestfile = "%s_mysql.pp" % host
manifestfile = "%s_mysql.pp" % config['CONFIG_MYSQL_HOST']
manifestdata = [getManifestTemplate('mysql_%s.pp' % suffix)]
def append_for(module, suffix):
@ -104,28 +102,12 @@ def createmanifest(config):
manifestdata.append(getManifestTemplate(template))
append_for("keystone", suffix)
hosts = set()
for mod in ['nova', 'cinder', 'glance', 'neutron', 'heat']:
if config['CONFIG_%s_INSTALL' % mod.upper()] == 'y':
append_for(mod, suffix)
# Check wich modules are enabled so we can allow their
# hosts on the firewall
if mod != 'nova' and mod != 'neutron':
hosts.add(config.get('CONFIG_%s_HOST' % mod.upper()).strip())
elif mod == 'neutron':
hosts.add(config.get('CONFIG_NEUTRON_SERVER_HOST').strip())
elif config['CONFIG_NOVA_INSTALL'] != 'n':
#In that remote case that we have lot's of nova hosts
hosts.add(config.get('CONFIG_NOVA_API_HOST').strip())
hosts.add(config.get('CONFIG_NOVA_CERT_HOST').strip())
hosts.add(config.get('CONFIG_NOVA_VNCPROXY_HOST').strip())
hosts.add(config.get('CONFIG_NOVA_CONDUCTOR_HOST').strip())
hosts.add(config.get('CONFIG_NOVA_SCHED_HOST').strip())
if config['CONFIG_NEUTRON_INSTALL'] != 'y':
dbhosts = split_hosts(config['CONFIG_NOVA_NETWORK_HOSTS'])
hosts |= dbhosts
for host in config.get('CONFIG_NOVA_COMPUTE_HOSTS').split(','):
hosts.add(host.strip())
hosts = set([config['CONFIG_CONTROLLER_HOST']])
hosts |= split_hosts(config['CONFIG_COMPUTE_HOSTS'])
config['FIREWALL_SERVICE_NAME'] = "mysql"
config['FIREWALL_PORTS'] = "'3306'"

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Installs and configures Nagios
"""
@ -10,72 +12,55 @@ from packstack.installer import basedefs, output_messages
from packstack.installer import utils
from packstack.modules.common import filtered_hosts
from packstack.modules.ospluginutils import gethostlist,\
getManifestTemplate,\
appendManifestFile
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Nagios"
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 Nagios configuration")
paramsList = [
{"CMD_OPTION" : "nagios-host",
"USAGE" : "The IP address of the server on which to install the Nagios server",
"PROMPT" : "Enter the IP address of the Nagios server",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NAGIOS_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "nagios-passwd",
"USAGE" : "The password of the nagiosadmin user on the Nagios server",
"PROMPT" : "Enter the password for the nagiosadmin user",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NAGIOS_PW",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
groupDict = { "GROUP_NAME" : "NAGIOS",
"DESCRIPTION" : "Nagios Config parameters",
"PRE_CONDITION" : "CONFIG_NAGIOS_INSTALL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
def initConfig(controller):
params = [
{"CMD_OPTION": "nagios-passwd",
"USAGE": "The password of the nagiosadmin user on the Nagios server",
"PROMPT": "Enter the password for the nagiosadmin user",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NAGIOS_PW",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "NAGIOS",
"DESCRIPTION": "Nagios Config parameters",
"PRE_CONDITION": "CONFIG_NAGIOS_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def initSequences(controller):
conf = controller.CONF
if conf['CONFIG_NAGIOS_INSTALL'] != 'y':
if controller.CONF['CONFIG_NAGIOS_INSTALL'] != 'y':
return
nagiossteps = [
{'title': 'Adding Nagios server manifest entries', 'functions':[createmanifest]},
{'title': 'Adding Nagios host manifest entries', 'functions':[createnrpemanifests]}
{'title': 'Adding Nagios server manifest entries',
'functions': [create_manifest]},
{'title': 'Adding Nagios host manifest entries',
'functions': [create_nrpe_manifests]}
]
controller.addSequence("Installing Nagios", [], [], nagiossteps)
#------------------------- helper functions -------------------------
def _serviceentry(**kwargs):
s = 'define service {\n'
for key in sorted(kwargs.keys()):
@ -83,16 +68,18 @@ def _serviceentry(**kwargs):
s += "\t}\n"
return s
def _copy_script(**kwargs):
# TODO : Replace all these shell templates with with python
return ('file{"/usr/lib64/nagios/plugins/%(name)s":'
'mode => 755, owner => "nagios", '
'seltype => "nagios_unconfined_plugin_exec_t", '
'content => template("packstack/%(name)s.erb"),}\n'
'mode => 755, owner => "nagios", '
'seltype => "nagios_unconfined_plugin_exec_t", '
'content => template("packstack/%(name)s.erb"),}\n'
'nagios_command {"%(name)s": '
'command_line => "/usr/lib64/nagios/plugins/%(name)s",}\n'
'command_line => "/usr/lib64/nagios/plugins/%(name)s",}\n'
% kwargs)
def nagios_host(hostname, **kwargs):
out = ("nagios_host { '%s': " % hostname)
for key, value in kwargs.items():
@ -100,81 +87,104 @@ def nagios_host(hostname, **kwargs):
return "%s}\n" % out
def createmanifest(config):
#-------------------------- step functions --------------------------
def create_manifest(config, messages):
manifest_entries = ''
# I should be adding service entries with nagios_service but it appears to be broken
# http://projects.puppetlabs.com/issues/3420
# I should be adding service entries with nagios_service
# but it appears to be broken http://projects.puppetlabs.com/issues/3420
service_entries = ''
for hostname in gethostlist(config):
manifest_entries += nagios_host(hostname, address=hostname, use='linux-server')
for hostname in filtered_hosts(config):
manifest_entries += nagios_host(hostname, address=hostname,
use='linux-server')
service_entries += _serviceentry(name='load5-%s'%hostname, service_description='5 minute load average',
host_name=hostname, check_command="check_nrpe!load5", use="generic-service",
normal_check_interval='5')
service_entries += _serviceentry(
name='load5-%s' % hostname,
service_description='5 minute load average',
host_name=hostname,
check_command="check_nrpe!load5",
use="generic-service",
normal_check_interval='5'
)
service_entries += _serviceentry(name='df_var-%s'%hostname,
service_description='Percent disk space used on /var',
host_name=hostname,
check_command="check_nrpe!df_var", use="generic-service")
service_entries += _serviceentry(
name='df_var-%s' % hostname,
service_description='Percent disk space used on /var',
host_name=hostname,
check_command="check_nrpe!df_var",
use="generic-service"
)
manifest_entries += _copy_script(name="keystone-user-list")
service_entries += _serviceentry(name='keystone-user-list',
service_entries += _serviceentry(
name='keystone-user-list',
service_description='number of keystone users',
host_name=controller.CONF['CONFIG_NAGIOS_HOST'],
check_command="keystone-user-list", use="generic-service",
normal_check_interval='5')
host_name=config['CONFIG_CONTROLLER_HOST'],
check_command="keystone-user-list",
use="generic-service",
normal_check_interval='5'
)
if controller.CONF['CONFIG_GLANCE_INSTALL'] == 'y':
if config['CONFIG_GLANCE_INSTALL'] == 'y':
manifest_entries += _copy_script(name="glance-index")
service_entries += _serviceentry(name='glance-index',
service_entries += _serviceentry(
name='glance-index',
service_description='number of glance images',
host_name=controller.CONF['CONFIG_NAGIOS_HOST'],
host_name=config['CONFIG_CONTROLLER_HOST'],
check_command="glance-index", use="generic-service",
normal_check_interval='5')
normal_check_interval='5'
)
if controller.CONF['CONFIG_NOVA_INSTALL'] == 'y':
if config['CONFIG_NOVA_INSTALL'] == 'y':
manifest_entries += _copy_script(name="nova-list")
service_entries += _serviceentry(name='nova-list',
service_entries += _serviceentry(
name='nova-list',
service_description='number of nova vm instances',
host_name=controller.CONF['CONFIG_NAGIOS_HOST'],
host_name=config['CONFIG_CONTROLLER_HOST'],
check_command="nova-list", use="generic-service",
normal_check_interval='5')
normal_check_interval='5'
)
if controller.CONF['CONFIG_CINDER_INSTALL'] == 'y':
if config['CONFIG_CINDER_INSTALL'] == 'y':
manifest_entries += _copy_script(name="cinder-list")
service_entries += _serviceentry(name='cinder-list',
service_entries += _serviceentry(
name='cinder-list',
service_description='number of cinder volumes',
host_name=controller.CONF['CONFIG_NAGIOS_HOST'],
host_name=config['CONFIG_CONTROLLER_HOST'],
check_command="cinder-list", use="generic-service",
normal_check_interval='5')
normal_check_interval='5'
)
if controller.CONF['CONFIG_SWIFT_INSTALL'] == 'y':
if config['CONFIG_SWIFT_INSTALL'] == 'y':
manifest_entries += _copy_script(name="swift-list")
service_entries += _serviceentry(name='swift-list',
service_entries += _serviceentry(
name='swift-list',
service_description='number of swift containers',
host_name=controller.CONF['CONFIG_NAGIOS_HOST'],
host_name=config['CONFIG_CONTROLLER_HOST'],
check_command="swift-list", use="generic-service",
normal_check_interval='5')
normal_check_interval='5'
)
manifest_entries += ("file { '/etc/nagios/nagios_service.cfg': \n"
"ensure => present, mode => 644,\n"
"owner => 'nagios', group => 'nagios',\n"
"before => Service['nagios'],\n"
"content => '%s'}" % service_entries)
"ensure => present, mode => 644,\n"
"owner => 'nagios', group => 'nagios',\n"
"before => Service['nagios'],\n"
"content => '%s'}" % service_entries)
controller.CONF['CONFIG_NAGIOS_MANIFEST_CONFIG'] = manifest_entries
config['CONFIG_NAGIOS_MANIFEST_CONFIG'] = manifest_entries
manifestfile = "%s_nagios.pp" % controller.CONF['CONFIG_NAGIOS_HOST']
manifestfile = "%s_nagios.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nagios_server.pp")
appendManifestFile(manifestfile, manifestdata)
def createnrpemanifests(config):
for hostname in filtered_hosts(controller.CONF):
controller.CONF['CONFIG_NRPE_HOST'] = hostname
def create_nrpe_manifests(config, messages):
for hostname in filtered_hosts(config):
config['CONFIG_NRPE_HOST'] = hostname
manifestfile = "%s_nagios_nrpe.pp" % hostname
manifestdata = getManifestTemplate("nagios_nrpe.pp")
#Only the Nagios host is allowed to talk to nrpe
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_NAGIOS_HOST']
# Only the Nagios host is allowed to talk to nrpe
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST']
config['FIREWALL_SERVICE_NAME'] = "nagios-nrpe"
config['FIREWALL_SERVICE_ID'] = "nagios_nrpe"
config['FIREWALL_PORTS'] = '5666'
@ -182,7 +192,7 @@ def createnrpemanifests(config):
manifestdata += getManifestTemplate("firewall.pp")
appendManifestFile(manifestfile, manifestdata)
controller.MESSAGES.append("To use Nagios, browse to http://%s/nagios "
"username : nagiosadmin, password : %s" %
(controller.CONF['CONFIG_NAGIOS_HOST'],
controller.CONF['CONFIG_NAGIOS_PW']))
messages.append("To use Nagios, browse to "
"http://%(CONFIG_CONTROLLER_HOST)s/nagios "
"username: nagiosadmin, password: %(CONFIG_NAGIOS_PW)s"
% config)

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Installs and configures nova
"""
@ -12,19 +14,17 @@ from packstack.installer import basedefs, processors, utils, validators
from packstack.installer.exceptions import ScriptRuntimeError
from packstack.modules.shortcuts import get_mq
from packstack.modules.ospluginutils import NovaConfig, getManifestTemplate, appendManifestFile, manifestfiles
from packstack.modules.ospluginutils import (NovaConfig, getManifestTemplate,
appendManifestFile, manifestfiles)
# Controller object will be initialized from main flow
controller = None
PLUGIN_NAME = "OS-NOVA"
#------------------ oVirt installer initialization ------------------
logging.debug("plugin %s loaded", __name__)
PLUGIN_NAME = "OS-Nova"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
def initConfig(controllerObject):
global controller
controller = controllerObject
def initConfig(controller):
if platform.linux_distribution()[0] == "Fedora":
primary_netif = "em1"
secondary_netif = "em2"
@ -33,387 +33,300 @@ def initConfig(controllerObject):
secondary_netif = "eth1"
nova_params = {
"NOVA" : [
{"CMD_OPTION" : "novaapi-host",
"USAGE" : "The IP address of the server on which to install the Nova API service",
"PROMPT" : "Enter the IP address of the Nova API service",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ip, validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_API_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novacert-host",
"USAGE" : "The IP address of the server on which to install the Nova Cert service",
"PROMPT" : "Enter the IP address of the Nova Cert service",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_CERT_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novavncproxy-hosts",
"USAGE" : "The IP address of the server on which to install the Nova VNC proxy",
"PROMPT" : "Enter the IP address of the Nova VNC proxy",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_VNCPROXY_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novacompute-hosts",
"USAGE" : "A comma separated list of IP addresses on which to install the Nova Compute services",
"PROMPT" : "Enter a comma separated list of IP addresses on which to install the Nova Compute services",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty, validators.validate_multi_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_COMPUTE_HOSTS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novaconductor-host",
"USAGE" : "The IP address of the server on which to install the Nova Conductor service",
"PROMPT" : "Enter the IP address of the Nova Conductor service",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ip, validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_CONDUCTOR_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "nova-db-passwd",
"USAGE" : "The password to use for the Nova to access DB",
"PROMPT" : "Enter the password for the Nova DB access",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_NOVA_DB_PW",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
{"CMD_OPTION" : "nova-ks-passwd",
"USAGE" : "The password to use for the Nova to authenticate with Keystone",
"PROMPT" : "Enter the password for the Nova Keystone access",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_NOVA_KS_PW",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
{"CMD_OPTION" : "novasched-host",
"USAGE" : "The IP address of the server on which to install the Nova Scheduler service",
"PROMPT" : "Enter the IP address of the Nova Scheduler service",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_SCHED_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novasched-cpu-allocation-ratio",
"USAGE" : "The overcommitment ratio for virtual to physical CPUs. "
"Set to 1.0 to disable CPU overcommitment",
"PROMPT" : "Enter the CPU overcommitment ratio. "
"Set to 1.0 to disable CPU overcommitment",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_float],
"DEFAULT_VALUE" : 16.0,
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_SCHED_CPU_ALLOC_RATIO",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novasched-ram-allocation-ratio",
"USAGE" : "The overcommitment ratio for virtual to physical RAM. "
"Set to 1.0 to disable RAM overcommitment",
"PROMPT" : "Enter the RAM overcommitment ratio. "
"Set to 1.0 to disable RAM overcommitment",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_float],
"DEFAULT_VALUE" : 1.5,
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_SCHED_RAM_ALLOC_RATIO",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
],
"NOVA_NETWORK" : [
{"CMD_OPTION" : "novacompute-privif",
"USAGE" : "Private interface for Flat DHCP on the Nova compute servers",
"PROMPT" : "Enter the Private interface for Flat DHCP on the Nova compute servers",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : secondary_netif,
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_COMPUTE_PRIVIF",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novanetwork-hosts",
"USAGE" : "The list of IP addresses of the server on which to install the Nova Network service",
"PROMPT" : "Enter list of IP addresses on which to install the Nova Network service",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_multi_ip, validators.validate_multi_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_NETWORK_HOSTS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novanetwork-manager",
"USAGE" : "Nova network manager",
"PROMPT" : "Enter the Nova network manager",
"OPTION_LIST" : [r'^nova\.network\.manager\.\w+Manager$'],
"VALIDATORS" : [validators.validate_regexp],
"DEFAULT_VALUE" : "nova.network.manager.FlatDHCPManager",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_NETWORK_MANAGER",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novanetwork-pubif",
"USAGE" : "Public interface on the Nova network server",
"PROMPT" : "Enter the Public interface on the Nova network server",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : primary_netif,
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_NETWORK_PUBIF",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novanetwork-privif",
"USAGE" : "Private interface for network manager on the Nova network server",
"PROMPT" : "Enter the Private interface for network manager on the Nova network server",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : secondary_netif,
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_NETWORK_PRIVIF",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novanetwork-fixed-range",
"USAGE" : "IP Range for network manager",
"PROMPT" : "Enter the IP Range for network manager",
"OPTION_LIST" : ["^[\:\.\da-fA-f]+(\/\d+){0,1}$"],
"PROCESSORS" : [processors.process_cidr],
"VALIDATORS" : [validators.validate_regexp],
"DEFAULT_VALUE" : "192.168.32.0/22",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_NETWORK_FIXEDRANGE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novanetwork-floating-range",
"USAGE" : "IP Range for Floating IP's",
"PROMPT" : "Enter the IP Range for Floating IP's",
"OPTION_LIST" : ["^[\:\.\da-fA-f]+(\/\d+){0,1}$"],
"PROCESSORS" : [processors.process_cidr],
"VALIDATORS" : [validators.validate_regexp],
"DEFAULT_VALUE" : "10.3.4.0/22",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_NETWORK_FLOATRANGE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novanetwork-default-floating-pool",
"USAGE" : "Name of the default floating pool to which the specified floating ranges are added to",
"PROMPT" : "What should the default floating pool be called?",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "nova",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_NOVA_NETWORK_DEFAULTFLOATINGPOOL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novanetwork-auto-assign-floating-ip",
"USAGE" : "Automatically assign a floating IP to new instances",
"PROMPT" : "Should new instances automatically have a floating IP assigned?",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "n",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_NOVA_NETWORK_AUTOASSIGNFLOATINGIP",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
],
"NOVA_NETWORK_VLAN" : [
{"CMD_OPTION" : "novanetwork-vlan-start",
"USAGE" : "First VLAN for private networks",
"PROMPT" : "Enter first VLAN for private networks",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : 100,
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_NETWORK_VLAN_START",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novanetwork-num-networks",
"USAGE" : "Number of networks to support",
"PROMPT" : "How many networks should be supported",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : 1,
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_NETWORK_NUMBER",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "novanetwork-network-size",
"USAGE" : "Number of addresses in each private subnet",
"PROMPT" : "How many addresses should be in each private subnet",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : 255,
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NOVA_NETWORK_SIZE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
],
}
"NOVA": [
{"CMD_OPTION": "nova-db-passwd",
"USAGE": "The password to use for the Nova to access DB",
"PROMPT": "Enter the password for the Nova DB access",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NOVA_DB_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
{"CMD_OPTION": "nova-ks-passwd",
"USAGE": ("The password to use for the Nova to authenticate "
"with Keystone"),
"PROMPT": "Enter the password for the Nova Keystone access",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NOVA_KS_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
{"CMD_OPTION": "novasched-cpu-allocation-ratio",
"USAGE": ("The overcommitment ratio for virtual to physical CPUs."
" Set to 1.0 to disable CPU overcommitment"),
"PROMPT": "Enter the CPU overcommitment ratio. Set to 1.0 to "
"disable CPU overcommitment",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_float],
"DEFAULT_VALUE": 16.0,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_SCHED_CPU_ALLOC_RATIO",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novasched-ram-allocation-ratio",
"USAGE": ("The overcommitment ratio for virtual to physical RAM. "
"Set to 1.0 to disable RAM overcommitment"),
"PROMPT": ("Enter the RAM overcommitment ratio. Set to 1.0 to "
"disable RAM overcommitment"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_float],
"DEFAULT_VALUE": 1.5,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_SCHED_RAM_ALLOC_RATIO",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
"NOVA_NETWORK": [
{"CMD_OPTION": "novacompute-privif",
"USAGE": ("Private interface for Flat DHCP on the Nova compute "
"servers"),
"PROMPT": ("Enter the Private interface for Flat DHCP on the Nova"
" compute servers"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": secondary_netif,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_COMPUTE_PRIVIF",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-manager",
"USAGE": "Nova network manager",
"PROMPT": "Enter the Nova network manager",
"OPTION_LIST": [r'^nova\.network\.manager\.\w+Manager$'],
"VALIDATORS": [validators.validate_regexp],
"DEFAULT_VALUE": "nova.network.manager.FlatDHCPManager",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_MANAGER",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-pubif",
"USAGE": "Public interface on the Nova network server",
"PROMPT": "Enter the Public interface on the Nova network server",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": primary_netif,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_PUBIF",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-privif",
"USAGE": ("Private interface for network manager on the Nova "
"network server"),
"PROMPT": ("Enter the Private interface for network manager on "
"the Nova network server"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": secondary_netif,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_PRIVIF",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-fixed-range",
"USAGE": "IP Range for network manager",
"PROMPT": "Enter the IP Range for network manager",
"OPTION_LIST": ["^[\:\.\da-fA-f]+(\/\d+){0,1}$"],
"PROCESSORS": [processors.process_cidr],
"VALIDATORS": [validators.validate_regexp],
"DEFAULT_VALUE": "192.168.32.0/22",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_FIXEDRANGE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-floating-range",
"USAGE": "IP Range for Floating IP's",
"PROMPT": "Enter the IP Range for Floating IP's",
"OPTION_LIST": ["^[\:\.\da-fA-f]+(\/\d+){0,1}$"],
"PROCESSORS": [processors.process_cidr],
"VALIDATORS": [validators.validate_regexp],
"DEFAULT_VALUE": "10.3.4.0/22",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_FLOATRANGE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-default-floating-pool",
"USAGE": ("Name of the default floating pool to which the "
"specified floating ranges are added to"),
"PROMPT": "What should the default floating pool be called?",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "nova",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NOVA_NETWORK_DEFAULTFLOATINGPOOL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-auto-assign-floating-ip",
"USAGE": "Automatically assign a floating IP to new instances",
"PROMPT": ("Should new instances automatically have a floating "
"IP assigned?"),
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NOVA_NETWORK_AUTOASSIGNFLOATINGIP",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
"NOVA_NETWORK_VLAN": [
{"CMD_OPTION": "novanetwork-vlan-start",
"USAGE": "First VLAN for private networks",
"PROMPT": "Enter first VLAN for private networks",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": 100,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_VLAN_START",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-num-networks",
"USAGE": "Number of networks to support",
"PROMPT": "How many networks should be supported",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": 1,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_NUMBER",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "novanetwork-network-size",
"USAGE": "Number of addresses in each private subnet",
"PROMPT": "How many addresses should be in each private subnet",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": 255,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NOVA_NETWORK_SIZE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
}
def use_nova_network(config):
return config['CONFIG_NOVA_INSTALL'] == 'y' and \
config['CONFIG_NEUTRON_INSTALL'] != 'y'
return (config['CONFIG_NOVA_INSTALL'] == 'y' and
config['CONFIG_NEUTRON_INSTALL'] != 'y')
def use_nova_network_vlan(config):
manager = 'nova.network.manager.VlanManager'
return config['CONFIG_NOVA_INSTALL'] == 'y' and \
config['CONFIG_NEUTRON_INSTALL'] != 'y' and \
config['CONFIG_NOVA_NETWORK_MANAGER'] == manager
return (config['CONFIG_NOVA_INSTALL'] == 'y' and
config['CONFIG_NEUTRON_INSTALL'] != 'y' and
config['CONFIG_NOVA_NETWORK_MANAGER'] == manager)
nova_groups = [
{"GROUP_NAME" : "NOVA",
"DESCRIPTION" : "Nova Options",
"PRE_CONDITION" : "CONFIG_NOVA_INSTALL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True},
{"GROUP_NAME" : "NOVA_NETWORK",
"DESCRIPTION" : "Nova Network Options",
"PRE_CONDITION" : use_nova_network,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True},
{"GROUP_NAME" : "NOVA_NETWORK_VLAN",
"DESCRIPTION" : "Nova Network VLAN Options",
"PRE_CONDITION" : use_nova_network_vlan,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True},
]
{"GROUP_NAME": "NOVA",
"DESCRIPTION": "Nova Options",
"PRE_CONDITION": "CONFIG_NOVA_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NOVA_NETWORK",
"DESCRIPTION": "Nova Network Options",
"PRE_CONDITION": use_nova_network,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NOVA_NETWORK_VLAN",
"DESCRIPTION": "Nova Network VLAN Options",
"PRE_CONDITION": use_nova_network_vlan,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
]
for group in nova_groups:
paramList = nova_params[group["GROUP_NAME"]]
controller.addGroup(group, paramList)
params = nova_params[group["GROUP_NAME"]]
controller.addGroup(group, params)
def initSequences(controller):
if controller.CONF['CONFIG_NOVA_INSTALL'] != 'y':
return
novaapisteps = [
{'title': 'Adding Nova API manifest entries', 'functions':[createapimanifest]},
{'title': 'Adding Nova Keystone manifest entries', 'functions':[createkeystonemanifest]},
{'title': 'Adding Nova Cert manifest entries', 'functions':[createcertmanifest]},
{'title': 'Adding Nova Conductor manifest entries', 'functions':[createconductormanifest]},
{'title': 'Creating ssh keys for Nova migration',
'functions':[create_ssh_keys]},
{'title': 'Gathering ssh host keys for Nova migration',
'functions':[gather_host_keys]},
{'title': 'Adding Nova Compute manifest entries', 'functions':[createcomputemanifest]},
{'title': 'Adding Nova Scheduler manifest entries', 'functions':[createschedmanifest]},
{'title': 'Adding Nova VNC Proxy manifest entries', 'functions':[createvncproxymanifest]},
{'title': 'Adding Nova Common manifest entries', 'functions':[createcommonmanifest]},
{'title': 'Adding Nova API manifest entries',
'functions': [create_api_manifest]},
{'title': 'Adding Nova Keystone manifest entries',
'functions': [create_keystone_manifest]},
{'title': 'Adding Nova Cert manifest entries',
'functions': [create_cert_manifest]},
{'title': 'Adding Nova Conductor manifest entries',
'functions': [create_conductor_manifest]},
{'title': 'Creating ssh keys for Nova migration',
'functions': [create_ssh_keys]},
{'title': 'Gathering ssh host keys for Nova migration',
'functions': [gather_host_keys]},
{'title': 'Adding Nova Compute manifest entries',
'functions': [create_compute_manifest]},
{'title': 'Adding Nova Scheduler manifest entries',
'functions': [create_sched_manifest]},
{'title': 'Adding Nova VNC Proxy manifest entries',
'functions': [create_vncproxy_manifest]},
{'title': 'Adding Nova Common manifest entries',
'functions': [create_common_manifest]},
]
if controller.CONF['CONFIG_NEUTRON_INSTALL'] == 'y':
novaapisteps.append({'title': 'Adding Openstack Network-related Nova manifest entries', 'functions':[createneutronmanifest]})
novaapisteps.append(
{'title': 'Adding Openstack Network-related Nova manifest entries',
'functions': [create_neutron_manifest]}
)
else:
novaapisteps.append({'title': 'Adding Nova Network manifest entries', 'functions':[createnetworkmanifest]})
controller.addSequence("Installing OpenStack Nova API", [], [], novaapisteps)
novaapisteps.append(
{'title': 'Adding Nova Network manifest entries',
'functions': [create_network_manifest]}
)
controller.addSequence("Installing OpenStack Nova API", [], [],
novaapisteps)
def createapimanifest(config):
# Since this step is running first, let's create necesary variables here
# and make them global
global compute_hosts, network_hosts
com_var = config.get("CONFIG_NOVA_COMPUTE_HOSTS", "")
compute_hosts = set([i.strip() for i in com_var.split(",") if i.strip()])
net_var = config.get("CONFIG_NOVA_NETWORK_HOSTS", "")
network_hosts = set([i.strip() for i in net_var.split(",") if i.strip()])
# This is a hack around us needing to generate the neutron metadata
# password, but the nova puppet plugin uses the existence of that
# password to determine whether or not to configure neutron metadata
# proxy support. So the nova_api.pp template needs unquoted 'undef'
# to disable metadata support if neutron is not being installed.
if controller.CONF['CONFIG_NEUTRON_INSTALL'] != 'y':
controller.CONF['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = 'undef'
else:
controller.CONF['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = \
"'%s'" % controller.CONF['CONFIG_NEUTRON_METADATA_PW']
manifestfile = "%s_api_nova.pp"%controller.CONF['CONFIG_NOVA_API_HOST']
manifestdata = getManifestTemplate("nova_api.pp")
appendManifestFile(manifestfile, manifestdata, 'novaapi')
def createkeystonemanifest(config):
manifestfile = "%s_keystone.pp"%controller.CONF['CONFIG_KEYSTONE_HOST']
manifestdata = getManifestTemplate("keystone_nova.pp")
appendManifestFile(manifestfile, manifestdata)
def createcertmanifest(config):
manifestfile = "%s_nova.pp"%controller.CONF['CONFIG_NOVA_CERT_HOST']
manifestdata = getManifestTemplate("nova_cert.pp")
appendManifestFile(manifestfile, manifestdata)
def createconductormanifest(config):
manifestfile = "%s_nova.pp"%controller.CONF['CONFIG_NOVA_CONDUCTOR_HOST']
manifestdata = getManifestTemplate("nova_conductor.pp")
appendManifestFile(manifestfile, manifestdata)
#------------------------- helper functions -------------------------
def check_ifcfg(host, device):
"""
@ -447,7 +360,9 @@ def bring_up_ifcfg(host, device):
raise ScriptRuntimeError(msg)
def create_ssh_keys(config):
#-------------------------- step functions --------------------------
def create_ssh_keys(config, messages):
migration_key = os.path.join(basedefs.VAR_DIR, 'nova_migration_key')
# Generate key
local = utils.ScriptRunner()
@ -463,7 +378,8 @@ def create_ssh_keys(config):
config['NOVA_MIGRATION_KEY_PUBLIC'] = public.split()[1]
config['NOVA_MIGRATION_KEY_SECRET'] = secret
def gather_host_keys(config):
def gather_host_keys(config, messages):
global compute_hosts
for host in compute_hosts:
@ -472,7 +388,50 @@ def gather_host_keys(config):
retcode, hostkey = local.execute()
config['HOST_KEYS_%s' % host] = hostkey
def createcomputemanifest(config):
def create_api_manifest(config, messages):
# Since this step is running first, let's create necesary variables here
# and make them global
global compute_hosts, network_hosts
com_var = config.get("CONFIG_COMPUTE_HOSTS", "")
compute_hosts = set([i.strip() for i in com_var.split(",") if i.strip()])
net_var = config.get("CONFIG_NETWORK_HOSTS", "")
network_hosts = set([i.strip() for i in net_var.split(",") if i.strip()])
# This is a hack around us needing to generate the neutron metadata
# password, but the nova puppet plugin uses the existence of that
# password to determine whether or not to configure neutron metadata
# proxy support. So the nova_api.pp template needs unquoted 'undef'
# to disable metadata support if neutron is not being installed.
if config['CONFIG_NEUTRON_INSTALL'] != 'y':
config['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = 'undef'
else:
config['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = \
"'%s'" % config['CONFIG_NEUTRON_METADATA_PW']
manifestfile = "%s_api_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_api.pp")
appendManifestFile(manifestfile, manifestdata, 'novaapi')
def create_keystone_manifest(config, messages):
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone_nova.pp")
appendManifestFile(manifestfile, manifestdata)
def create_cert_manifest(config, messages):
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_cert.pp")
appendManifestFile(manifestfile, manifestdata)
def create_conductor_manifest(config, messages):
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_conductor.pp")
appendManifestFile(manifestfile, manifestdata)
def create_compute_manifest(config, messages):
global compute_hosts, network_hosts
ssh_hostkeys = ''
@ -482,15 +441,16 @@ def createcomputemanifest(config):
except socket.herror:
host_name, host_aliases, host_addrs = (host, [], [])
for hostkey in config['HOST_KEYS_%s' %host].split('\n'):
for hostkey in config['HOST_KEYS_%s' % host].split('\n'):
hostkey = hostkey.strip()
if not hostkey:
continue
_, host_key_type, host_key_data = hostkey.split()
config['SSH_HOST_NAME'] = host_name
config['SSH_HOST_ALIASES'] = ','.join('"%s"' % addr
for addr in host_aliases + host_addrs)
config['SSH_HOST_ALIASES'] = ','.join(
'"%s"' % addr for addr in host_aliases + host_addrs
)
config['SSH_HOST_KEY'] = host_key_data
config['SSH_HOST_KEY_TYPE'] = host_key_type
ssh_hostkeys += getManifestTemplate("sshkey.pp")
@ -503,35 +463,35 @@ def createcomputemanifest(config):
else:
manifestdata += getManifestTemplate("nova_compute_libvirt.pp")
if (config['CONFIG_VMWARE_BACKEND'] != 'y' and
config['CONFIG_CINDER_INSTALL'] == 'y' and
config['CONFIG_CINDER_BACKEND'] == 'gluster'):
config['CONFIG_CINDER_INSTALL'] == 'y' and
config['CONFIG_CINDER_BACKEND'] == 'gluster'):
manifestdata += getManifestTemplate("nova_gluster.pp")
if (config['CONFIG_VMWARE_BACKEND'] != 'y' and
config['CONFIG_CINDER_INSTALL'] == 'y' and
config['CONFIG_CINDER_BACKEND'] == 'nfs'):
config['CONFIG_CINDER_INSTALL'] == 'y' and
config['CONFIG_CINDER_BACKEND'] == 'nfs'):
manifestdata += getManifestTemplate("nova_nfs.pp")
manifestfile = "%s_nova.pp" % host
nova_config_options = NovaConfig()
if config['CONFIG_NEUTRON_INSTALL'] != 'y':
if host not in network_hosts:
nova_config_options.addOption("DEFAULT/flat_interface",
config['CONFIG_NOVA_COMPUTE_PRIVIF'])
nova_config_options.addOption(
"DEFAULT/flat_interface",
config['CONFIG_NOVA_COMPUTE_PRIVIF']
)
check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF'])
try:
bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF'])
except ScriptRuntimeError as ex:
# just warn user to do it by himself
controller.MESSAGES.append(str(ex))
messages.append(str(ex))
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
manifestdata += getManifestTemplate(get_mq(config, "nova_ceilometer"))
mq_template = get_mq(config, "nova_ceilometer")
manifestdata += getManifestTemplate(mq_template)
manifestdata += getManifestTemplate("nova_ceilometer.pp")
# According to the docs the only element that connects directly to nova compute
# is nova scheduler
# http://docs.openstack.org/developer/nova/nova.concepts.html#concept-system-architecture
config['FIREWALL_ALLOWED'] = "'%s'" % (config['CONFIG_NOVA_SCHED_HOST'].strip())
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST']
config['FIREWALL_SERVICE_NAME'] = "nova compute"
config['FIREWALL_SERVICE_ID'] = "nova_compute"
config['FIREWALL_PORTS'] = "'5900-5999'"
@ -543,7 +503,7 @@ def createcomputemanifest(config):
appendManifestFile(manifestfile, manifestdata)
def createnetworkmanifest(config):
def create_network_manifest(config, messages):
global compute_hosts, network_hosts
if config['CONFIG_NEUTRON_INSTALL'] == "y":
return
@ -554,7 +514,7 @@ def createnetworkmanifest(config):
('CONFIG_NOVA_NETWORK_NUMBER', 1)]:
config[key] = config.get(key, value)
api_host = config['CONFIG_NOVA_API_HOST']
api_host = config['CONFIG_CONTROLLER_HOST']
multihost = len(network_hosts) > 1
config['CONFIG_NOVA_NETWORK_MULTIHOST'] = multihost and 'true' or 'false'
for host in network_hosts:
@ -564,14 +524,14 @@ def createnetworkmanifest(config):
bring_up_ifcfg(host, config[i])
except ScriptRuntimeError as ex:
# just warn user to do it by himself
controller.MESSAGES.append(str(ex))
messages.append(str(ex))
key = 'CONFIG_NOVA_NETWORK_AUTOASSIGNFLOATINGIP'
config[key] = config[key] == "y"
# We need to explicitly set the network size
routing_prefix = config['CONFIG_NOVA_NETWORK_FIXEDRANGE'].split('/')[1]
net_size = 2**(32 - int(routing_prefix))
net_size = 2 ** (32 - int(routing_prefix))
config['CONFIG_NOVA_NETWORK_FIXEDSIZE'] = str(net_size)
manifestfile = "%s_nova.pp" % host
@ -583,29 +543,24 @@ def createnetworkmanifest(config):
appendManifestFile(manifestfile, manifestdata)
def createschedmanifest(config):
manifestfile = "%s_nova.pp"%controller.CONF['CONFIG_NOVA_SCHED_HOST']
def create_sched_manifest(config, messages):
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_sched.pp")
appendManifestFile(manifestfile, manifestdata)
def createvncproxymanifest(config):
manifestfile = "%s_nova.pp"%controller.CONF['CONFIG_NOVA_VNCPROXY_HOST']
def create_vncproxy_manifest(config, messages):
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_vncproxy.pp")
appendManifestFile(manifestfile, manifestdata)
def createcommonmanifest(config):
def create_common_manifest(config, messages):
global compute_hosts, network_hosts
network_type = (config['CONFIG_NEUTRON_INSTALL'] == "y" and
'neutron' or 'nova')
network_multi = len(network_hosts) > 1
dirty = [config.get('CONFIG_NOVA_CONDUCTOR_HOST'),
config.get('CONFIG_NOVA_API_HOST'),
config.get('CONFIG_NOVA_CERT_HOST'),
config.get('CONFIG_NOVA_VNCPROXY_HOST'),
config.get('CONFIG_NOVA_SCHED_HOST')]
dbacces_hosts = set([i.strip() for i in dirty if i and i.strip()])
dbacces_hosts = set([config.get('CONFIG_CONTROLLER_HOST')])
dbacces_hosts |= network_hosts
for manifestfile, marker in manifestfiles.getFiles():
@ -625,10 +580,10 @@ def createcommonmanifest(config):
# for nova-network in multihost mode each compute host is metadata
# host otherwise we use api host
if (network_type == 'nova' and network_multi and
host in compute_hosts):
host in compute_hosts):
metadata = host
else:
metadata = config['CONFIG_NOVA_API_HOST']
metadata = config['CONFIG_CONTROLLER_HOST']
config['CONFIG_NOVA_METADATA_HOST'] = metadata
data = getManifestTemplate(get_mq(config, "nova_common"))
@ -636,11 +591,12 @@ def createcommonmanifest(config):
appendManifestFile(os.path.split(manifestfile)[1], data)
def createneutronmanifest(config):
if controller.CONF['CONFIG_NEUTRON_INSTALL'] != "y":
def create_neutron_manifest(config, messages):
if config['CONFIG_NEUTRON_INSTALL'] != "y":
return
controller.CONF['CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver'
virt_driver = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver'
config['CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = virt_driver
for manifestfile, marker in manifestfiles.getFiles():
if manifestfile.endswith("_nova.pp"):

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Installs and configures an OpenStack Client
"""
@ -9,44 +11,24 @@ from packstack.installer import validators
from packstack.installer import basedefs, output_messages
from packstack.installer import utils
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name
PLUGIN_NAME = "OS-CLIENT"
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Client"
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 Client configuration")
paramsList = [
{"CMD_OPTION" : "osclient-host",
"USAGE" : "The IP address of the server on which to install the OpenStack client packages. An admin \"rc\" file will also be installed",
"PROMPT" : "Enter the IP address of the client server",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_OSCLIENT_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
groupDict = { "GROUP_NAME" : "NOVACLIENT",
"DESCRIPTION" : "NOVACLIENT Config parameters",
"PRE_CONDITION" : "CONFIG_CLIENT_INSTALL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
def initConfig(controller):
group = {"GROUP_NAME": "NOVACLIENT",
"DESCRIPTION": "NOVACLIENT Config parameters",
"PRE_CONDITION": "CONFIG_CLIENT_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, [])
def initSequences(controller):
@ -54,13 +36,17 @@ def initSequences(controller):
return
osclientsteps = [
{'title': 'Adding OpenStack Client manifest entries', 'functions':[createmanifest]}
{'title': 'Adding OpenStack Client manifest entries',
'functions': [create_manifest]}
]
controller.addSequence("Installing OpenStack Client", [], [], osclientsteps)
controller.addSequence("Installing OpenStack Client", [], [],
osclientsteps)
def createmanifest(config):
client_host = config['CONFIG_OSCLIENT_HOST'].strip()
#-------------------------- step functions --------------------------
def create_manifest(config, messages):
client_host = config['CONFIG_CONTROLLER_HOST'].strip()
manifestfile = "%s_osclient.pp" % client_host
server = utils.ScriptRunner(client_host)
@ -83,9 +69,9 @@ def createmanifest(config):
msg = ("File %s/keystonerc_admin has been created on OpenStack client host"
" %s. To use the command line tools you need to source the file.")
controller.MESSAGES.append(msg % (root_home, client_host))
messages.append(msg % (root_home, client_host))
if no_root_allinone:
msg = ("Copy of keystonerc_admin file has been created for non-root "
"user in %s.")
controller.MESSAGES.append(msg % homedir)
messages.append(msg % homedir)

View File

@ -1,50 +1,52 @@
# -*- coding: utf-8 -*-
"""
Installs and configures an OpenStack Client
"""
import logging
from packstack.installer import utils
from packstack.modules.common import filtered_hosts
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name
PLUGIN_NAME = "OS-POSTSCRIPT"
#------------------ oVirt installer initialization ------------------
logging.debug("plugin %s loaded", __name__)
def initConfig(controllerObject):
global controller
controller = controllerObject
logging.debug("Executing post run scripts")
PLUGIN_NAME = "Postscript"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
groupDict = {"GROUP_NAME" : "POSTSCRIPT",
"DESCRIPTION" : "POSTSCRIPT Config parameters",
"PRE_CONDITION" : lambda x: 'yes',
"PRE_CONDITION_MATCH" : "yes",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, [])
def initConfig(controller):
group = {"GROUP_NAME": "POSTSCRIPT",
"DESCRIPTION": "POSTSCRIPT Config parameters",
"PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, [])
def initSequences(controller):
osclientsteps = [
{'title': 'Adding post install manifest entries', 'functions':[createmanifest]}
postscript_steps = [
{'title': 'Adding post install manifest entries',
'functions': [create_manifest]}
]
controller.addSequence("Running post install scripts", [], [], osclientsteps)
controller.addSequence("Running post install scripts", [], [],
postscript_steps)
def createmanifest(config):
#-------------------------- step functions --------------------------
def create_manifest(config, messages):
for hostname in filtered_hosts(config):
manifestfile = "%s_postscript.pp" % hostname
manifestdata = getManifestTemplate("postscript.pp")
appendManifestFile(manifestfile, manifestdata, 'postscript')
if config.get("CONFIG_PROVISION_ALL_IN_ONE_OVS_BRIDGE") != 'n':
config['EXT_BRIDGE_VAR'] = config['CONFIG_NEUTRON_L3_EXT_BRIDGE'].replace('-','_')
fmted = config['CONFIG_NEUTRON_L3_EXT_BRIDGE'].replace('-', '_')
config['EXT_BRIDGE_VAR'] = fmted
manifestdata = getManifestTemplate("persist_ovs_bridge.pp")
appendManifestFile(manifestfile, manifestdata, 'postscript')

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Plugin responsible for setting OpenStack global options
"""
@ -16,310 +18,399 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile)
# Controller object will be initialized from main flow
controller = None
#------------------ oVirt installer initialization ------------------
# Plugin name
PLUGIN_NAME = "OS-PRESCRIPT"
logging.debug("plugin %s loaded", __name__)
PLUGIN_NAME = "Prescript"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
def initConfig(controllerObject):
global controller
controller = controllerObject
def initConfig(controller):
default_ssh_key = os.path.join(os.environ["HOME"], ".ssh/*.pub")
default_ssh_key = (glob.glob(default_ssh_key) + [""])[0]
params = [
{"CMD_OPTION": "ssh-public-key",
"USAGE": ("Path to a Public key to install on servers. If a usable "
"key has not been installed on the remote servers the user "
"will be prompted for a password and this key will be "
"installed so the password will not be required again"),
"PROMPT": ("Enter the path to your ssh Public key to install "
"on servers"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_file, validators.validate_sshkey],
"PROCESSORS": [processors.process_ssh_key],
"DEFAULT_VALUE": default_ssh_key,
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SSH_KEY",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
paramsList = [{"CMD_OPTION" : "ssh-public-key",
"USAGE" : "Path to a Public key to install on servers. If a usable key has not been installed on the remote servers the user will be prompted for a password and this key will be installed so the password will not be required again",
"PROMPT" : "Enter the path to your ssh Public key to install on servers",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_file,
validators.validate_sshkey],
"PROCESSORS" : [processors.process_ssh_key],
"DEFAULT_VALUE" : (glob.glob(os.path.join(os.environ["HOME"], ".ssh/*.pub"))+[""])[0],
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SSH_KEY",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-mysql-install",
"USAGE" : "Set to 'y' if you would like Packstack to install MySQL",
"PROMPT" : "Should Packstack install MySQL DB",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_MYSQL_INSTALL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-glance-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Image Service (Glance)",
"PROMPT" : "Should Packstack install OpenStack Image Service (Glance)",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_GLANCE_INSTALL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-cinder-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Block Storage (Cinder)",
"PROMPT" : "Should Packstack install OpenStack Block Storage (Cinder) service",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CINDER_INSTALL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-nova-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Compute (Nova)",
"PROMPT" : "Should Packstack install OpenStack Compute (Nova) service",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_NOVA_INSTALL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-neutron-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Networking (Neutron)",
"PROMPT" : "Should Packstack install OpenStack Networking (Neutron) service",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_NEUTRON_INSTALL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-horizon-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Dashboard (Horizon)",
"PROMPT" : "Should Packstack install OpenStack Dashboard (Horizon)",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_HORIZON_INSTALL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-swift-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Object Storage (Swift)",
"PROMPT" : "Should Packstack install OpenStack Object Storage (Swift)",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SWIFT_INSTALL",
"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-heat-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Orchestration (Heat)",
"PROMPT" : "Should Packstack install OpenStack Orchestration (Heat)",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "n",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_HEAT_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",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CLIENT_INSTALL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "ntp-servers",
"USAGE" : "Comma separated list of NTP servers. Leave plain if Packstack should not install ntpd on instances.",
"PROMPT" : "Enter a comma separated list of NTP server(s). Leave plain if Packstack should not install ntpd on instances.",
"OPTION_LIST" : [],
"DEFAULT_VALUE" : '',
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_NTP_SERVERS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "nagios-install",
"USAGE" : "Set to 'y' if you would like Packstack to install Nagios to monitor OpenStack hosts",
"PROMPT" : "Should Packstack install Nagios to monitor OpenStack hosts",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : 'y',
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_NAGIOS_INSTALL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "exclude-servers",
"USAGE" : "Comma separated list of servers to be excluded from installation in case you are running Packstack the second time with the same answer file and don't want Packstack to touch these servers. Leave plain if you don't need to exclude any server.",
"PROMPT" : "Enter a comma separated list of server(s) to be excluded. Leave plain if you don't need to exclude any server.",
"OPTION_LIST" : [],
"DEFAULT_VALUE" : '',
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "EXCLUDE_SERVERS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-debug-mode",
"USAGE" : ("Set to 'y' if you want to run "
"OpenStack services in debug mode. "
"Otherwise set to 'n'."),
"PROMPT" : ("Do you want to run OpenStack services"
" in debug mode"),
"OPTION_LIST" : ["y", "n"],
"DEFAULT_VALUE" : "n",
"VALIDATORS" : [validators.validate_options],
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_DEBUG_MODE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-vmware",
"USAGE" : ("Set to 'y' if you want to use "
"VMware vCenter as hypervisor and storage"
"Otherwise set to 'n'."),
"PROMPT" : ("Do you want to use VMware vCenter as"
" hypervisor and datastore"),
"OPTION_LIST" : ["y","n"],
"DEFAULT_VALUE" : "n",
"VALIDATORS" : [validators.validate_options],
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_VMWARE_BACKEND",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
groupDict = { "GROUP_NAME" : "GLOBAL",
"DESCRIPTION" : "Global Options",
"PRE_CONDITION" : lambda x: 'yes',
"PRE_CONDITION_MATCH" : "yes",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
{"CMD_OPTION": "mysql-install",
"USAGE": "Set to 'y' if you would like Packstack to install MySQL",
"PROMPT": "Should Packstack install MySQL DB",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_MYSQL_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "os-glance-install",
"USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Image Service (Glance)"),
"PROMPT": "Should Packstack install OpenStack Image Service (Glance)",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_GLANCE_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "os-cinder-install",
"USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Block Storage (Cinder)"),
"PROMPT": ("Should Packstack install OpenStack Block Storage "
"(Cinder) service"),
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_CINDER_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "os-nova-install",
"USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Compute (Nova)"),
"PROMPT": "Should Packstack install OpenStack Compute (Nova) service",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NOVA_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "os-neutron-install",
"USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Networking (Neutron). Otherwise Nova Network "
"will be used."),
"PROMPT": ("Should Packstack install OpenStack Networking (Neutron) "
"service"),
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NEUTRON_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "os-horizon-install",
"USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Dashboard (Horizon)"),
"PROMPT": "Should Packstack install OpenStack Dashboard (Horizon)",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_HORIZON_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "os-swift-install",
"USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Object Storage (Swift)"),
"PROMPT": "Should Packstack install OpenStack Object Storage (Swift)",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SWIFT_INSTALL",
"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-heat-install",
"USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Orchestration (Heat)"),
"PROMPT": "Should Packstack install OpenStack Orchestration (Heat)",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_HEAT_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",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_CLIENT_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "ntp-servers",
"USAGE": ("Comma separated list of NTP servers. Leave plain if "
"Packstack should not install ntpd on instances."),
"PROMPT": ("Enter a comma separated list of NTP server(s). Leave "
"plain if Packstack should not install ntpd "
"on instances."),
"OPTION_LIST": [],
"DEFAULT_VALUE": '',
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NTP_SERVERS",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "nagios-install",
"USAGE": ("Set to 'y' if you would like Packstack to install Nagios "
"to monitor OpenStack hosts"),
"PROMPT": ("Should Packstack install Nagios to monitor OpenStack "
"hosts"),
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": 'y',
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NAGIOS_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "exclude-servers",
"USAGE": ("Comma separated list of servers to be excluded from "
"installation in case you are running Packstack the second "
"time with the same answer file and don't want Packstack "
"to touch these servers. Leave plain if you don't need to "
"exclude any server."),
"PROMPT": ("Enter a comma separated list of server(s) to be excluded."
" Leave plain if you don't need to exclude any server."),
"OPTION_LIST": [],
"DEFAULT_VALUE": '',
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "EXCLUDE_SERVERS",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "os-debug-mode",
"USAGE": ("Set to 'y' if you want to run OpenStack services in debug "
"mode. Otherwise set to 'n'."),
"PROMPT": "Do you want to run OpenStack services in debug mode",
"OPTION_LIST": ["y", "n"],
"DEFAULT_VALUE": "n",
"VALIDATORS": [validators.validate_options],
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_DEBUG_MODE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CONF_NAME": "CONFIG_CONTROLLER_HOST",
"CMD_OPTION": "os-controller-host",
"USAGE": ("The IP address of the server on which to install OpenStack"
" services specific to controller role such as API servers,"
" Horizon, etc."),
"PROMPT": "Enter the IP address of the controller host",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_ip,
validators.validate_ssh],
"DEFAULT_VALUE": utils.get_localhost_ip(),
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CONF_NAME": "CONFIG_COMPUTE_HOSTS",
"CMD_OPTION": "os-compute-hosts",
"USAGE": ("The list of IP addresses of the server on which to install"
" the Nova compute service"),
"PROMPT": ("Enter list of IP addresses on which to install compute "
"service"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_multi_ip,
validators.validate_multi_ssh],
"DEFAULT_VALUE": utils.get_localhost_ip(),
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CONF_NAME": "CONFIG_NETWORK_HOSTS",
"CMD_OPTION": "os-network-hosts",
"USAGE": ("The list of IP addresses of the server on which "
"to install the network service such as Nova "
"network or Neutron"),
"PROMPT": ("Enter list of IP addresses on which to install "
"network service"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_multi_ip,
validators.validate_multi_ssh],
"DEFAULT_VALUE": utils.get_localhost_ip(),
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "os-vmware",
"USAGE": ("Set to 'y' if you want to use VMware vCenter as hypervisor"
" and storage. Otherwise set to 'n'."),
"PROMPT": ("Do you want to use VMware vCenter as hypervisor and "
"datastore"),
"OPTION_LIST": ["y", "n"],
"DEFAULT_VALUE": "n",
"VALIDATORS": [validators.validate_options],
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_VMWARE_BACKEND",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "GLOBAL",
"DESCRIPTION": "Global Options",
"PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def use_vcenter(config):
return (config['CONFIG_NOVA_INSTALL'] == 'y' and
return (config['CONFIG_NOVA_INSTALL'] == 'y' and
config['CONFIG_VMWARE_BACKEND'] == 'y')
paramsList = [
{"CMD_OPTION" : "vcenter-host",
"USAGE" : ("The IP address of the VMware vCenter server"),
"PROMPT" : ("Enter the IP address of the VMware vCenter server to use with Nova"),
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ip],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_VCENTER_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "vcenter-username",
"USAGE" : ("The username to authenticate to VMware vCenter server"),
"PROMPT" : ("Enter the username to authenticate on VMware vCenter server"),
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_VCENTER_USER",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False,},
{"CMD_OPTION" : "vcenter-password",
"USAGE" : ("The password to authenticate to VMware vCenter server"),
"PROMPT" : ("Enter the password to authenticate on VMware vCenter server"),
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_VCENTER_PASSWORD",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False,},
{"CMD_OPTION" : "vcenter-cluster",
"USAGE" : ("The name of the vCenter cluster"),
"PROMPT" : ("Enter the name of the vCenter datastore"),
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_VCENTER_CLUSTER_NAME",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False,},
]
params = [
{"CMD_OPTION": "vcenter-host",
"USAGE": "The IP address of the VMware vCenter server",
"PROMPT": ("Enter the IP address of the VMware vCenter server to use "
"with Nova"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_ip],
"DEFAULT_VALUE": "",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_VCENTER_HOST",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
groupDict = {"GROUP_NAME" : "VMWARE",
"DESCRIPTION" : "vCenter Config Parameters",
"PRE_CONDITION" : use_vcenter,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
{"CMD_OPTION": "vcenter-username",
"USAGE": "The username to authenticate to VMware vCenter server",
"PROMPT": ("Enter the username to authenticate on VMware "
"vCenter server"),
"DEFAULT_VALUE": "",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_VCENTER_USER",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "vcenter-password",
"USAGE": "The password to authenticate to VMware vCenter server",
"PROMPT": ("Enter the password to authenticate on VMware "
"vCenter server"),
"DEFAULT_VALUE": "",
"MASK_INPUT": True,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_VCENTER_PASSWORD",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "vcenter-cluster",
"USAGE": "The name of the vCenter cluster",
"PROMPT": "Enter the name of the vCenter datastore",
"DEFAULT_VALUE": "",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_VCENTER_CLUSTER_NAME",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "VMWARE",
"DESCRIPTION": "vCenter Config Parameters",
"PRE_CONDITION": use_vcenter,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def initSequences(controller):
prescript_steps = [
{'title': 'Setting up ssh keys',
'functions':[install_keys]},
'functions': [install_keys]},
{'title': 'Discovering hosts\' details',
'functions': [discover]},
'functions': [discover]},
{'title': 'Adding pre install manifest entries',
'functions':[create_manifest]},
'functions': [create_manifest]},
]
if controller.CONF['CONFIG_NTP_SERVERS']:
prescript_steps.append({
'title': 'Installing time synchronization via NTP',
'functions': [create_ntp_manifest],
})
prescript_steps.append(
{'title': 'Installing time synchronization via NTP',
'functions': [create_ntp_manifest]})
else:
controller.MESSAGES.append('Time synchronization installation '
'was skipped. Please note that '
'unsynchronized time on server '
'instances might be problem for '
'some OpenStack components.')
controller.MESSAGES.append('Time synchronization installation was '
'skipped. Please note that unsynchronized '
'time on server instances might be problem '
'for some OpenStack components.')
controller.addSequence("Running pre install scripts", [], [],
prescript_steps)
def install_keys(config):
#-------------------------- step functions --------------------------
def install_keys(config, messages):
with open(config["CONFIG_SSH_KEY"]) as fp:
sshkeydata = fp.read().strip()
for hostname in filtered_hosts(config):
@ -337,7 +428,7 @@ def install_keys(config):
server.execute()
def discover(config):
def discover(config, messages):
"""
Discovers details about hosts.
"""
@ -382,7 +473,7 @@ def discover(config):
config['HOST_DETAILS'] = details
def create_manifest(config):
def create_manifest(config, messages):
key = 'CONFIG_DEBUG_MODE'
config[key] = config[key] == 'y' and 'true' or 'false'
@ -392,7 +483,7 @@ def create_manifest(config):
appendManifestFile(manifestfile, manifestdata)
def create_ntp_manifest(config):
def create_ntp_manifest(config, messages):
srvlist = [i.strip()
for i in config['CONFIG_NTP_SERVERS'].split(',')
if i.strip()]

View File

@ -1,9 +1,12 @@
# -*- coding: utf-8 -*-
"""
Installs and configures neutron
"""
import logging
from packstack.installer import utils
from packstack.installer import validators
from packstack.modules.common import is_all_in_one
@ -11,118 +14,111 @@ from packstack.modules.ospluginutils import (appendManifestFile,
getManifestTemplate)
# Controller object will be initialized from main flow
controller = None
#------------------ oVirt installer initialization ------------------
# Plugin name
PLUGIN_NAME = "OS-Provision"
logging.debug("plugin %s loaded", __name__)
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
def initConfig(controllerObject):
global controller
controller = controllerObject
logging.debug("Provisioning OpenStack resources for demo usage and testing")
def initConfig(controller):
def process_provision(param, process_args=None):
return param if is_all_in_one(controller.CONF) else 'n'
conf_params = {
"PROVISION_INIT" : [
{"CMD_OPTION" : "provision-demo",
"USAGE" : ("Whether to provision for demo usage and testing. Note "
"that provisioning is only supported for all-in-one "
"installations."),
"PROMPT" : "Would you like to provision for demo usage and testing?",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"PROCESSORS" : [process_provision],
"DEFAULT_VALUE" : "y",
"MASK_INPUT" : False,
"PROVISION_INIT": [
{"CMD_OPTION": "provision-demo",
"USAGE": ("Whether to provision for demo usage and testing. Note "
"that provisioning is only supported for all-in-one "
"installations."),
"PROMPT": ("Would you like to provision for demo usage "
"and testing"),
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_PROVISION_DEMO",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "provision-tempest",
"USAGE" : ("Whether to configure tempest for testing. Note "
"that provisioning is only supported for all-in-one "
"installations."),
"PROMPT" : "Would you like to configure Tempest (OpenStack test suite)?",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"PROCESSORS" : [process_provision],
"DEFAULT_VALUE" : "n",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_PROVISION_TEMPEST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
],
"PROVISION_DEMO" : [
{"CMD_OPTION" : "provision-demo-floatrange",
"USAGE" : "The CIDR network address for the floating IP subnet",
"PROMPT" : "Enter the network address for the floating IP subnet:",
"OPTION_LIST" : False,
"VALIDATORS" : False,
"DEFAULT_VALUE" : "172.24.4.224/28",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_PROVISION_DEMO_FLOATRANGE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
],
"TEMPEST_GIT_REFS" : [
{"CMD_OPTION" : "provision-tempest-repo-uri",
"USAGE" : "The uri of the tempest git repository to use",
"PROMPT" : "What is the uri of the Tempest git repository?",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "https://github.com/openstack/tempest.git",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_PROVISION_TEMPEST_REPO_URI",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "provision-tempest-repo-revision",
"USAGE" : "The revision of the tempest git repository to use",
"PROMPT" : "What revision, branch, or tag of the Tempest git repository should be used?",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "master",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_PROVISION_TEMPEST_REPO_REVISION",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
],
"PROVISION_ALL_IN_ONE_OVS_BRIDGE" : [
{"CMD_OPTION" : "provision-all-in-one-ovs-bridge",
"USAGE" : "Whether to configure the ovs external bridge in an all-in-one deployment",
"PROMPT" : "Would you like to configure the external ovs bridge?",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "n",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_PROVISION_ALL_IN_ONE_OVS_BRIDGE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
],
}
"CONF_NAME": "CONFIG_PROVISION_DEMO",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
def allow_provisioning(config):
# Provisioning is currently supported only for all-in-one (due
# to a limitation with how the custom types for OpenStack
# resources are implemented).
return is_all_in_one(config)
{"CMD_OPTION": "provision-tempest",
"USAGE": "Whether to configure tempest for testing",
"PROMPT": ("Would you like to configure Tempest (OpenStack test "
"suite). Note that provisioning is only supported for "
"all-in-one installations."),
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_PROVISION_TEMPEST",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
"PROVISION_DEMO": [
{"CMD_OPTION": "provision-demo-floatrange",
"USAGE": "The CIDR network address for the floating IP subnet",
"PROMPT": "Enter the network address for the floating IP subnet",
"OPTION_LIST": False,
"VALIDATORS": False,
"DEFAULT_VALUE": "172.24.4.224/28",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_PROVISION_DEMO_FLOATRANGE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
"TEMPEST_GIT_REFS": [
{"CMD_OPTION": "provision-tempest-repo-uri",
"USAGE": "The uri of the tempest git repository to use",
"PROMPT": "What is the uri of the Tempest git repository?",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "https://github.com/openstack/tempest.git",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_PROVISION_TEMPEST_REPO_URI",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "provision-tempest-repo-revision",
"USAGE": "The revision of the tempest git repository to use",
"PROMPT": ("What revision, branch, or tag of the Tempest git "
"repository should be used"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "master",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_PROVISION_TEMPEST_REPO_REVISION",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
"PROVISION_ALL_IN_ONE_OVS_BRIDGE": [
{"CMD_OPTION": "provision-all-in-one-ovs-bridge",
"USAGE": ("Whether to configure the ovs external bridge in an "
"all-in-one deployment"),
"PROMPT": "Would you like to configure the external ovs bridge",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_PROVISION_ALL_IN_ONE_OVS_BRIDGE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
],
}
def check_provisioning_demo(config):
return (allow_provisioning(config) and
@ -130,39 +126,42 @@ def initConfig(controllerObject):
config.get('CONFIG_PROVISION_TEMPEST', 'n') == 'y'))
def check_provisioning_tempest(config):
return allow_provisioning(config) and \
config.get('CONFIG_PROVISION_TEMPEST', 'n') == 'y'
return (allow_provisioning(config) and
config.get('CONFIG_PROVISION_TEMPEST', 'n') == 'y')
def allow_all_in_one_ovs_bridge(config):
return allow_provisioning(config) and \
config['CONFIG_NEUTRON_INSTALL'] == 'y' and \
config['CONFIG_NEUTRON_L2_PLUGIN'] == 'openvswitch'
return (allow_provisioning(config) and
config['CONFIG_NEUTRON_INSTALL'] == 'y' and
config['CONFIG_NEUTRON_L2_PLUGIN'] == 'openvswitch')
conf_groups = [
{ "GROUP_NAME" : "PROVISION_INIT",
"DESCRIPTION" : "Provisioning demo config",
"PRE_CONDITION" : lambda x: 'yes',
"PRE_CONDITION_MATCH" : "yes",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True },
{ "GROUP_NAME" : "PROVISION_DEMO",
"DESCRIPTION" : "Provisioning demo config",
"PRE_CONDITION" : check_provisioning_demo,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True },
{ "GROUP_NAME" : "TEMPEST_GIT_REFS",
"DESCRIPTION" : "Optional tempest git uri and branch",
"PRE_CONDITION" : check_provisioning_tempest,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True },
{ "GROUP_NAME" : "PROVISION_ALL_IN_ONE_OVS_BRIDGE",
"DESCRIPTION" : "Provisioning all-in-one ovs bridge config",
"PRE_CONDITION" : allow_all_in_one_ovs_bridge,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True },
{"GROUP_NAME": "PROVISION_INIT",
"DESCRIPTION": "Provisioning demo config",
"PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "PROVISION_DEMO",
"DESCRIPTION": "Provisioning demo config",
"PRE_CONDITION": allow_provisioning,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "TEMPEST_GIT_REFS",
"DESCRIPTION": "Optional tempest git uri and branch",
"PRE_CONDITION": check_provisioning_tempest,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "PROVISION_ALL_IN_ONE_OVS_BRIDGE",
"DESCRIPTION": "Provisioning all-in-one ovs bridge config",
"PRE_CONDITION": allow_all_in_one_ovs_bridge,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
]
for group in conf_groups:
paramList = conf_params[group["GROUP_NAME"]]
@ -182,6 +181,30 @@ def initConfig(controllerObject):
controller.CONF[param.CONF_NAME] = value
def initSequences(controller):
config = controller.CONF
provisioning_required = (
config['CONFIG_PROVISION_DEMO'] == 'y'
or
config['CONFIG_PROVISION_TEMPEST'] == 'y'
)
if not provisioning_required or not allow_provisioning(config):
return
marshall_conf_bool(config, 'CONFIG_PROVISION_TEMPEST')
marshall_conf_bool(config, 'CONFIG_PROVISION_ALL_IN_ONE_OVS_BRIDGE')
provision_steps = [
{'title': 'Adding Provisioning manifest entries',
'functions': [create_manifest]}
]
controller.addSequence("Provisioning for Demo and Testing Usage",
[], [], provision_steps)
#------------------------- helper functions -------------------------
def marshall_conf_bool(conf, key):
if conf[key] == 'y':
conf[key] = 'true'
@ -189,34 +212,19 @@ def marshall_conf_bool(conf, key):
conf[key] = 'false'
def initSequences(controller):
provisioning_required = (
controller.CONF['CONFIG_PROVISION_DEMO'] == 'y'
or
controller.CONF['CONFIG_PROVISION_TEMPEST'] == 'y'
)
if not provisioning_required:
return
marshall_conf_bool(controller.CONF, 'CONFIG_PROVISION_TEMPEST')
marshall_conf_bool(controller.CONF,
'CONFIG_PROVISION_ALL_IN_ONE_OVS_BRIDGE')
provision_steps = [
{
'title': 'Adding Provisioning manifest entries',
'functions': [create_manifest],
}
]
controller.addSequence("Provisioning for Demo and Testing Usage",
[], [], provision_steps)
def allow_provisioning(config):
# Provisioning is currently supported only for all-in-one (due
# to a limitation with how the custom types for OpenStack
# resources are implemented).
return is_all_in_one(config)
def create_manifest(config):
#-------------------------- step functions --------------------------
def create_manifest(config, messages):
# Using the neutron or nova api servers as the provisioning target
# will suffice for the all-in-one case.
if config['CONFIG_NEUTRON_INSTALL'] == "y":
host = config['CONFIG_NEUTRON_SERVER_HOST']
else:
host = config['CONFIG_NOVA_API_HOST']
if config['CONFIG_NEUTRON_INSTALL'] != "y":
# The provisioning template requires the name of the external
# bridge but the value will be missing if neutron isn't
# configured to be installed.
@ -228,6 +236,6 @@ def create_manifest(config):
config['PROVISION_NEUTRON_AVAILABLE'] = config['CONFIG_NEUTRON_INSTALL']
marshall_conf_bool(config, 'PROVISION_NEUTRON_AVAILABLE')
manifest_file = '%s_provision.pp' % host
manifest_file = '%s_provision.pp' % config['CONFIG_CONTROLLER_HOST']
manifest_data = getManifestTemplate("provision.pp")
appendManifestFile(manifest_file, manifest_data)

View File

@ -3,6 +3,7 @@
"""
Installs and configures puppet
"""
import sys
import logging
import os
@ -17,62 +18,117 @@ from packstack.modules.common import filtered_hosts
from packstack.modules.ospluginutils import manifestfiles
from packstack.modules.puppet import scan_logfile, validate_logfile
# Controller object will be initialized from main flow
controller = None
# Plugin name
PLUGIN_NAME = "OSPUPPET"
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "Puppet"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
PUPPET_DIR = os.environ.get('PACKSTACK_PUPPETDIR', '/usr/share/openstack-puppet/')
PUPPET_DIR = os.environ.get('PACKSTACK_PUPPETDIR',
'/usr/share/openstack-puppet/')
MODULE_DIR = os.path.join(PUPPET_DIR, 'modules')
def initConfig(controllerObject):
global controller
controller = controllerObject
logging.debug("Adding OpenStack Puppet configuration")
paramsList = [
]
groupDict = {"GROUP_NAME" : "PUPPET",
"DESCRIPTION" : "Puppet Config parameters",
"PRE_CONDITION" : lambda x: 'yes',
"PRE_CONDITION_MATCH" : "yes",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
def initConfig(controller):
group = {"GROUP_NAME": "PUPPET",
"DESCRIPTION": "Puppet Config parameters",
"PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, [])
def initSequences(controller):
puppetpresteps = [
{'title': 'Clean Up', 'functions':[runCleanup]},
{'title': 'Clean Up', 'functions': [run_cleanup]},
]
controller.insertSequence("Clean Up", [], [], puppetpresteps, index=0)
puppetsteps = [
{'title': 'Installing Dependencies',
'functions': [installdeps]},
'functions': [install_deps]},
{'title': 'Copying Puppet modules and manifests',
'functions': [copyPuppetModules]},
'functions': [copy_puppet_modules]},
{'title': 'Applying Puppet manifests',
'functions': [applyPuppetManifest]},
'functions': [apply_puppet_manifest]},
{'title': 'Finalizing',
'functions': [finalize]}
]
controller.addSequence("Puppet", [], [], puppetsteps)
def runCleanup(config):
#------------------------- helper functions -------------------------
def wait_for_puppet(currently_running, messages):
log_len = 0
twirl = ["-", "\\", "|", "/"]
while currently_running:
for hostname, finished_logfile in currently_running:
log_file = os.path.splitext(os.path.basename(finished_logfile))[0]
space_len = basedefs.SPACE_LEN - len(log_file)
if len(log_file) > log_len:
log_len = len(log_file)
if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
twirl = twirl[-1:] + twirl[:-1]
sys.stdout.write(("\rTesting if puppet apply is finished: %s"
% log_file).ljust(40 + log_len))
sys.stdout.write("[ %s ]" % twirl[0])
sys.stdout.flush()
try:
# Once a remote puppet run has finished, we retrieve the log
# file and check it for errors
local_server = utils.ScriptRunner()
log = os.path.join(basedefs.PUPPET_MANIFEST_DIR,
os.path.basename(finished_logfile))
log = log.replace(".finished", ".log")
local_server.append('scp -o StrictHostKeyChecking=no '
'-o UserKnownHostsFile=/dev/null '
'root@%s:%s %s'
% (hostname, finished_logfile, log))
# To not pollute logs we turn of logging of command execution
local_server.execute(log=False)
# If we got to this point the puppet apply has finished
currently_running.remove((hostname, finished_logfile))
# clean off the last "testing apply" msg
if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
sys.stdout.write(("\r").ljust(45 + log_len))
except ScriptRuntimeError:
# the test raises an exception if the file doesn't exist yet
# TO-DO: We need to start testing 'e' for unexpected exceptions
time.sleep(3)
continue
# check log file for relevant notices
messages.extend(scan_logfile(log))
# check the log file for errors
sys.stdout.write('\r')
try:
validate_logfile(log)
state = utils.state_message('%s:' % log_file, 'DONE', 'green')
sys.stdout.write('%s\n' % state)
sys.stdout.flush()
except PuppetError:
state = utils.state_message('%s:' % log_file, 'ERROR', 'red')
sys.stdout.write('%s\n' % state)
sys.stdout.flush()
raise
#-------------------------- step functions --------------------------
def run_cleanup(config, messages):
localserver = utils.ScriptRunner()
localserver.append("rm -rf %s/*pp" % basedefs.PUPPET_MANIFEST_DIR)
localserver.execute()
def installdeps(config):
def install_deps(config, messages):
deps = ["puppet", "openssh-clients", "tar", "nc"]
modules_pkg = 'openstack-puppet-modules'
@ -91,18 +147,19 @@ def installdeps(config):
for hostname in filtered_hosts(config):
server = utils.ScriptRunner(hostname)
for package in deps:
server.append("rpm -q --whatprovides %s || yum install -y %s" % (package, package))
server.append("rpm -q --whatprovides %s || yum install -y %s"
% (package, package))
server.execute()
def copyPuppetModules(config):
def copy_puppet_modules(config, messages):
os_modules = ' '.join(('apache', 'ceilometer', 'certmonger', 'cinder',
'concat', 'firewall', 'glance', 'heat', 'horizon',
'inifile', 'keystone', 'memcached', 'mongodb',
'mysql', 'neutron', 'nova', 'nssdb', 'openstack',
'packstack', 'qpid', 'rabbitmq', 'rsync', 'ssh', 'stdlib',
'swift', 'sysctl', 'tempest', 'vcsrepo', 'vlan',
'vswitch', 'xinetd'))
'packstack', 'qpid', 'rabbitmq', 'rsync', 'ssh',
'stdlib', 'swift', 'sysctl', 'tempest', 'vcsrepo',
'vlan', 'vswitch', 'xinetd'))
# write puppet manifest to disk
manifestfiles.writeManifests()
@ -115,80 +172,29 @@ def copyPuppetModules(config):
server.append("cd %s" % basedefs.PUPPET_MANIFEST_DIR)
server.append("tar --dereference -cpzf - ../manifests | "
"ssh -o StrictHostKeyChecking=no "
"-o UserKnownHostsFile=/dev/null "
"root@%s tar -C %s -xpzf -" % (hostname, host_dir))
"-o UserKnownHostsFile=/dev/null "
"root@%s tar -C %s -xpzf -" % (hostname, host_dir))
# copy resources
for path, localname in controller.resources.get(hostname, []):
resources = config.get('RESOURCES', {})
for path, localname in resources.get(hostname, []):
server.append("scp -o StrictHostKeyChecking=no "
"-o UserKnownHostsFile=/dev/null %s root@%s:%s/resources/%s" %
(path, hostname, host_dir, localname))
"-o UserKnownHostsFile=/dev/null "
"%s root@%s:%s/resources/%s" %
(path, hostname, host_dir, localname))
# copy Puppet modules required by Packstack
server.append("cd %s" % MODULE_DIR)
server.append("tar --dereference -cpzf - %s | "
"ssh -o StrictHostKeyChecking=no "
"-o UserKnownHostsFile=/dev/null "
"root@%s tar -C %s -xpzf -" %
(os_modules, hostname, os.path.join(host_dir, 'modules')))
"-o UserKnownHostsFile=/dev/null "
"root@%s tar -C %s -xpzf -" %
(os_modules, hostname,
os.path.join(host_dir, 'modules')))
server.execute()
def waitforpuppet(currently_running):
global controller
log_len = 0
twirl = ["-","\\","|","/"]
while currently_running:
for hostname, finished_logfile in currently_running:
log_file = os.path.splitext(os.path.basename(finished_logfile))[0]
if len(log_file) > log_len:
log_len = len(log_file)
if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
twirl = twirl[-1:] + twirl[:-1]
sys.stdout.write(("\rTesting if puppet apply is finished: %s" % log_file).ljust(40 + log_len))
sys.stdout.write("[ %s ]" % twirl[0])
sys.stdout.flush()
try:
# Once a remote puppet run has finished, we retrieve the log
# file and check it for errors
local_server = utils.ScriptRunner()
log = os.path.join(basedefs.PUPPET_MANIFEST_DIR,
os.path.basename(finished_logfile).replace(".finished", ".log"))
local_server.append('scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@%s:%s %s' % (hostname, finished_logfile, log))
# To not pollute logs we turn of logging of command execution
local_server.execute(log=False)
# If we got to this point the puppet apply has finished
currently_running.remove((hostname, finished_logfile))
# clean off the last "testing apply" msg
if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
sys.stdout.write(('\r').ljust(45 + log_len))
except ScriptRuntimeError:
# the test raises an exception if the file doesn't exist yet
# TO-DO: We need to start testing 'e' for unexpected exceptions
time.sleep(3)
continue
# check log file for relevant notices
controller.MESSAGES.extend(scan_logfile(log))
# check the log file for errors
sys.stdout.write('\r')
try:
validate_logfile(log)
state = utils.state_message('%s:' % log_file, 'DONE', 'green')
sys.stdout.write('%s\n' % state)
sys.stdout.flush()
except PuppetError:
state = utils.state_message('%s:' % log_file, 'ERROR', 'red')
sys.stdout.write('%s\n' % state)
sys.stdout.flush()
raise
def applyPuppetManifest(config):
def apply_puppet_manifest(config, messages):
if config.get("DRY_RUN"):
return
currently_running = []
@ -201,8 +207,8 @@ def applyPuppetManifest(config):
for manifest, marker in manifestfiles.getFiles():
# if the marker has changed then we don't want to proceed until
# all of the previous puppet runs have finished
if lastmarker != None and lastmarker != marker:
waitforpuppet(currently_running)
if lastmarker is not None and lastmarker != marker:
wait_for_puppet(currently_running, messages)
lastmarker = marker
for hostname in filtered_hosts(config):
@ -220,22 +226,24 @@ def applyPuppetManifest(config):
running_logfile = "%s.running" % man_path
finished_logfile = "%s.finished" % man_path
currently_running.append((hostname, finished_logfile))
# The apache puppet module doesn't work if we set FACTERLIB
# https://github.com/puppetlabs/puppetlabs-apache/pull/138
if not (manifest.endswith('_horizon.pp') or manifest.endswith('_nagios.pp')):
server.append("export FACTERLIB=$FACTERLIB:%s/facts" % host_dir)
server.append("touch %s" % running_logfile)
server.append("chmod 600 %s" % running_logfile)
server.append("export PACKSTACK_VAR_DIR=%s" % host_dir)
command = "( flock %s/ps.lock puppet apply %s --modulepath %s/modules %s > %s 2>&1 < /dev/null ; mv %s %s ) > /dev/null 2>&1 < /dev/null &" % (host_dir, loglevel, host_dir, man_path, running_logfile, running_logfile, finished_logfile)
server.append(command)
cmd = ("( flock %s/ps.lock "
"puppet apply %s --modulepath %s/modules %s > %s "
"2>&1 < /dev/null ; "
"mv %s %s ) > /dev/null 2>&1 < /dev/null &"
% (host_dir, loglevel, host_dir, man_path, running_logfile,
running_logfile, finished_logfile))
server.append(cmd)
server.execute(log=logcmd)
# wait for outstanding puppet runs befor exiting
waitforpuppet(currently_running)
wait_for_puppet(currently_running, messages)
def finalize(config):
def finalize(config, messages):
for hostname in filtered_hosts(config):
server = utils.ScriptRunner(hostname)
server.append("installed=$(rpm -q kernel --last | head -n1 | "
@ -245,5 +253,5 @@ def finalize(config):
try:
rc, out = server.execute()
except ScriptRuntimeError:
controller.MESSAGES.append('Because of the kernel update the host '
'%s requires reboot.' % hostname)
messages.append('Because of the kernel update the host %s '
'requires reboot.' % hostname)

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
prepare server
"""
@ -15,218 +17,215 @@ from packstack.installer import validators
from packstack.modules.common import filtered_hosts, is_all_in_one
# Controller object will be initialized from main flow
controller = None
# Plugin name
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-SERVERPREPARE"
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 SERVERPREPARE KEY configuration")
def initConfig(controller):
conf_params = {
"SERVERPREPARE": [
{"CMD_OPTION" : "use-epel",
"USAGE" : "To subscribe each server to EPEL enter \"y\"",
"PROMPT" : "To subscribe each server to EPEL enter \"y\"",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "n",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_USE_EPEL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
"SERVERPREPARE": [
{"CMD_OPTION": "use-epel",
"USAGE": "To subscribe each server to EPEL enter \"y\"",
"PROMPT": "To subscribe each server to EPEL enter \"y\"",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_USE_EPEL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION" : "additional-repo",
"USAGE" : "A comma separated list of URLs to any additional yum repositories to install",
"PROMPT" : "Enter a comma separated list of URLs to any additional yum repositories to install",
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_REPO",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False }],
{"CMD_OPTION": "additional-repo",
"USAGE": ("A comma separated list of URLs to any additional yum "
"repositories to install"),
"PROMPT": ("Enter a comma separated list of URLs to any "
"additional yum repositories to install"),
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_REPO",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False}
],
"RHEL": [
{"CMD_OPTION" : "rh-username",
"USAGE" : "To subscribe each server with Red Hat subscription manager, include this with CONFIG_RH_PW",
"PROMPT" : "To subscribe each server to Red Hat enter a username here",
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_RH_USER",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
"RHEL": [
{"CMD_OPTION": "rh-username",
"USAGE": ("To subscribe each server with Red Hat subscription "
"manager, include this with CONFIG_RH_PW"),
"PROMPT": "To subscribe each server to Red Hat enter a username ",
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_RH_USER",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION" : "rh-password",
"USAGE" : "To subscribe each server with Red Hat subscription manager, include this with CONFIG_RH_USER",
"PROMPT" : "To subscribe each server to Red Hat enter your password here",
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_RH_PW",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION": "rh-password",
"USAGE": ("To subscribe each server with Red Hat subscription "
"manager, include this with CONFIG_RH_USER"),
"PROMPT": ("To subscribe each server to Red Hat enter your "
"password"),
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": True,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_RH_PW",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION" : "rh-beta-repo",
"USAGE" : "To subscribe each server to Red Hat Enterprise Linux 6 Server Beta channel (only needed for Preview versions of RHOS) enter \"y\"",
"PROMPT" : "To subscribe each server to Red Hat Enterprise Linux 6 Server Beta channel (only needed for Preview versions of RHOS) enter \"y\"",
"OPTION_LIST" : ["y", "n"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "n",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_RH_BETA_REPO",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION": "rhn-satellite-server",
"USAGE": ("To subscribe each server with RHN Satellite,fill "
"Satellite's URL here. Note that either satellite's "
"username/password or activation key has "
"to be provided"),
"PROMPT": ("To subscribe each server with RHN Satellite enter "
"RHN Satellite server URL"),
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SATELLITE_URL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False}
],
{"CMD_OPTION" : "rhn-satellite-server",
"USAGE" : ("To subscribe each server with RHN Satellite,"
"fill Satellite's URL here. Note that either "
"satellite's username/password or activation "
"key has to be provided"),
"PROMPT" : ("To subscribe each server with RHN Satellite "
"enter RHN Satellite server URL"),
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SATELLITE_URL",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False }],
"SATELLITE": [
{"CMD_OPTION": "rhn-satellite-username",
"USAGE": "Username to access RHN Satellite",
"PROMPT": ("Enter RHN Satellite username or leave plain if you "
"will use activation key instead"),
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_SATELLITE_USER",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
"SATELLITE": [
{"CMD_OPTION" : "rhn-satellite-username",
"USAGE" : "Username to access RHN Satellite",
"PROMPT" : ("Enter RHN Satellite username or leave plain "
"if you will use activation key instead"),
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_SATELLITE_USER",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION": "rhn-satellite-password",
"USAGE": "Password to access RHN Satellite",
"PROMPT": ("Enter RHN Satellite password or leave plain if you "
"will use activation key instead"),
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SATELLITE_PW",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION" : "rhn-satellite-password",
"USAGE" : "Password to access RHN Satellite",
"PROMPT" : ("Enter RHN Satellite password or leave plain "
"if you will use activation key instead"),
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SATELLITE_PW",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION": "rhn-satellite-activation-key",
"USAGE": "Activation key for subscription to RHN Satellite",
"PROMPT": ("Enter RHN Satellite activation key or leave plain if "
"you used username/password instead"),
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SATELLITE_AKEY",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION" : "rhn-satellite-activation-key",
"USAGE" : "Activation key for subscription to RHN Satellite",
"PROMPT" : ("Enter RHN Satellite activation key or leave plain "
"if you used username/password instead"),
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SATELLITE_AKEY",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION": "rhn-satellite-cacert",
"USAGE": "Specify a path or URL to a SSL CA certificate to use",
"PROMPT": "Specify a path or URL to a SSL CA certificate to use",
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SATELLITE_CACERT",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION" : "rhn-satellite-cacert",
"USAGE" : "Specify a path or URL to a SSL CA certificate to use",
"PROMPT" : "Specify a path or URL to a SSL CA certificate to use",
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SATELLITE_CACERT",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION": "rhn-satellite-profile",
"USAGE": ("If required specify the profile name that should be "
"used as an identifier for the system "
"in RHN Satellite"),
"PROMPT": ("If required specify the profile name that should be "
"used as an identifier for the system "
"in RHN Satellite"),
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SATELLITE_PROFILE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION" : "rhn-satellite-profile",
"USAGE" : ("If required specify the profile name that should "
"be used as an identifier for the system in RHN "
"Satellite"),
"PROMPT" : ("If required specify the profile name that should "
"be used as an identifier for the system in RHN "
"Satellite"),
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SATELLITE_PROFILE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION": "rhn-satellite-flags",
"USAGE": ("Comma separated list of flags passed to rhnreg_ks. "
"Valid flags are: novirtinfo, norhnsd, nopackages"),
"PROMPT": ("Enter comma separated list of flags passed "
"to rhnreg_ks"),
"OPTION_LIST": ['novirtinfo', 'norhnsd', 'nopackages'],
"VALIDATORS": [validators.validate_multi_options],
"DEFAULT_VALUE": "",
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SATELLITE_FLAGS",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION" : "rhn-satellite-flags",
"USAGE" : ("Comma separated list of flags passed to rhnreg_ks. Valid "
"flags are: novirtinfo, norhnsd, nopackages"),
"PROMPT" : "Enter comma separated list of flags passed to rhnreg_ks",
"OPTION_LIST" : ['novirtinfo', 'norhnsd', 'nopackages'],
"VALIDATORS" : [validators.validate_multi_options],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SATELLITE_FLAGS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION": "rhn-satellite-proxy-host",
"USAGE": "Specify a HTTP proxy to use with RHN Satellite",
"PROMPT": "Specify a HTTP proxy to use with RHN Satellite",
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SATELLITE_PROXY",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False}
],
{"CMD_OPTION" : "rhn-satellite-proxy-host",
"USAGE" : "Specify a HTTP proxy to use with RHN Satellite",
"PROMPT" : "Specify a HTTP proxy to use with RHN Satellite",
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SATELLITE_PROXY",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False }],
"SATELLITE_PROXY": [
{"CMD_OPTION": "rhn-satellite-proxy-username",
"USAGE": ("Specify a username to use with an authenticated "
"HTTP proxy"),
"PROMPT": ("Specify a username to use with an authenticated "
"HTTP proxy"),
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SATELLITE_PROXY_USER",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
"SATELLITE_PROXY": [
{"CMD_OPTION" : "rhn-satellite-proxy-username",
"USAGE" : "Specify a username to use with an authenticated HTTP proxy",
"PROMPT" : "Specify a username to use with an authenticated HTTP proxy",
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SATELLITE_PROXY_USER",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "rhn-satellite-proxy-password",
"USAGE" : "Specify a password to use with an authenticated HTTP proxy.",
"PROMPT" : "Specify a password to use with an authenticated HTTP proxy.",
"OPTION_LIST" : [],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SATELLITE_PROXY_PW",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False }]}
{"CMD_OPTION": "rhn-satellite-proxy-password",
"USAGE": ("Specify a password to use with an authenticated "
"HTTP proxy."),
"PROMPT": ("Specify a password to use with an authenticated "
"HTTP proxy."),
"OPTION_LIST": [],
"DEFAULT_VALUE": "",
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SATELLITE_PROXY_PW",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False}
]
}
def filled_satellite(config):
return bool(config.get('CONFIG_SATELLITE_URL'))
@ -235,42 +234,51 @@ def initConfig(controllerObject):
return bool(config.get('CONFIG_SATELLITE_PROXY'))
conf_groups = [
{"GROUP_NAME" : "SERVERPREPARE",
"DESCRIPTION" : "Server Prepare Configs ",
"PRE_CONDITION" : lambda x: 'yes',
"PRE_CONDITION_MATCH" : "yes",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True},
]
{"GROUP_NAME": "SERVERPREPARE",
"DESCRIPTION": "Server Prepare Configs ",
"PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
]
if ((is_all_in_one(controller.CONF) and is_rhel()) or
not is_all_in_one(controller.CONF)):
conf_groups.append({"GROUP_NAME" : "RHEL",
"DESCRIPTION" : "RHEL config",
"PRE_CONDITION" : lambda x: 'yes',
"PRE_CONDITION_MATCH" : "yes",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True})
config = controller.CONF
if (is_all_in_one(config) and is_rhel()) or not is_all_in_one(config):
conf_groups.append({"GROUP_NAME": "RHEL",
"DESCRIPTION": "RHEL config",
"PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True})
conf_groups.append({"GROUP_NAME" : "SATELLITE",
"DESCRIPTION" : "RHN Satellite config",
"PRE_CONDITION" : filled_satellite,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True})
conf_groups.append({"GROUP_NAME": "SATELLITE",
"DESCRIPTION": "RHN Satellite config",
"PRE_CONDITION": filled_satellite,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True})
conf_groups.append({"GROUP_NAME" : "SATELLITE_PROXY",
"DESCRIPTION" : "RHN Satellite proxy config",
"PRE_CONDITION" : filled_satellite_proxy,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True})
conf_groups.append({"GROUP_NAME": "SATELLITE_PROXY",
"DESCRIPTION": "RHN Satellite proxy config",
"PRE_CONDITION": filled_satellite_proxy,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True})
for group in conf_groups:
paramList = conf_params[group["GROUP_NAME"]]
controller.addGroup(group, paramList)
params = conf_params[group["GROUP_NAME"]]
controller.addGroup(group, params)
def initSequences(controller):
preparesteps = [
{'title': 'Preparing servers', 'functions': [server_prep]}
]
controller.addSequence("Preparing servers", [], [], preparesteps)
#------------------------- helper functions -------------------------
def is_rhel():
return 'Red Hat Enterprise Linux' in platform.linux_distribution()[0]
@ -290,9 +298,8 @@ def run_rhn_reg(host, server_url, username=None, password=None,
server = utils.ScriptRunner(host)
# check satellite server url
server_url = server_url.rstrip('/').endswith('/XMLRPC') \
and server_url \
or '%s/XMLRPC' % server_url
server_url = (server_url.rstrip('/').endswith('/XMLRPC')
and server_url or '%s/XMLRPC' % server_url)
cmd.extend(['--serverUrl', server_url])
if activation_key:
@ -339,7 +346,7 @@ def run_rhn_reg(host, server_url, username=None, password=None,
server.execute(mask_list=mask)
def run_rhsm_reg(host, username, password, beta):
def run_rhsm_reg(host, username, password):
"""
Registers given host to Red Hat Repositories via subscription manager.
"""
@ -347,8 +354,8 @@ def run_rhsm_reg(host, username, password, beta):
# register host
cmd = ('subscription-manager register --username=\"%s\" '
'--password=\"%s\" --autosubscribe || true')
server.append(cmd % (username, password.replace('"','\\"')))
'--password=\"%s\" --autosubscribe || true')
server.append(cmd % (username, password.replace('"', '\\"')))
# subscribe to required channel
cmd = ('subscription-manager list --consumed | grep -i openstack || '
@ -357,12 +364,12 @@ def run_rhsm_reg(host, username, password, beta):
"grep -e 'Red Hat OpenStack' -m 1 -A 2 | grep 'Pool Id' | "
"awk '{print $3}')")
server.append(cmd % pool)
server.append("subscription-manager repos --enable rhel-6-server-optional-rpms")
server.append("subscription-manager repos "
"--enable rhel-6-server-optional-rpms")
server.append("yum clean all")
server.append("rpm -q --whatprovides yum-utils || yum install -y yum-utils")
if beta:
server.append("yum-config-manager --enable rhel-6-server-beta-rpms")
server.append("rpm -q --whatprovides yum-utils || "
"yum install -y yum-utils")
server.append("yum clean metadata")
server.execute(mask_list=[password])
@ -409,7 +416,8 @@ def manage_epel(host, config):
server.append('yum-config-manager --%(cmd)s epel' % locals())
rc, out = server.execute()
# yum-config-manager returns 0 always, but returns current setup if succeeds
# yum-config-manager returns 0 always, but returns current setup
# if succeeds
match = re.search('enabled\s*\=\s*%(enabled)s' % locals(), out)
if match:
return
@ -428,7 +436,6 @@ def manage_epel(host, config):
logger.warn(msg % host)
def manage_rdo(host, config):
"""
Installs and enables RDO repo on host in case it is installed locally.
@ -457,7 +464,8 @@ def manage_rdo(host, config):
reponame = 'openstack-%s' % version
server.clear()
server.append('yum-config-manager --enable %(reponame)s' % locals())
# yum-config-manager returns 0 always, but returns current setup if succeeds
# yum-config-manager returns 0 always, but returns current setup
# if succeeds
rc, out = server.execute()
match = re.search('enabled\s*=\s*(1|True)', out)
if not match:
@ -467,14 +475,9 @@ def manage_rdo(host, config):
raise exceptions.ScriptRuntimeError(msg)
def initSequences(controller):
preparesteps = [
{'title': 'Preparing servers', 'functions':[serverprep]}
]
controller.addSequence("Preparing servers", [], [], preparesteps)
#-------------------------- step functions --------------------------
def serverprep(config):
def server_prep(config, messages):
rh_username = None
sat_url = None
if is_rhel():
@ -489,21 +492,22 @@ def serverprep(config):
sat_flags = [i.strip() for i in flag_list if i.strip()]
sat_proxy_user = config.get("CONFIG_SATELLITE_PROXY_USER", '')
sat_proxy_pass = config.get("CONFIG_SATELLITE_PROXY_PW", '')
sat_args = {'username': config["CONFIG_SATELLITE_USER"].strip(),
'password': config["CONFIG_SATELLITE_PW"].strip(),
'cacert': config["CONFIG_SATELLITE_CACERT"].strip(),
'activation_key': config["CONFIG_SATELLITE_AKEY"].strip(),
'profile_name': config["CONFIG_SATELLITE_PROFILE"].strip(),
'proxy_host': config["CONFIG_SATELLITE_PROXY"].strip(),
'proxy_user': sat_proxy_user.strip(),
'proxy_pass': sat_proxy_pass.strip(),
'flags': sat_flags}
sat_args = {
'username': config["CONFIG_SATELLITE_USER"].strip(),
'password': config["CONFIG_SATELLITE_PW"].strip(),
'cacert': config["CONFIG_SATELLITE_CACERT"].strip(),
'activation_key': config["CONFIG_SATELLITE_AKEY"].strip(),
'profile_name': config["CONFIG_SATELLITE_PROFILE"].strip(),
'proxy_host': config["CONFIG_SATELLITE_PROXY"].strip(),
'proxy_user': sat_proxy_user.strip(),
'proxy_pass': sat_proxy_pass.strip(),
'flags': sat_flags
}
for hostname in filtered_hosts(config):
# Subscribe to Red Hat Repositories if configured
if rh_username:
run_rhsm_reg(hostname, rh_username, rh_password,
config["CONFIG_RH_BETA_REPO"] == 'y')
run_rhsm_reg(hostname, rh_username, rh_password)
# Subscribe to RHN Satellite if configured
if sat_url and hostname not in sat_registered:
@ -524,8 +528,8 @@ def serverprep(config):
server.clear()
server.append('yum install -y yum-plugin-priorities || true')
server.append('rpm -q epel-release && yum-config-manager '
'--setopt="%(reponame)s.priority=1" '
'--save %(reponame)s' % locals())
'--setopt="%(reponame)s.priority=1" '
'--save %(reponame)s' % locals())
# Add yum repositories if configured
CONFIG_REPO = config["CONFIG_REPO"].strip()
@ -533,8 +537,8 @@ def serverprep(config):
for i, repourl in enumerate(CONFIG_REPO.split(',')):
reponame = 'packstack_%d' % i
server.append('echo "[%(reponame)s]\nname=%(reponame)s\n'
'baseurl=%(repourl)s\nenabled=1\n'
'priority=1\ngpgcheck=0"'
'baseurl=%(repourl)s\nenabled=1\n'
'priority=1\ngpgcheck=0"'
' > /etc/yum.repos.d/%(reponame)s.repo'
% locals())

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
"""
Installs and configures an OpenStack Swift
"""
@ -13,136 +15,150 @@ from packstack.installer import basedefs
from packstack.installer import utils
from packstack.installer.utils import split_hosts
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile, manifestfiles
from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile, manifestfiles)
# Controller object will be initialized from main flow
controller = None
# Plugin name
PLUGIN_NAME = "OS-SWIFT"
#------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Swift"
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 Swift configuration")
paramsList = [
{"CMD_OPTION" : "os-swift-proxy",
"USAGE" : "The IP address on which to install the Swift proxy service (currently only single proxy is supported)",
"PROMPT" : "Enter the IP address of the Swift proxy service",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_multi_ip, validators.validate_multi_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_SWIFT_PROXY_HOSTS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-swift-ks-passwd",
"USAGE" : "The password to use for the Swift to authenticate with Keystone",
"PROMPT" : "Enter the password for the Swift Keystone access",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SWIFT_KS_PW",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
{"CMD_OPTION" : "os-swift-storage",
"USAGE" : "A comma separated list of IP addresses on which to install the Swift Storage services, each entry should take the format <ipaddress>[/dev], for example 127.0.0.1/vdb will install /dev/vdb on 127.0.0.1 as a swift storage device(packstack does not create the filesystem, you must do this first), if /dev is omitted Packstack will create a loopback device for a test setup",
"PROMPT" : "Enter the Swift Storage servers e.g. host/dev,host/dev",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty, validate_storage],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_SWIFT_STORAGE_HOSTS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-swift-storage-zones",
"USAGE" : "Number of swift storage zones, this number MUST be no bigger than the number of storage devices configured",
"PROMPT" : "Enter the number of swift storage zones, MUST be no bigger than the number of storage devices configured",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_integer],
"DEFAULT_VALUE" : "1",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_SWIFT_STORAGE_ZONES",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-swift-storage-replicas",
"USAGE" : "Number of swift storage replicas, this number MUST be no bigger than the number of storage zones configured",
"PROMPT" : "Enter the number of swift storage replicas, MUST be no bigger than the number of storage zones configured",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_integer],
"DEFAULT_VALUE" : "1",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_SWIFT_STORAGE_REPLICAS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-swift-storage-fstype",
"USAGE" : "FileSystem type for storage nodes",
"PROMPT" : "Enter FileSystem type for storage nodes",
"OPTION_LIST" : ['xfs','ext4'],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "ext4",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_SWIFT_STORAGE_FSTYPE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-swift-hash",
"USAGE" : "Shared secret for Swift",
"PROMPT" : "Enter hash for Swift shared secret",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : uuid.uuid4().hex[:16],
"MASK_INPUT" : True,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_SWIFT_HASH",
"USE_DEFAULT" : True,
"NEED_CONFIRM" : True,
"CONDITION" : False },
{"CMD_OPTION" : "os-swift-storage-size",
"USAGE" : "Size of the swift loopback file storage device",
"PROMPT" : "Enter the size of the storage device (eg. 2G, 2000M, 2000000K)",
"OPTION_LIST" : [],
"VALIDATORS" : [validate_storage_size],
"DEFAULT_VALUE" : "2G",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_SWIFT_STORAGE_SIZE",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
def initConfig(controller):
params = [
{"CMD_OPTION": "os-swift-ks-passwd",
"USAGE": ("The password to use for the Swift to authenticate "
"with Keystone"),
"PROMPT": "Enter the password for the Swift Keystone access",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SWIFT_KS_PW",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
]
{"CMD_OPTION": "os-swift-storages",
"USAGE": ("A comma separated list of devices which to use as Swift "
"Storage device. Each entry should take the format "
"/path/to/dev, for example /dev/vdb will install /dev/vdb "
"as Swift storage device (packstack does not create "
"the filesystem, you must do this first). If value is "
"omitted Packstack will create a loopback device for test "
"setup"),
"PROMPT": "Enter the Swift Storage devices e.g. /path/to/dev",
"OPTION_LIST": [],
"VALIDATORS": [],
"DEFAULT_VALUE": '',
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_SWIFT_STORAGES",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
groupDict = { "GROUP_NAME" : "OSSWIFT",
"DESCRIPTION" : "OpenStack Swift Config parameters",
"PRE_CONDITION" : "CONFIG_SWIFT_INSTALL",
"PRE_CONDITION_MATCH" : "y",
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
{"CMD_OPTION": "os-swift-storage-zones",
"USAGE": ("Number of swift storage zones, this number MUST be "
"no bigger than the number of storage devices configured"),
"PROMPT": ("Enter the number of swift storage zones, MUST be no "
"bigger than the number of storage devices configured"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_integer],
"DEFAULT_VALUE": "1",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_SWIFT_STORAGE_ZONES",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "os-swift-storage-replicas",
"USAGE": ("Number of swift storage replicas, this number MUST be "
"no bigger than the number of storage zones configured"),
"PROMPT": ("Enter the number of swift storage replicas, MUST be no "
"bigger than the number of storage zones configured"),
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_integer],
"DEFAULT_VALUE": "1",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_SWIFT_STORAGE_REPLICAS",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "os-swift-storage-fstype",
"USAGE": "FileSystem type for storage nodes",
"PROMPT": "Enter FileSystem type for storage nodes",
"OPTION_LIST": ['xfs', 'ext4'],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "ext4",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_SWIFT_STORAGE_FSTYPE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "os-swift-hash",
"USAGE": "Shared secret for Swift",
"PROMPT": "Enter hash for Swift shared secret",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SWIFT_HASH",
"USE_DEFAULT": True,
"NEED_CONFIRM": True,
"CONDITION": False},
{"CMD_OPTION": "os-swift-storage-size",
"USAGE": "Size of the swift loopback file storage device",
"PROMPT": ("Enter the size of the storage device (eg. 2G, 2000M, "
"2000000K)"),
"OPTION_LIST": [],
"VALIDATORS": [validate_storage_size],
"DEFAULT_VALUE": "2G",
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_SWIFT_STORAGE_SIZE",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
group = {"GROUP_NAME": "OSSWIFT",
"DESCRIPTION": "OpenStack Swift Config parameters",
"PRE_CONDITION": "CONFIG_SWIFT_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def initSequences(controller):
if controller.CONF['CONFIG_SWIFT_INSTALL'] != 'y':
return
steps = [
{'title': 'Adding Swift Keystone manifest entries',
'functions': [create_keystone_manifest]},
{'title': 'Adding Swift builder manifest entries',
'functions': [create_builder_manifest]},
{'title': 'Adding Swift proxy manifest entries',
'functions': [create_proxy_manifest]},
{'title': 'Adding Swift storage manifest entries',
'functions': [create_storage_manifest]},
{'title': 'Adding Swift common manifest entries',
'functions': [create_common_manifest]},
]
controller.addSequence("Installing OpenStack Swift", [], [], steps)
def validate_storage(param, options=None):
for host in param.split(','):
host = host.split('/', 1)[0]
validators.validate_ip(host.strip(), options)
#------------------------- helper functions -------------------------
def validate_storage_size(param, options=None):
match = re.match(r'\d+G|\d+M|\d+K', param, re.IGNORECASE)
@ -150,78 +166,28 @@ def validate_storage_size(param, options=None):
msg = 'Storage size not have a valid value (eg. 1G, 1000M, 1000000K)'
raise ParamValidationError(msg)
def initSequences(controller):
if controller.CONF['CONFIG_SWIFT_INSTALL'] != 'y':
return
steps = [
{'title': 'Adding Swift Keystone manifest entries', 'functions':[createkeystonemanifest]},
{'title': 'Adding Swift builder manifest entries', 'functions':[createbuildermanifest]},
{'title': 'Adding Swift proxy manifest entries', 'functions':[createproxymanifest]},
{'title': 'Adding Swift storage manifest entries', 'functions':[createstoragemanifest]},
{'title': 'Adding Swift common manifest entries', 'functions':[createcommonmanifest]},
]
controller.addSequence("Installing OpenStack Swift", [], [], steps)
def createkeystonemanifest(config):
manifestfile = "%s_keystone.pp"%controller.CONF['CONFIG_KEYSTONE_HOST']
controller.CONF['CONFIG_SWIFT_PROXY'] = controller.CONF['CONFIG_SWIFT_PROXY_HOSTS'].split(',')[0]
manifestdata = getManifestTemplate("keystone_swift.pp")
appendManifestFile(manifestfile, manifestdata)
devices = []
def parse_devices(config_swift_storage_hosts):
def parse_devices(config):
"""
Returns dict containing information about Swift storage devices.
"""
devices = []
device_number = 0
num_zones = int(controller.CONF["CONFIG_SWIFT_STORAGE_ZONES"])
for host in config_swift_storage_hosts.split(","):
host = host.strip()
num_zones = int(config["CONFIG_SWIFT_STORAGE_ZONES"])
for device in config["CONFIG_SWIFT_STORAGES"].split(","):
device = device.strip()
if not device:
continue
device_number += 1
device = None
if '/' in host:
host, device = map(lambda x: x.strip(), host.split('/', 1))
zone = str((device_number % num_zones) + 1)
devices.append({'host': host, 'device': device, 'zone': zone,
devices.append({'device': device, 'zone': zone,
'device_name': 'device%s' % device_number})
if not devices:
devices.append({'device': None, 'zone': 1,
'device_name': 'swiftloopback'})
return devices
# The ring file should be built and distributed befor the storage services
# come up. Specifically the replicator crashes if the ring isn't present
def createbuildermanifest(config):
# TODO : put this on the proxy server, will need to change this later
controller.CONF['CONFIG_SWIFT_BUILDER_HOST'] = controller.CONF['CONFIG_SWIFT_PROXY_HOSTS'].split(',')[0]
manifestfile = "%s_ring_swift.pp"%controller.CONF['CONFIG_SWIFT_BUILDER_HOST']
manifestdata = getManifestTemplate("swift_builder.pp")
# Add each device to the ring
devicename = 0
for device in parse_devices(controller.CONF["CONFIG_SWIFT_STORAGE_HOSTS"]):
host = device['host']
devicename = device['device_name']
zone = device['zone']
manifestdata = manifestdata + '\n@@ring_object_device { "%s:6000/%s":\n zone => %s,\n weight => 10, }'%(host, devicename, zone)
manifestdata = manifestdata + '\n@@ring_container_device { "%s:6001/%s":\n zone => %s,\n weight => 10, }'%(host, devicename, zone)
manifestdata = manifestdata + '\n@@ring_account_device { "%s:6002/%s":\n zone => %s,\n weight => 10, }'%(host, devicename, zone)
appendManifestFile(manifestfile, manifestdata, 'swiftbuilder')
def createproxymanifest(config):
manifestfile = "%s_swift.pp"%controller.CONF['CONFIG_SWIFT_PROXY_HOSTS']
manifestdata = getManifestTemplate("swift_proxy.pp")
# If the proxy server is also a storage server then swift::ringsync will be included for the storage server
if controller.CONF['CONFIG_SWIFT_PROXY_HOSTS'] not in [h['host'] for h in devices]:
manifestdata += 'swift::ringsync{["account","container","object"]:\n ring_server => "%s"\n}'%controller.CONF['CONFIG_SWIFT_BUILDER_HOST']
appendManifestFile(manifestfile, manifestdata)
def check_device(host, device):
"""
Raises ScriptRuntimeError if given device is not mounted on given
@ -230,62 +196,102 @@ def check_device(host, device):
server = utils.ScriptRunner(host)
# the device MUST exist
cmd = 'ls -l /dev/%s'
cmd = 'ls -l %s'
server.append(cmd % device)
# if it is not mounted then we can use it
cmd = 'grep "/dev/%s " /proc/self/mounts || exit 0'
cmd = 'grep "%s " /proc/self/mounts || exit 0'
server.append(cmd % device)
# if it is mounted then the mount point has to be in /srv/node
cmd = 'grep "/dev/%s /srv/node" /proc/self/mounts && exit 0'
cmd = 'grep "%s /srv/node" /proc/self/mounts && exit 0'
server.append(cmd % device)
# if we got here without exiting then we can't use this device
server.append('exit 1')
server.execute()
return False
def get_storage_size(size):
def get_storage_size(config):
ranges = {'G': 1048576, 'M': 1024, 'K': 1}
size.strip()
size = config['CONFIG_SWIFT_STORAGE_SIZE'].strip()
for measure in ['G', 'M', 'K']:
if re.match('\d+' + measure, size, re.IGNORECASE):
intsize = int(size.rstrip(measure)) * ranges[measure]
return intsize
def createstoragemanifest(config):
# this need to happen once per storage host
for host in set([device['host'] for device in devices]):
controller.CONF["CONFIG_SWIFT_STORAGE_CURRENT"] = host
manifestfile = "%s_swift.pp"%host
manifestdata = getManifestTemplate("swift_storage.pp")
appendManifestFile(manifestfile, manifestdata)
#-------------------------- step functions --------------------------
def create_keystone_manifest(config, messages):
# parse devices in first step
global devices
devices = parse_devices(config)
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone_swift.pp")
appendManifestFile(manifestfile, manifestdata)
def create_builder_manifest(config, messages):
global devices
# The ring file should be built and distributed before the storage services
# come up. Specifically the replicator crashes if the ring isn't present
def device_def(dev_type, host, dev_port, devicename, zone):
fmt = ('\n@@%s { "%s:%s/%s":\n'
' zone => %s,\n'
' weight => 10, }\n')
return fmt % (dev_type, host, dev_port, devicename, zone)
manifestfile = "%s_ring_swift.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("swift_builder.pp")
# Add each device to the ring
devicename = 0
for device in devices:
host = config['CONFIG_CONTROLLER_HOST']
devicename = device['device_name']
zone = device['zone']
for dev_type, dev_port in [('ring_object_device', 6000),
('ring_container_device', 6001),
('ring_account_device', 6002)]:
manifestdata += device_def(dev_type, host, dev_port, devicename,
zone)
appendManifestFile(manifestfile, manifestdata, 'swiftbuilder')
def create_proxy_manifest(config, messages):
manifestfile = "%s_swift.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("swift_proxy.pp")
appendManifestFile(manifestfile, manifestdata)
def create_storage_manifest(config, messages):
global devices
manifestfile = "%s_swift.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("swift_storage.pp")
# this need to happen once per storage device
for device in devices:
host = device['host']
host = config['CONFIG_CONTROLLER_HOST']
devicename = device['device_name']
device = device['device']
fstype = config["CONFIG_SWIFT_STORAGE_FSTYPE"]
if device:
check_device(host, device)
manifestfile = "%s_swift.pp"%host
if device:
manifestdata = "\n" + 'swift::storage::%s{"%s":\n device => "/dev/%s",\n}'% (controller.CONF["CONFIG_SWIFT_STORAGE_FSTYPE"], devicename, device)
manifestdata += ('\nswift::storage::%s { "%s":\n'
' device => "%s",\n}\n'
% (fstype, devicename, device))
else:
config['SWIFT_STORAGE_SEEK'] = get_storage_size(config['CONFIG_SWIFT_STORAGE_SIZE'])
controller.CONF["SWIFT_STORAGE_DEVICES"] = "'%s'"%devicename
manifestdata = "\n" + getManifestTemplate("swift_loopback.pp")
appendManifestFile(manifestfile, manifestdata)
# create loopback device if none was specified
config['CONFIG_SWIFT_STORAGE_SEEK'] = get_storage_size(config)
manifestdata += "\n" + getManifestTemplate("swift_loopback.pp")
# set allowed hosts for firewall
swift_hosts = get_swift_hosts(config)
hosts = swift_hosts.copy()
manifestdata = ""
hosts = set([config['CONFIG_CONTROLLER_HOST']])
if config['CONFIG_NOVA_INSTALL'] == 'y':
hosts |= split_hosts(config['CONFIG_NOVA_COMPUTE_HOSTS'])
hosts |= split_hosts(config['CONFIG_COMPUTE_HOSTS'])
config['FIREWALL_SERVICE_NAME'] = "swift storage and rsync"
config['FIREWALL_PORTS'] = "'6000', '6001', '6002', '873'"
@ -296,22 +302,11 @@ def createstoragemanifest(config):
config['FIREWALL_SERVICE_ID'] = "swift_storage_and_rsync_%s" % host
manifestdata += getManifestTemplate("firewall.pp")
for host in swift_hosts:
manifestfile = "%s_swift.pp" % host
appendManifestFile(manifestfile, manifestdata)
appendManifestFile(manifestfile, manifestdata)
def createcommonmanifest(config):
def create_common_manifest(config, messages):
for manifestfile, marker in manifestfiles.getFiles():
if manifestfile.endswith("_swift.pp"):
data = getManifestTemplate("swift_common.pp")
appendManifestFile(os.path.split(manifestfile)[1], data)
def get_swift_hosts(config):
"""Get a set of all the Swift hosts"""
hosts = split_hosts(config['CONFIG_SWIFT_STORAGE_HOSTS'])
# remove "/device" from the storage host names
hosts = set(host.split('/', 1)[0] for host in hosts)
hosts |= split_hosts(config['CONFIG_SWIFT_PROXY_HOSTS'])
return hosts

View File

@ -1,4 +1,4 @@
$amqp = '%(CONFIG_AMQP_SERVER)s'
$amqp = '%(CONFIG_AMQP_BACKEND)s'
case $amqp {
'qpid': {
enable_qpid {"qpid":

View File

@ -6,7 +6,7 @@ class { 'ceilometer::collector':
}
class { 'ceilometer::agent::auth':
auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
auth_url => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
auth_password => '%(CONFIG_CEILOMETER_KS_PW)s',
}
@ -20,6 +20,6 @@ class { 'ceilometer::alarm::evaluator':
}
class { 'ceilometer::api':
keystone_host => '%(CONFIG_KEYSTONE_HOST)s',
keystone_host => '%(CONFIG_CONTROLLER_HOST)s',
keystone_password => '%(CONFIG_CEILOMETER_KS_PW)s',
}

View File

@ -1,5 +1,5 @@
cinder_config {
"DEFAULT/glance_host": value => "%(CONFIG_GLANCE_HOST)s";
"DEFAULT/glance_host": value => "%(CONFIG_CONTROLLER_HOST)s";
}
package {'python-keystone':
@ -10,7 +10,7 @@ class {'cinder::api':
keystone_password => '%(CONFIG_CINDER_KS_PW)s',
keystone_tenant => "services",
keystone_user => "cinder",
keystone_auth_host => "%(CONFIG_KEYSTONE_HOST)s",
keystone_auth_host => "%(CONFIG_CONTROLLER_HOST)s",
}
class {'cinder::scheduler':
@ -20,5 +20,5 @@ class {'cinder::volume':
}
class {'cinder::volume::iscsi':
iscsi_ip_address => '%(CONFIG_CINDER_HOST)s'
iscsi_ip_address => '%(CONFIG_CONTROLLER_HOST)s'
}

View File

@ -2,7 +2,7 @@ class {'cinder::backup':
}
class {'cinder::backup::swift':
backup_swift_url => 'http://%(CONFIG_SWIFT_PROXY)s:8080/v1/AUTH_'
backup_swift_url => 'http://%(CONFIG_CONTROLLER_HOST)s:8080/v1/AUTH_'
}
Class['cinder::api'] ~> Service['cinder-backup']

View File

@ -1,6 +1,6 @@
class {"glance::api":
auth_host => "%(CONFIG_KEYSTONE_HOST)s",
auth_host => "%(CONFIG_CONTROLLER_HOST)s",
keystone_tenant => "services",
keystone_user => "glance",
keystone_password => "%(CONFIG_GLANCE_KS_PW)s",
@ -13,7 +13,7 @@ class {"glance::api":
class { 'glance::backend::file': }
class {"glance::registry":
auth_host => "%(CONFIG_KEYSTONE_HOST)s",
auth_host => "%(CONFIG_CONTROLLER_HOST)s",
keystone_tenant => "services",
keystone_user => "glance",
keystone_password => "%(CONFIG_GLANCE_KS_PW)s",

View File

@ -1,9 +1,10 @@
class { 'heat::api':
}
class { 'heat::engine':
heat_metadata_server_url => 'http://%(CONFIG_HEAT_METADATA_HOST)s:8000',
heat_waitcondition_server_url => 'http://%(CONFIG_HEAT_METADATA_HOST)s:8000/v1/waitcondition',
heat_watch_server_url => 'http://%(CONFIG_HEAT_WATCH_HOST)s:8003',
heat_metadata_server_url => 'http://%(CONFIG_CONTROLLER_HOST)s:8000',
heat_waitcondition_server_url => 'http://%(CONFIG_CONTROLLER_HOST)s:8000/v1/waitcondition',
heat_watch_server_url => 'http://%(CONFIG_CONTROLLER_HOST)s:8003',
auth_encryption_key => '%(CONFIG_HEAT_AUTH_ENC_KEY)s',
}

View File

@ -1,2 +1,3 @@
class { 'heat::api_cfn':
}

View File

@ -1,2 +1,3 @@
class { 'heat::api_cloudwatch':
}

View File

@ -1,7 +1,7 @@
class { 'heat':
keystone_host => '%(CONFIG_KEYSTONE_HOST)s',
keystone_host => '%(CONFIG_CONTROLLER_HOST)s',
keystone_password => '%(CONFIG_HEAT_KS_PW)s',
auth_uri => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
auth_uri => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
rpc_backend => 'heat.openstack.common.rpc.impl_qpid',
qpid_hostname => '%(CONFIG_AMQP_HOST)s',
qpid_username => '%(CONFIG_AMQP_AUTH_USER)s',

View File

@ -1,7 +1,7 @@
class { 'heat':
keystone_host => '%(CONFIG_KEYSTONE_HOST)s',
keystone_host => '%(CONFIG_CONTROLLER_HOST)s',
keystone_password => '%(CONFIG_HEAT_KS_PW)s',
auth_uri => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
auth_uri => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
rpc_backend => 'heat.openstack.common.rpc.impl_kombu',
rabbit_host => '%(CONFIG_AMQP_HOST)s',
rabbit_userid => '%(CONFIG_AMQP_AUTH_USER)s',

View File

@ -9,9 +9,9 @@ package {$horizon_packages:
class {'horizon':
secret_key => '%(CONFIG_HORIZON_SECRET_KEY)s',
keystone_host => '%(CONFIG_KEYSTONE_HOST)s',
keystone_host => '%(CONFIG_CONTROLLER_HOST)s',
keystone_default_role => '_member_',
fqdn => ['%(CONFIG_HORIZON_HOST)s', "$::fqdn", 'localhost'],
fqdn => ['%(CONFIG_CONTROLLER_HOST)s', "$::fqdn", 'localhost'],
can_set_mount_point => 'False',
help_url =>'http://docs.openstack.org',
django_debug => %(CONFIG_DEBUG_MODE)s ? {true => 'True', false => 'False'},

View File

@ -14,9 +14,9 @@ class {"keystone::roles::admin":
}
class {"keystone::endpoint":
public_address => "%(CONFIG_KEYSTONE_HOST)s",
admin_address => "%(CONFIG_KEYSTONE_HOST)s",
internal_address => "%(CONFIG_KEYSTONE_HOST)s",
public_address => "%(CONFIG_CONTROLLER_HOST)s",
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
}
# Run token flush every minute (without output so we won't spam admins)

View File

@ -1,7 +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",
public_address => "%(CONFIG_CONTROLLER_HOST)s",
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
}

View File

@ -1,9 +1,9 @@
class {"cinder::keystone::auth":
password => "%(CONFIG_CINDER_KS_PW)s",
public_address => "%(CONFIG_CINDER_HOST)s",
admin_address => "%(CONFIG_CINDER_HOST)s",
internal_address => "%(CONFIG_CINDER_HOST)s",
public_address => "%(CONFIG_CONTROLLER_HOST)s",
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
}
keystone_service { "${cinder::keystone::auth::auth_name}_v2":

View File

@ -1,7 +1,7 @@
class {"glance::keystone::auth":
password => "%(CONFIG_GLANCE_KS_PW)s",
public_address => "%(CONFIG_GLANCE_HOST)s",
admin_address => "%(CONFIG_GLANCE_HOST)s",
internal_address => "%(CONFIG_GLANCE_HOST)s",
public_address => "%(CONFIG_CONTROLLER_HOST)s",
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
}

View File

@ -1,17 +1,17 @@
# heat::keystone::auth
class {"heat::keystone::auth":
password => "%(CONFIG_HEAT_KS_PW)s",
public_address => "%(CONFIG_HEAT_HOST)s",
admin_address => "%(CONFIG_HEAT_HOST)s",
internal_address => "%(CONFIG_HEAT_HOST)s",
public_address => "%(CONFIG_CONTROLLER_HOST)s",
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
}
if '%(CONFIG_HEAT_CFN_INSTALL)s' == 'y' {
# heat::keystone::cfn
class {"heat::keystone::auth_cfn":
password => "%(CONFIG_HEAT_KS_PW)s",
public_address => "%(CONFIG_HEAT_HOST)s",
admin_address => "%(CONFIG_HEAT_HOST)s",
internal_address => "%(CONFIG_HEAT_HOST)s",
public_address => "%(CONFIG_CONTROLLER_HOST)s",
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
}
}

View File

@ -1,7 +1,7 @@
class {"neutron::keystone::auth":
password => "%(CONFIG_NEUTRON_KS_PW)s",
public_address => "%(CONFIG_NEUTRON_SERVER_HOST)s",
admin_address => "%(CONFIG_NEUTRON_SERVER_HOST)s",
internal_address => "%(CONFIG_NEUTRON_SERVER_HOST)s",
public_address => "%(CONFIG_CONTROLLER_HOST)s",
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
}

View File

@ -1,8 +1,8 @@
class {"nova::keystone::auth":
password => "%(CONFIG_NOVA_KS_PW)s",
public_address => "%(CONFIG_NOVA_API_HOST)s",
admin_address => "%(CONFIG_NOVA_API_HOST)s",
internal_address => "%(CONFIG_NOVA_API_HOST)s",
public_address => "%(CONFIG_CONTROLLER_HOST)s",
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
cinder => true,
}

View File

@ -1,4 +1,4 @@
class { 'swift::keystone::auth':
public_address => '%(CONFIG_SWIFT_PROXY)s',
public_address => '%(CONFIG_CONTROLLER_HOST)s',
password => '%(CONFIG_SWIFT_KS_PW)s',
}

View File

@ -15,7 +15,7 @@ class nagios_configs(){
file_line{'allowed_hosts':
path => '/etc/nagios/nrpe.cfg',
match => 'allowed_hosts=',
line => 'allowed_hosts=%(CONFIG_NAGIOS_HOST)s',
line => 'allowed_hosts=%(CONFIG_CONTROLLER_HOST)s',
}
# 5 minute load average
@ -41,5 +41,3 @@ service{'nrpe':
enable => true,
hasstatus => true,
}

View File

@ -46,7 +46,7 @@ class nagios_configs(){
content => "export OS_USERNAME=admin
export OS_TENANT_NAME=admin
export OS_PASSWORD=%(CONFIG_KEYSTONE_ADMIN_PW)s
export OS_AUTH_URL=http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0/ ",}
export OS_AUTH_URL=http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0/ ",}
%(CONFIG_NAGIOS_MANIFEST_CONFIG)s
}

View File

@ -2,7 +2,7 @@ class { 'neutron::server':
sql_connection => $neutron_sql_connection,
connection => $neutron_sql_connection,
auth_password => $neutron_user_password,
auth_host => '%(CONFIG_KEYSTONE_HOST)s',
auth_host => '%(CONFIG_CONTROLLER_HOST)s',
enabled => true,
}

View File

@ -1,6 +1,6 @@
class {'neutron::agents::metadata':
auth_password => '%(CONFIG_NEUTRON_KS_PW)s',
auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
auth_url => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
shared_secret => '%(CONFIG_NEUTRON_METADATA_PW)s',
metadata_ip => '%(CONFIG_NOVA_API_HOST)s',
metadata_ip => '%(CONFIG_CONTROLLER_HOST)s',
}

View File

@ -3,7 +3,6 @@ class { 'neutron::server::notifications':
nova_admin_username => 'nova',
nova_admin_password => '%(CONFIG_NOVA_KS_PW)s',
nova_admin_tenant_name => 'services',
nova_url => 'http://%(CONFIG_NOVA_API_HOST)s:8774/v2',
nova_admin_auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
nova_url => 'http://%(CONFIG_CONTROLLER_HOST)s:8774/v2',
nova_admin_auth_url => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
}

View File

@ -2,7 +2,7 @@
require 'keystone::python'
class {"nova::api":
enabled => true,
auth_host => "%(CONFIG_KEYSTONE_HOST)s",
auth_host => "%(CONFIG_CONTROLLER_HOST)s",
admin_password => "%(CONFIG_NOVA_KS_PW)s",
neutron_metadata_proxy_shared_secret => %(CONFIG_NEUTRON_METADATA_PW_UNQUOTED)s
}

View File

@ -1,6 +1,6 @@
class { 'ceilometer::agent::auth':
auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
auth_url => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
auth_password => '%(CONFIG_CEILOMETER_KS_PW)s',
}

View File

@ -5,7 +5,5 @@ Firewall <| |> -> Class['nova']
nova_config{
"DEFAULT/sql_connection": value => "%(CONFIG_NOVA_SQL_CONN)s";
"DEFAULT/metadata_host": value => "%(CONFIG_NOVA_METADATA_HOST)s";
"DEFAULT/metadata_host": value => "%(CONFIG_CONTROLLER_HOST)s";
}

View File

@ -1,6 +1,6 @@
class { "nova":
glance_api_servers => "%(CONFIG_GLANCE_HOST)s:9292",
glance_api_servers => "%(CONFIG_CONTROLLER_HOST)s:9292",
qpid_hostname => "%(CONFIG_AMQP_HOST)s",
qpid_username => '%(CONFIG_AMQP_AUTH_USER)s',
qpid_password => '%(CONFIG_AMQP_AUTH_PASSWORD)s',

View File

@ -1,6 +1,6 @@
class { "nova":
glance_api_servers => "%(CONFIG_GLANCE_HOST)s:9292",
glance_api_servers => "%(CONFIG_CONTROLLER_HOST)s:9292",
rabbit_host => "%(CONFIG_AMQP_HOST)s",
rabbit_port => '%(CONFIG_AMQP_CLIENTS_PORT)s',
rabbit_userid => '%(CONFIG_AMQP_AUTH_USER)s',

View File

@ -26,7 +26,7 @@ nova_config{
class {"nova::compute":
enabled => true,
vncproxy_host => "%(CONFIG_NOVA_VNCPROXY_HOST)s",
vncproxy_host => "%(CONFIG_CONTROLLER_HOST)s",
vncserver_proxyclient_address => "%(CONFIG_NOVA_COMPUTE_HOST)s",
}

View File

@ -2,9 +2,9 @@
class {"nova::network::neutron":
neutron_admin_password => "%(CONFIG_NEUTRON_KS_PW)s",
neutron_auth_strategy => "keystone",
neutron_url => "http://%(CONFIG_NEUTRON_SERVER_HOST)s:9696",
neutron_url => "http://%(CONFIG_CONTROLLER_HOST)s:9696",
neutron_admin_tenant_name => "services",
neutron_admin_auth_url => "http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0",
neutron_admin_auth_url => "http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0",
}
class {"nova::compute::neutron":

View File

@ -8,7 +8,7 @@ package { $clientlibs: }
$rcadmin_content = "export OS_USERNAME=admin
export OS_TENANT_NAME=admin
export OS_PASSWORD=%(CONFIG_KEYSTONE_ADMIN_PW)s
export OS_AUTH_URL=http://%(CONFIG_KEYSTONE_HOST)s:5000/v2.0/
export OS_AUTH_URL=http://%(CONFIG_CONTROLLER_HOST)s:5000/v2.0/
export PS1='[\\u@\\h \\W(keystone_admin)]\\$ '
"
@ -25,7 +25,7 @@ if '%(CONFIG_PROVISION_DEMO)s' == 'y' {
content => "export OS_USERNAME=demo
export OS_TENANT_NAME=demo
export OS_PASSWORD=%(CONFIG_KEYSTONE_DEMO_PW)s
export OS_AUTH_URL=http://%(CONFIG_KEYSTONE_HOST)s:5000/v2.0/
export OS_AUTH_URL=http://%(CONFIG_CONTROLLER_HOST)s:5000/v2.0/
export PS1='[\\u@\\h \\W(keystone_demo)]\\$ '
",
}

View File

@ -8,11 +8,7 @@ class { 'swift::ringbuilder':
# sets up an rsync db that can be used to sync the ring DB
class { 'swift::ringserver':
local_net_ip => "%(CONFIG_SWIFT_BUILDER_HOST)s",
}
@@swift::ringsync { ['account', 'object', 'container']:
ring_server => $swift_local_net_ip
local_net_ip => "%(CONFIG_CONTROLLER_HOST)s",
}
if ($::selinux != "false"){

View File

@ -1,10 +1,8 @@
swift::storage::loopback { [%(SWIFT_STORAGE_DEVICES)s]:
swift::storage::loopback { 'swift_loopback':
base_dir => '/srv/loopback-device',
mnt_base_dir => '/srv/node',
require => Class['swift'],
fstype => '%(CONFIG_SWIFT_STORAGE_FSTYPE)s',
seek => '%(SWIFT_STORAGE_SEEK)s',
seek => '%(CONFIG_SWIFT_STORAGE_SEEK)s',
}

View File

@ -5,7 +5,7 @@ class { 'memcached':
}
class { 'swift::proxy':
proxy_local_net_ip => '%(CONFIG_SWIFT_PROXY)s',
proxy_local_net_ip => '%(CONFIG_CONTROLLER_HOST)s',
pipeline => [
'bulk',
'catch_errors',
@ -62,7 +62,7 @@ class { 'swift::proxy::authtoken':
admin_tenant_name => 'services',
admin_password => '%(CONFIG_SWIFT_KS_PW)s',
# assume that the controller host is the swift api server
auth_host => '%(CONFIG_KEYSTONE_HOST)s',
auth_host => '%(CONFIG_CONTROLLER_HOST)s',
}
firewall { '001 swift proxy incoming':

View File

@ -1,7 +1,7 @@
# install all swift storage servers together
class { 'swift::storage::all':
storage_local_net_ip => '%(CONFIG_SWIFT_STORAGE_CURRENT)s',
storage_local_net_ip => '%(CONFIG_CONTROLLER_HOST)s',
allow_versions => true,
require => Class['swift'],
}
@ -15,10 +15,8 @@ if(!defined(File['/srv/node'])) {
}
}
swift::ringsync{["account","container","object"]:
ring_server => '%(CONFIG_SWIFT_BUILDER_HOST)s',
swift::ringsync{ ["account", "container", "object"]:
ring_server => '%(CONFIG_CONTROLLER_HOST)s',
before => Class['swift::storage::all'],
require => Class['swift'],
}

View File

@ -39,7 +39,7 @@ class StepTestCase(PackstackTestCaseMixin, TestCase):
"""
Test packstack.instaler.core.sequences.Step run.
"""
def func(config):
def func(config, messages):
if 'test' not in config:
raise AssertionError('Missing config value.')
@ -59,11 +59,11 @@ class SequenceTestCase(PackstackTestCaseMixin, TestCase):
self._stdout = sys.stdout
sys.stdout = StringIO.StringIO()
self.steps = [{'name': '1', 'function': lambda x: True,
self.steps = [{'name': '1', 'function': lambda x, y: True,
'title': 'Step 1'},
{'name': '2', 'function': lambda x: True,
{'name': '2', 'function': lambda x, y: True,
'title': 'Step 2'},
{'name': '3', 'function': lambda x: True,
{'name': '3', 'function': lambda x, y: True,
'title': 'Step 3'}]
self.seq = Sequence('test', self.steps, condition='test',

View File

@ -18,8 +18,7 @@ downloadcache = ~/cache/pip
[testenv:pep8]
deps=pep8==1.2
commands = pep8 --exclude=*.pyc --repeat --show-source \
packstack/modules tests setup.py packstack/installer/utils \
packstack/installer/processors.py
packstack/modules packstack/plugins tests setup.py
[testenv:cover]