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) "Object %s is not callable." % function)
self.function = function self.function = function
def run(self, config=None): def run(self, config=None, messages=None):
config = config or {} 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 # TO-DO: complete logger name when logging will be setup correctly
logger = logging.getLogger() logger = logging.getLogger()
logger.debug('Running step %s.' % self.name) logger.debug('Running step %s.' % self.name)
# execute and report state # execute and report state
try: try:
self.function(config) self.function(config, messages)
except Exception, ex: except Exception, ex:
logger.debug(traceback.format_exc()) logger.debug(traceback.format_exc())
state = utils.state_message(self.title, 'ERROR', 'red') state = utils.state_message(self.title, 'ERROR', 'red')
@ -75,16 +76,17 @@ class Sequence(object):
result = config.get(self.condition) result = config.get(self.condition)
return result == self.cond_match 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 Runs sequence of steps. Runs only specific step if step's name
is given via 'step' parameter. 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): if not self.validate_condition(config):
return return
if step: if step:
self.steps[step].run(config=config) self.steps[step].run(config=config, messages=messages)
return return
logger = logging.getLogger() logger = logging.getLogger()
@ -93,4 +95,4 @@ class Sequence(object):
sys.stdout.write('%s\n' % self.title) sys.stdout.write('%s\n' % self.title)
sys.stdout.flush() sys.stdout.flush()
for step in self.steps.itervalues(): 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(',')] hosts = [host.strip() for host in hosts.split(',')]
for group in controller.getAllGroups(): for group in controller.getAllGroups():
for param in group.parameters.itervalues(): 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 # and directives that contain _HOST are set to the controller node
if param.CONF_NAME.find("_HOST") != -1: if param.CONF_NAME.find("_HOST") != -1:
overrides[param.CONF_NAME] = hosts[0] overrides[param.CONF_NAME] = hosts[0]
# If there are more than one host, all but the first are a compute nodes # If there are more than one host, all but the first are a compute nodes
if len(hosts) > 1: 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 # We can also override defaults with command line options
_set_command_line_values(options) _set_command_line_values(options)

View File

@ -35,22 +35,6 @@ class Controller(object):
self.__single = object.__new__(self, *args, **kwargs) self.__single = object.__new__(self, *args, **kwargs)
return self.__single 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 # PLugins
def addPlugin(self, plugObj): def addPlugin(self, plugObj):
self.__PLUGINS.append(plugObj) self.__PLUGINS.append(plugObj)
@ -81,7 +65,7 @@ class Controller(object):
def runAllSequences(self): def runAllSequences(self):
for sequence in self.__SEQUENCES: for sequence in self.__SEQUENCES:
sequence.run(self.CONF) sequence.run(config=self.CONF, messages=self.MESSAGES)
def getSequenceByDesc(self, desc): def getSequenceByDesc(self, desc):
for sequence in self.getAllSequences(): for sequence in self.getAllSequences():

View File

@ -2,4 +2,4 @@
def get_mq(config, plugin): 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 Installs and configures amqp
""" """
@ -11,38 +13,35 @@ from packstack.installer import basedefs
from packstack.installer import utils from packstack.installer import utils
from packstack.modules.common import filtered_hosts from packstack.modules.common import filtered_hosts
from packstack.modules.ospluginutils import gethostlist,\ from packstack.modules.ospluginutils import (getManifestTemplate,
getManifestTemplate,\ appendManifestFile)
appendManifestFile
# Controller object will be initialized from main flow
controller = None
# Plugin name #------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-AMQP"
PLUGIN_NAME = "AMQP"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controllerObject): def initConfig(controller):
global controller params = [
controller = controllerObject {"CMD_OPTION": "amqp-backend",
logging.debug("Adding OpenStack AMQP configuration") "USAGE": ("Set the AMQP service backend. Allowed values are: "
paramsList = [ "qpid, rabbitmq"),
{"CMD_OPTION" : "amqp-server", "PROMPT": "Set the AMQP service backend",
"USAGE" : "Set the server for the AMQP service",
"PROMPT" : "Set the server for the AMQP service (qpid, rabbitmq)? ",
"OPTION_LIST": ["qpid", "rabbitmq"], "OPTION_LIST": ["qpid", "rabbitmq"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "rabbitmq", "DEFAULT_VALUE": "rabbitmq",
"MASK_INPUT": False, "MASK_INPUT": False,
"LOOSE_VALIDATION": False, "LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_AMQP_SERVER", "CONF_NAME": "CONFIG_AMQP_BACKEND",
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "amqp-host", {"CMD_OPTION": "amqp-host",
"USAGE" : "The IP address of the server on which to install the AMQP service", "USAGE": ("The IP address of the server on which to install the "
"AMQP service"),
"PROMPT": "Enter the IP address of the AMQP service", "PROMPT": "Enter the IP address of the AMQP service",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_ssh], "VALIDATORS": [validators.validate_ssh],
@ -53,6 +52,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "amqp-enable-ssl", {"CMD_OPTION": "amqp-enable-ssl",
"USAGE": "Enable SSL for the AMQP service", "USAGE": "Enable SSL for the AMQP service",
"PROMPT": "Enable SSL for the AMQP service?", "PROMPT": "Enable SSL for the AMQP service?",
@ -65,6 +65,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "amqp-enable-auth", {"CMD_OPTION": "amqp-enable-auth",
"USAGE": "Enable Authentication for the AMQP service", "USAGE": "Enable Authentication for the AMQP service",
"PROMPT": "Enable Authentication for the AMQP service?", "PROMPT": "Enable Authentication for the AMQP service?",
@ -78,20 +79,18 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "AMQP",
groupDict = { "GROUP_NAME" : "AMQPLANCE",
"DESCRIPTION": "AMQP Config parameters", "DESCRIPTION": "AMQP Config parameters",
"PRE_CONDITION": False, "PRE_CONDITION": False,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList) params = [
paramsList = [
{"CMD_OPTION": "amqp-nss-certdb-pw", {"CMD_OPTION": "amqp-nss-certdb-pw",
"USAGE" : "The password for the NSS certificate database of the AMQP service", "USAGE": ("The password for the NSS certificate database of the AMQP "
"service"),
"PROMPT": "Enter the password for NSS certificate database", "PROMPT": "Enter the password for NSS certificate database",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@ -102,8 +101,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "amqp-ssl-port", {"CMD_OPTION": "amqp-ssl-port",
"USAGE" : "The port in which the AMQP service listens to SSL connections", "USAGE": ("The port in which the AMQP service listens to SSL "
"connections"),
"PROMPT": "Enter the SSL port for the AMQP service", "PROMPT": "Enter the SSL port for the AMQP service",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@ -114,9 +115,12 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "amqp-ssl-cert-file", {"CMD_OPTION": "amqp-ssl-cert-file",
"USAGE" : "The filename of the certificate that the AMQP service is going to use", "USAGE": ("The filename of the certificate that the AMQP service "
"PROMPT" : "Enter the filename of the SSL certificate for the AMQP service", "is going to use"),
"PROMPT": ("Enter the filename of the SSL certificate for the AMQP "
"service"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "/etc/pki/tls/certs/amqp_selfcert.pem", "DEFAULT_VALUE": "/etc/pki/tls/certs/amqp_selfcert.pem",
@ -126,8 +130,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "amqp-ssl-key-file", {"CMD_OPTION": "amqp-ssl-key-file",
"USAGE" : "The filename of the private key that the AMQP service is going to use", "USAGE": ("The filename of the private key that the AMQP service "
"is going to use"),
"PROMPT": "Enter the private key filename", "PROMPT": "Enter the private key filename",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@ -138,6 +144,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "amqp-ssl-self-signed", {"CMD_OPTION": "amqp-ssl-self-signed",
"USAGE": "Auto Generates self signed SSL certificate and key", "USAGE": "Auto Generates self signed SSL certificate and key",
"PROMPT": "Generate Self Signed SSL Certificate", "PROMPT": "Generate Self Signed SSL Certificate",
@ -151,17 +158,15 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "AMQPSSL",
groupDict = { "GROUP_NAME" : "AMQPSSL",
"DESCRIPTION": "AMQP Config SSL parameters", "DESCRIPTION": "AMQP Config SSL parameters",
"PRE_CONDITION": "CONFIG_AMQP_ENABLE_SSL", "PRE_CONDITION": "CONFIG_AMQP_ENABLE_SSL",
"PRE_CONDITION_MATCH": "y", "PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList) params = [
paramsList = [
{"CMD_OPTION": "amqp-auth-user", {"CMD_OPTION": "amqp-auth-user",
"USAGE": "User for amqp authentication", "USAGE": "User for amqp authentication",
"PROMPT": "Enter the user for amqp authentication", "PROMPT": "Enter the user for amqp authentication",
@ -174,6 +179,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "amqp-auth-password", {"CMD_OPTION": "amqp-auth-password",
"USAGE": "Password for user authentication", "USAGE": "Password for user authentication",
"PROMPT": "Enter the password for user authentication", "PROMPT": "Enter the password for user authentication",
@ -186,36 +192,39 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "AMQPAUTH",
groupDict = { "GROUP_NAME" : "AMQPAUTH",
"DESCRIPTION": "AMQP Config Athentication parameters", "DESCRIPTION": "AMQP Config Athentication parameters",
"PRE_CONDITION": "CONFIG_AMQP_ENABLE_AUTH", "PRE_CONDITION": "CONFIG_AMQP_ENABLE_AUTH",
"PRE_CONDITION_MATCH": "y", "PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def initSequences(controller): def initSequences(controller):
amqpsteps = [ amqpsteps = [
{'title': 'Adding AMQP manifest entries', 'functions':[createmanifest]} {'title': 'Adding AMQP manifest entries',
'functions': [create_manifest]}
] ]
controller.addSequence("Installing AMQP", [], [], amqpsteps) controller.addSequence("Installing AMQP", [], [], amqpsteps)
def createmanifest(config):
manifestfile = "%s_amqp.pp"%config['CONFIG_AMQP_HOST'] #-------------------------- step functions --------------------------
manifestdata = ""
def create_manifest(config, messages):
server = utils.ScriptRunner(config['CONFIG_AMQP_HOST']) server = utils.ScriptRunner(config['CONFIG_AMQP_HOST'])
if config['CONFIG_AMQP_ENABLE_SSL'] == 'y': if config['CONFIG_AMQP_ENABLE_SSL'] == 'y':
config['CONFIG_AMQP_ENABLE_SSL'] = 'true' config['CONFIG_AMQP_ENABLE_SSL'] = 'true'
config['CONFIG_AMQP_PROTOCOL'] = 'ssl' config['CONFIG_AMQP_PROTOCOL'] = 'ssl'
config['CONFIG_AMQP_CLIENTS_PORT'] = "5671" config['CONFIG_AMQP_CLIENTS_PORT'] = "5671"
if config['CONFIG_AMQP_SSL_SELF_SIGNED'] == 'y': if config['CONFIG_AMQP_SSL_SELF_SIGNED'] == 'y':
server.append( "openssl req -batch -new -x509 -nodes -keyout %s -out %s -days 1095" server.append(
% (config['CONFIG_AMQP_SSL_KEY_FILE'], config['CONFIG_AMQP_SSL_CERT_FILE']) ) "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() server.execute()
else: else:
# Set default values # Set default values
@ -231,6 +240,7 @@ def createmanifest(config):
config['CONFIG_AMQP_AUTH_PASSWORD'] = 'guest' config['CONFIG_AMQP_AUTH_PASSWORD'] = 'guest'
config['CONFIG_AMQP_AUTH_USER'] = 'guest' config['CONFIG_AMQP_AUTH_USER'] = 'guest'
manifestfile = "%s_amqp.pp" % config['CONFIG_AMQP_HOST']
manifestdata = getManifestTemplate('amqp.pp') manifestdata = getManifestTemplate('amqp.pp')
# All hosts should be able to talk to amqp # All hosts should be able to talk to amqp

View File

@ -14,67 +14,49 @@ from packstack.modules.shortcuts import get_mq
from packstack.modules.ospluginutils import (getManifestTemplate, from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile) appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name #------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Ceilometer" PLUGIN_NAME = "OS-Ceilometer"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') 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_params = {
"CEILOMETER": [ "CEILOMETER": [
{"CMD_OPTION" : "ceilometer-host", {"CONF_NAME": "CONFIG_CEILOMETER_SECRET",
"USAGE" : ("The IP address of the server on which " "CMD_OPTION": "ceilometer-secret",
"to install Ceilometer"), "USAGE": "Secret key for signing metering messages",
"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", "PROMPT": "Enter the Ceilometer secret key",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16], "DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True, "MASK_INPUT": True,
"LOOSE_VALIDATION": False, "LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CEILOMETER_SECRET",
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "ceilometer-ks-passwd",
"USAGE" : "The password to use for Ceilometer to authenticate with Keystone", {"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", "PROMPT": "Enter the password for the Ceilometer Keystone access",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16], "DEFAULT_VALUE": uuid.uuid4().hex[:16],
"MASK_INPUT": True, "MASK_INPUT": True,
"LOOSE_VALIDATION": False, "LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_CEILOMETER_KS_PW",
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
], ],
"MONGODB": [ "MONGODB": [
{"CMD_OPTION": "mongodb-host", {"CMD_OPTION": "mongodb-host",
"USAGE" : ("The IP address of the server on which " "USAGE": ("The IP address of the server on which to install "
"to install mongodb"), "MongoDB"),
"PROMPT" : ("Enter the IP address of the mongodb server"), "PROMPT": "Enter the IP address of the MongoDB server",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_ssh], "VALIDATORS": [validators.validate_ssh],
"DEFAULT_VALUE": utils.get_localhost_ip(), "DEFAULT_VALUE": utils.get_localhost_ip(),
@ -94,6 +76,7 @@ def initConfig(controllerObject):
"PRE_CONDITION_MATCH": "y", "PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
{"GROUP_NAME": "MONGODB", {"GROUP_NAME": "MONGODB",
"DESCRIPTION": "MONGODB Config parameters", "DESCRIPTION": "MONGODB Config parameters",
"PRE_CONDITION": "CONFIG_CEILOMETER_INSTALL", "PRE_CONDITION": "CONFIG_CEILOMETER_INSTALL",
@ -101,11 +84,11 @@ def initConfig(controllerObject):
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
] ]
for group in ceilometer_groups: for group in ceilometer_groups:
paramList = ceilometer_params[group["GROUP_NAME"]] paramList = ceilometer_params[group["GROUP_NAME"]]
controller.addGroup(group, paramList) controller.addGroup(group, paramList)
def initSequences(controller): def initSequences(controller):
if controller.CONF['CONFIG_CEILOMETER_INSTALL'] != 'y': if controller.CONF['CONFIG_CEILOMETER_INSTALL'] != 'y':
return return
@ -120,10 +103,13 @@ def initSequences(controller):
steps) steps)
def create_manifest(config): #-------------------------- step functions --------------------------
manifestfile = "%s_ceilometer.pp" % config['CONFIG_CEILOMETER_HOST']
def create_manifest(config, messages):
manifestfile = "%s_ceilometer.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate(get_mq(config, "ceilometer")) manifestdata = getManifestTemplate(get_mq(config, "ceilometer"))
manifestdata += getManifestTemplate("ceilometer.pp") manifestdata += getManifestTemplate("ceilometer.pp")
config['FIREWALL_ALLOWED'] = "'ALL'" config['FIREWALL_ALLOWED'] = "'ALL'"
config['FIREWALL_SERVICE_NAME'] = 'ceilometer-api' config['FIREWALL_SERVICE_NAME'] = 'ceilometer-api'
config['FIREWALL_SERVICE_ID'] = 'ceilometer_api' config['FIREWALL_SERVICE_ID'] = 'ceilometer_api'
@ -136,16 +122,18 @@ def create_manifest(config):
manifestdata += getManifestTemplate("ceilometer_nova_disabled.pp") manifestdata += getManifestTemplate("ceilometer_nova_disabled.pp")
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
def create_mongodb_manifest(config):
def create_mongodb_manifest(config, messages):
manifestfile = "%s_mongodb.pp" % config['CONFIG_MONGODB_HOST'] manifestfile = "%s_mongodb.pp" % config['CONFIG_MONGODB_HOST']
manifestdata = getManifestTemplate("mongodb.pp") 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_SERVICE_NAME'] = 'mongodb-server'
config['FIREWALL_PORTS'] = "'27017'" config['FIREWALL_PORTS'] = "'27017'"
manifestdata += getManifestTemplate("firewall.pp") manifestdata += getManifestTemplate("firewall.pp")
appendManifestFile(manifestfile, manifestdata, 'pre') 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") manifestdata = getManifestTemplate("keystone_ceilometer.pp")
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
Installs and configures Cinder Installs and configures Cinder
""" """
@ -15,39 +17,23 @@ from packstack.installer.utils import split_hosts
from packstack.installer import basedefs from packstack.installer import basedefs
from packstack.installer import utils from packstack.installer import utils
from packstack.modules.shortcuts import get_mq 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 exceptions
from packstack.installer import output_messages 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 = "OS-Cinder"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controller):
def initConfig(controllerObject): params = [
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", {"CMD_OPTION": "cinder-db-passwd",
"USAGE": "The password to use for the Cinder to access DB", "USAGE": "The password to use for the Cinder to access DB",
"PROMPT": "Enter the password for the Cinder DB access", "PROMPT": "Enter the password for the Cinder DB access",
@ -60,8 +46,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-ks-passwd", {"CMD_OPTION": "cinder-ks-passwd",
"USAGE" : "The password to use for the Cinder to authenticate with Keystone", "USAGE": ("The password to use for the Cinder to authenticate with "
"Keystone"),
"PROMPT": "Enter the password for the Cinder Keystone access", "PROMPT": "Enter the password for the Cinder Keystone access",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@ -72,11 +60,12 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-backend", {"CMD_OPTION": "cinder-backend",
"USAGE" : ("The Cinder backend to use, valid options are: " "USAGE": ("The Cinder backend to use, valid options are: lvm, "
"lvm, gluster, nfs, vmdk"), "gluster, nfs"),
"PROMPT": "Enter the Cinder backend to be configured", "PROMPT": "Enter the Cinder backend to be configured",
"OPTION_LIST" : ["lvm", "gluster", "nfs", "vmdk"], "OPTION_LIST": ["lvm", "gluster", "nfs"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "lvm", "DEFAULT_VALUE": "lvm",
"MASK_INPUT": False, "MASK_INPUT": False,
@ -86,28 +75,26 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "CINDER",
groupDict = { "GROUP_NAME" : "CINDER",
"DESCRIPTION": "Cinder Config parameters", "DESCRIPTION": "Cinder Config parameters",
"PRE_CONDITION": "CONFIG_CINDER_INSTALL", "PRE_CONDITION": "CONFIG_CINDER_INSTALL",
"PRE_CONDITION_MATCH": "y", "PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def check_lvm_options(config): def check_lvm_options(config):
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'lvm') config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'lvm')
paramsList = [ params = [
{"CMD_OPTION": "cinder-volumes-create", {"CMD_OPTION": "cinder-volumes-create",
"USAGE" : ("Create Cinder's volumes group. This should only be done for " "USAGE": ("Create Cinder's volumes group. This should only be done "
"testing on a proof-of-concept installation of Cinder. This " "for testing on a proof-of-concept installation of Cinder. "
"will create a file-backed volume group and is not suitable " "This will create a file-backed volume group and is not "
"for production usage."), "suitable for production usage."),
"PROMPT" : ("Should Cinder's volumes group be created (for proof-of-concept " "PROMPT": ("Should Cinder's volumes group be created (for "
"installation)?"), "proof-of-concept installation)?"),
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y", "DEFAULT_VALUE": "y",
@ -118,22 +105,20 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "CINDERVOLUMECREATE",
groupDict = { "GROUP_NAME" : "CINDERVOLUMECREATE",
"DESCRIPTION": "Cinder volume create Config parameters", "DESCRIPTION": "Cinder volume create Config parameters",
"PRE_CONDITION": check_lvm_options, "PRE_CONDITION": check_lvm_options,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def check_lvm_vg_options(config): def check_lvm_vg_options(config):
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'lvm' and config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'lvm' and
config.get('CONFIG_CINDER_VOLUMES_CREATE', 'y') == 'y') config.get('CONFIG_CINDER_VOLUMES_CREATE', 'y') == 'y')
paramsList = [ params = [
{"CMD_OPTION": "cinder-volumes-size", {"CMD_OPTION": "cinder-volumes-size",
"USAGE": ("Cinder's volumes group size. Note that actual volume size " "USAGE": ("Cinder's volumes group size. Note that actual volume size "
"will be extended with 3% more space for VG metadata."), "will be extended with 3% more space for VG metadata."),
@ -148,27 +133,25 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "CINDERVOLUMESIZE",
groupDict = { "GROUP_NAME" : "CINDERVOLUMESIZE",
"DESCRIPTION": "Cinder volume size Config parameters", "DESCRIPTION": "Cinder volume size Config parameters",
"PRE_CONDITION": check_lvm_vg_options, "PRE_CONDITION": check_lvm_vg_options,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def check_gluster_options(config): def check_gluster_options(config):
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'gluster') config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'gluster')
paramsList = [ params = [
{"CMD_OPTION": "cinder-gluster-mounts", {"CMD_OPTION": "cinder-gluster-mounts",
"USAGE": ("A single or comma separated list of gluster volume shares " "USAGE": ("A single or comma separated list of gluster volume shares "
"to mount, eg: ip-address:/vol-name, domain:/vol-name "), "to mount, eg: ip-address:/vol-name, domain:/vol-name "),
"PROMPT": ("Enter a single or comma separated list of gluster volume " "PROMPT": ("Enter a single or comma separated list of gluster volume "
"shares to use with Cinder"), "shares to use with Cinder"),
"OPTION_LIST" : ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'", \ "OPTION_LIST": ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'",
"^'[a-zA-Z0-9][\-\.\w]*:/.*'"], "^'[a-zA-Z0-9][\-\.\w]*:/.*'"],
"VALIDATORS": [validators.validate_multi_regexp], "VALIDATORS": [validators.validate_multi_regexp],
"PROCESSORS": [processors.process_add_quotes_around_values], "PROCESSORS": [processors.process_add_quotes_around_values],
@ -180,21 +163,19 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "CINDERGLUSTERMOUNTS",
groupDict = { "GROUP_NAME" : "CINDERGLUSTERMOUNTS",
"DESCRIPTION": "Cinder gluster Config parameters", "DESCRIPTION": "Cinder gluster Config parameters",
"PRE_CONDITION": check_gluster_options, "PRE_CONDITION": check_gluster_options,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def check_nfs_options(config): def check_nfs_options(config):
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'nfs') config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'nfs')
paramsList = [ params = [
{"CMD_OPTION": "cinder-nfs-mounts", {"CMD_OPTION": "cinder-nfs-mounts",
"USAGE": ("A single or comma seprated list of NFS exports to mount, " "USAGE": ("A single or comma seprated list of NFS exports to mount, "
"eg: ip-address:/export-name "), "eg: ip-address:/export-name "),
@ -211,15 +192,13 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "CINDERNFSMOUNTS",
groupDict = { "GROUP_NAME" : "CINDERNFSMOUNTS",
"DESCRIPTION": "Cinder NFS Config parameters", "DESCRIPTION": "Cinder NFS Config parameters",
"PRE_CONDITION": check_nfs_options, "PRE_CONDITION": check_nfs_options,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def initSequences(controller): def initSequences(controller):
@ -227,30 +206,40 @@ def initSequences(controller):
return return
cinder_steps = [ cinder_steps = [
{'title': 'Installing dependencies for Cinder', 'functions':[install_cinder_deps]}, {'title': 'Installing dependencies for Cinder',
{'title': 'Adding Cinder Keystone manifest entries', 'functions':[create_keystone_manifest]}, 'functions': [install_cinder_deps]},
{'title': 'Adding Cinder manifest entries', 'functions':[create_manifest]} {'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': 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) 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 = [] pkgs = []
if config['CONFIG_CINDER_BACKEND'] == 'lvm': if config['CONFIG_CINDER_BACKEND'] == 'lvm':
pkgs.append('lvm2') pkgs.append('lvm2')
for p in pkgs: 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() server.execute()
def check_cinder_vg(config):
def check_cinder_vg(config, messages):
cinders_volume = 'cinder-volumes' cinders_volume = 'cinder-volumes'
# Do we have a cinder-volumes vg? # Do we have a cinder-volumes vg?
have_cinders_volume = False have_cinders_volume = False
server = utils.ScriptRunner(config['CONFIG_CINDER_HOST']) server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
server.append('vgdisplay %s' % cinders_volume) server.append('vgdisplay %s' % cinders_volume)
try: try:
server.execute() server.execute()
@ -259,7 +248,7 @@ def check_cinder_vg(config):
pass pass
# Configure system LVM settings (snapshot_autoextend) # 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 +=.*/' server.append('sed -i -r "s/^ *snapshot_autoextend_threshold +=.*/'
' snapshot_autoextend_threshold = 80/" ' ' snapshot_autoextend_threshold = 80/" '
'/etc/lvm/lvm.conf') '/etc/lvm/lvm.conf')
@ -271,18 +260,18 @@ def check_cinder_vg(config):
except exceptions.ScriptRuntimeError: except exceptions.ScriptRuntimeError:
logging.info("Warning: Unable to set system LVM settings.") logging.info("Warning: Unable to set system LVM settings.")
if config["CONFIG_CINDER_VOLUMES_CREATE"] != "y": if config["CONFIG_CINDER_VOLUMES_CREATE"] != "y":
if not have_cinders_volume: if not have_cinders_volume:
raise exceptions.MissingRequirements("The cinder server should " raise exceptions.MissingRequirements("The cinder server should "
" contain a cinder-volumes volume group") "contain a cinder-volumes "
"volume group")
else: else:
if have_cinders_volume: if have_cinders_volume:
controller.MESSAGES.append( messages.append(
output_messages.INFO_CINDER_VOLUMES_EXISTS) output_messages.INFO_CINDER_VOLUMES_EXISTS)
return return
server = utils.ScriptRunner(config['CONFIG_CINDER_HOST']) server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
server.append('systemctl') server.append('systemctl')
try: try:
server.execute() server.execute()
@ -292,8 +281,6 @@ def check_cinder_vg(config):
server.clear() server.clear()
logging.info("A new cinder volumes group will be created") 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' cinders_volume_path = '/var/lib/cinder'
server.append('mkdir -p %s' % cinders_volume_path) server.append('mkdir -p %s' % cinders_volume_path)
@ -338,26 +325,27 @@ def check_cinder_vg(config):
# fails. # fails.
try: try:
logging.debug("Release loop device, volume creation failed") logging.debug("Release loop device, volume creation failed")
server = utils.ScriptRunner(controller.CONF['CONFIG_CINDER_HOST']) server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
server.append('losetup -d $(losetup -j %s | cut -d : -f 1)' % server.append('losetup -d $(losetup -j %s | cut -d : -f 1)'
cinders_volume_path % cinders_volume_path)
)
server.execute() server.execute()
except: except:
pass pass
raise exceptions.MissingRequirements(err) raise exceptions.MissingRequirements("Cinder's volume group '%s' "
"could not be created"
% cinders_volume)
def create_keystone_manifest(config): def create_keystone_manifest(config, messages):
manifestfile = "%s_keystone.pp" % controller.CONF['CONFIG_KEYSTONE_HOST'] manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone_cinder.pp") manifestdata = getManifestTemplate("keystone_cinder.pp")
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
def create_manifest(config): def create_manifest(config, messages):
manifestdata = getManifestTemplate(get_mq(config, "cinder")) 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") manifestdata += getManifestTemplate("cinder.pp")
if config['CONFIG_CINDER_BACKEND'] == "gluster": if config['CONFIG_CINDER_BACKEND'] == "gluster":
@ -369,15 +357,15 @@ def create_manifest(config):
if config['CONFIG_CEILOMETER_INSTALL'] == 'y': if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
manifestdata += getManifestTemplate('cinder_ceilometer.pp') manifestdata += getManifestTemplate('cinder_ceilometer.pp')
if config['CONFIG_SWIFT_INSTALL'] == 'y': if config['CONFIG_SWIFT_INSTALL'] == 'y':
config['CONFIG_SWIFT_PROXY'] = config['CONFIG_SWIFT_PROXY_HOSTS'].split(',')[0].strip()
manifestdata += getManifestTemplate('cinder_backup.pp') manifestdata += getManifestTemplate('cinder_backup.pp')
config['FIREWALL_SERVICE_NAME'] = "cinder" config['FIREWALL_SERVICE_NAME'] = "cinder"
config['FIREWALL_PORTS'] = "'3260', '8776'" config['FIREWALL_PORTS'] = "'3260', '8776'"
config['FIREWALL_CHAIN'] = "INPUT" config['FIREWALL_CHAIN'] = "INPUT"
if (config['CONFIG_NOVA_INSTALL'] == 'y' and config['CONFIG_VMWARE_BACKEND']=='n'): if (config['CONFIG_NOVA_INSTALL'] == 'y' and
for host in split_hosts(config['CONFIG_NOVA_COMPUTE_HOSTS']): config['CONFIG_VMWARE_BACKEND'] == 'n'):
for host in split_hosts(config['CONFIG_COMPUTE_HOSTS']):
config['FIREWALL_ALLOWED'] = "'%s'" % host config['FIREWALL_ALLOWED'] = "'%s'" % host
config['FIREWALL_SERVICE_ID'] = "cinder_%s" % host config['FIREWALL_SERVICE_ID'] = "cinder_%s" % host
manifestdata += getManifestTemplate("firewall.pp") manifestdata += getManifestTemplate("firewall.pp")

View File

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

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
Installs and configures Glance Installs and configures Glance
""" """
@ -11,34 +13,17 @@ from packstack.installer import utils
from packstack.installer.utils import split_hosts from packstack.installer.utils import split_hosts
from packstack.modules.shortcuts import get_mq 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 #------------------ oVirt installer initialization ------------------
controller = None
# Plugin name
PLUGIN_NAME = "OS-Glance" PLUGIN_NAME = "OS-Glance"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controllerObject): def initConfig(controller):
global controller params = [
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", {"CMD_OPTION": "glance-db-passwd",
"USAGE": "The password to use for the Glance to access DB", "USAGE": "The password to use for the Glance to access DB",
"PROMPT": "Enter the password for the Glance DB access", "PROMPT": "Enter the password for the Glance DB access",
@ -51,8 +36,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "glance-ks-passwd", {"CMD_OPTION": "glance-ks-passwd",
"USAGE" : "The password to use for the Glance to authenticate with Keystone", "USAGE": ("The password to use for the Glance to authenticate "
"with Keystone"),
"PROMPT": "Enter the password for the Glance Keystone access", "PROMPT": "Enter the password for the Glance Keystone access",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@ -64,15 +51,13 @@ def initConfig(controllerObject):
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "GLANCE",
groupDict = { "GROUP_NAME" : "GLANCE",
"DESCRIPTION": "Glance Config parameters", "DESCRIPTION": "Glance Config parameters",
"PRE_CONDITION": "CONFIG_GLANCE_INSTALL", "PRE_CONDITION": "CONFIG_GLANCE_INSTALL",
"PRE_CONDITION_MATCH": "y", "PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def initSequences(controller): def initSequences(controller):
@ -84,27 +69,34 @@ def initSequences(controller):
return return
glancesteps = [ glancesteps = [
{'title': 'Adding Glance Keystone manifest entries', 'functions':[createkeystonemanifest]}, {'title': 'Adding Glance Keystone manifest entries',
{'title': 'Adding Glance manifest entries', 'functions':[createmanifest]} 'functions': [create_keystone_manifest]},
{'title': 'Adding Glance manifest entries',
'functions': [create_manifest]}
] ]
controller.addSequence("Installing OpenStack Glance", [], [], glancesteps) 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") manifestdata = getManifestTemplate("keystone_glance.pp")
appendManifestFile(manifestfile, manifestdata) 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") manifestdata = getManifestTemplate("glance.pp")
if config['CONFIG_CEILOMETER_INSTALL'] == 'y': 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_SERVICE_NAME'] = "glance"
config['FIREWALL_PORTS'] = "'9292'" config['FIREWALL_PORTS'] = "'9292'"
config['FIREWALL_CHAIN'] = "INPUT" config['FIREWALL_CHAIN'] = "INPUT"
if config['CONFIG_NOVA_INSTALL'] == 'y': 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_ALLOWED'] = "'%s'" % host
config['FIREWALL_SERVICE_ID'] = "glance_%s" % host config['FIREWALL_SERVICE_ID'] = "glance_%s" % host
manifestdata += getManifestTemplate("firewall.pp") manifestdata += getManifestTemplate("firewall.pp")

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
Installs and configures heat Installs and configures heat
""" """
@ -14,36 +16,18 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
manifestfiles, manifestfiles,
appendManifestFile) appendManifestFile)
controller = None
# Plugin name #------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-HEAT"
PLUGIN_NAME = "OS-Heat"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controller):
def initConfig(controllerObject):
global controller
controller = controllerObject
logging.debug("Adding OpenStack Heat configuration")
parameters = [ parameters = [
{"CMD_OPTION" : "heat-host", {"CMD_OPTION": "os-heat-mysql-password",
"USAGE" : ('The IP address of the server on which ' "USAGE": ('The password used by Heat user to authenticate against '
'to install Heat service'), 'MySQL'),
"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", "PROMPT": "Enter the password for the Heat MySQL user",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@ -56,8 +40,10 @@ def initConfig(controllerObject):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "heat-auth-encryption-key", {"CMD_OPTION": "heat-auth-encryption-key",
"USAGE" : "The encryption key to use for authentication info in database", "USAGE": ("The encryption key to use for authentication info "
"PROMPT" : "Enter the authentication key for Heat to use for authenticate info in database", "in database"),
"PROMPT": ("Enter the authentication key for Heat to use for "
"authenticate info in database"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16], "DEFAULT_VALUE": uuid.uuid4().hex[:16],
@ -68,8 +54,9 @@ def initConfig(controllerObject):
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "heat-ks-passwd", {"CMD_OPTION": "os-heat-ks-passwd",
"USAGE" : "The password to use for the Heat to authenticate with Keystone", "USAGE": ("The password to use for the Heat to authenticate "
"with Keystone"),
"PROMPT": "Enter the password for the Heat Keystone access", "PROMPT": "Enter the password for the Heat Keystone access",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@ -82,8 +69,8 @@ def initConfig(controllerObject):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-heat-cloudwatch-install", {"CMD_OPTION": "os-heat-cloudwatch-install",
"USAGE" : ("Set to 'y' if you would like Packstack to " "USAGE": ("Set to 'y' if you would like Packstack to install Heat "
"install Heat CloudWatch API"), "CloudWatch API"),
"PROMPT": "Should Packstack install Heat CloudWatch API", "PROMPT": "Should Packstack install Heat CloudWatch API",
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
@ -96,8 +83,8 @@ def initConfig(controllerObject):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-heat-cfn-install", {"CMD_OPTION": "os-heat-cfn-install",
"USAGE" : ("Set to 'y' if you would like Packstack to " "USAGE": ("Set to 'y' if you would like Packstack to install Heat "
"install Heat CloudFormation API"), "CloudFormation API"),
"PROMPT": "Should Packstack install Heat CloudFormation API", "PROMPT": "Should Packstack install Heat CloudFormation API",
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
@ -117,113 +104,53 @@ def initConfig(controllerObject):
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, parameters) 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 },
]
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,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, parameters)
def initSequences(controller): def initSequences(controller):
if controller.CONF['CONFIG_HEAT_INSTALL'] != 'y': config = controller.CONF
if config['CONFIG_HEAT_INSTALL'] != 'y':
return return
steps = [{'title': 'Adding Heat manifest entries', steps = [
{'title': 'Adding Heat manifest entries',
'functions': [create_manifest]}, 'functions': [create_manifest]},
{'title': 'Adding Heat Keystone manifest entries', {'title': 'Adding Heat Keystone manifest entries',
'functions':[create_keystone_manifest]}] 'functions': [create_keystone_manifest]}
]
if controller.CONF.get('CONFIG_HEAT_CLOUDWATCH_INSTALL', 'n') == 'y': if config.get('CONFIG_HEAT_CLOUDWATCH_INSTALL', 'n') == 'y':
steps.append({'title': 'Adding Heat CloudWatch API manifest entries', steps.append(
{'title': 'Adding Heat CloudWatch API manifest entries',
'functions': [create_cloudwatch_manifest]}) 'functions': [create_cloudwatch_manifest]})
if controller.CONF.get('CONFIG_HEAT_CFN_INSTALL', 'n') == 'y': if config.get('CONFIG_HEAT_CFN_INSTALL', 'n') == 'y':
steps.append({'title': 'Adding Heat CloudFormation API manifest entries', steps.append(
{'title': 'Adding Heat CloudFormation API manifest entries',
'functions': [create_cfn_manifest]}) 'functions': [create_cfn_manifest]})
controller.addSequence("Installing Heat", [], [], steps) controller.addSequence("Installing Heat", [], [], steps)
def create_manifest(config): #-------------------------- step functions --------------------------
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']
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(get_mq(config, "heat"))
manifestdata += getManifestTemplate("heat.pp") manifestdata += getManifestTemplate("heat.pp")
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
def create_keystone_manifest(config): def create_keystone_manifest(config, messages):
manifestfile = "%s_keystone.pp" % controller.CONF['CONFIG_KEYSTONE_HOST'] manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone_heat.pp") manifestdata = getManifestTemplate("keystone_heat.pp")
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
def create_cloudwatch_manifest(config): def create_cloudwatch_manifest(config, messages):
manifestfile = "%s_heatcw.pp" % controller.CONF['CONFIG_HEAT_CLOUDWATCH_HOST'] manifestfile = "%s_heatcw.pp" % controller.CONF['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate(get_mq(config, "heat")) manifestdata = getManifestTemplate(get_mq(config, "heat"))
manifestdata += getManifestTemplate("heat_cloudwatch.pp") manifestdata += getManifestTemplate("heat_cloudwatch.pp")
appendManifestFile(manifestfile, manifestdata, marker='heat') appendManifestFile(manifestfile, manifestdata, marker='heat')
def create_cfn_manifest(config): def create_cfn_manifest(config, messages):
manifestfile = "%s_heatcnf.pp" % controller.CONF['CONFIG_HEAT_CFN_HOST'] manifestfile = "%s_heatcnf.pp" % controller.CONF['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate(get_mq(config, "heat")) manifestdata = getManifestTemplate(get_mq(config, "heat"))
manifestdata += getManifestTemplate("heat_cfn.pp") manifestdata += getManifestTemplate("heat_cfn.pp")
appendManifestFile(manifestfile, manifestdata, marker='heat') appendManifestFile(manifestfile, manifestdata, marker='heat')

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
Installs and configures Keystone Installs and configures Keystone
""" """
@ -9,35 +11,18 @@ from packstack.installer import validators
from packstack.installer import basedefs from packstack.installer import basedefs
from packstack.installer import utils from packstack.installer import utils
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile from packstack.modules.ospluginutils import (getManifestTemplate,
from packstack.installer.utils import host_iter appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name #------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Keystone" PLUGIN_NAME = "OS-Keystone"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controllerObject): def initConfig(controller):
global controller params = [
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", {"CMD_OPTION": "keystone-db-passwd",
"USAGE": "The password to use for the Keystone to access DB", "USAGE": "The password to use for the Keystone to access DB",
"PROMPT": "Enter the password for the Keystone DB access", "PROMPT": "Enter the password for the Keystone DB access",
@ -50,6 +35,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "keystone-admin-token", {"CMD_OPTION": "keystone-admin-token",
"USAGE": "The token to use for the Keystone service api", "USAGE": "The token to use for the Keystone service api",
"PROMPT": "The token to use for the Keystone service api", "PROMPT": "The token to use for the Keystone service api",
@ -62,6 +48,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "keystone-admin-passwd", {"CMD_OPTION": "keystone-admin-passwd",
"USAGE": "The password to use for the Keystone admin user", "USAGE": "The password to use for the Keystone admin user",
"PROMPT": "Enter the password for the Keystone admin user", "PROMPT": "Enter the password for the Keystone admin user",
@ -74,6 +61,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "keystone-demo-passwd", {"CMD_OPTION": "keystone-demo-passwd",
"USAGE": "The password to use for the Keystone demo user", "USAGE": "The password to use for the Keystone demo user",
"PROMPT": "Enter the password for the Keystone demo user", "PROMPT": "Enter the password for the Keystone demo user",
@ -86,6 +74,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "keystone-token-format", {"CMD_OPTION": "keystone-token-format",
"USAGE": "Kestone token format. Use either UUID or PKI", "USAGE": "Kestone token format. Use either UUID or PKI",
"PROMPT": "Enter the Keystone token format.", "PROMPT": "Enter the Keystone token format.",
@ -99,15 +88,13 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "KEYSTONE",
groupDict = { "GROUP_NAME" : "KEYSTONE",
"DESCRIPTION": "Keystone Config parameters", "DESCRIPTION": "Keystone Config parameters",
"PRE_CONDITION": lambda x: 'yes', "PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes", "PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def initSequences(controller): def initSequences(controller):
@ -118,13 +105,18 @@ def initSequences(controller):
controller.addSequence("Installing OpenStack Keystone", [], [], controller.addSequence("Installing OpenStack Keystone", [], [],
keystonesteps) 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") manifestdata = getManifestTemplate("keystone.pp")
config['FIREWALL_ALLOWED'] = "'ALL'" config['FIREWALL_ALLOWED'] = "'ALL'"
config['FIREWALL_SERVICE_NAME'] = "keystone" config['FIREWALL_SERVICE_NAME'] = "keystone"
config['FIREWALL_SERVICE_ID'] = "keystone" config['FIREWALL_SERVICE_ID'] = "keystone"
config['FIREWALL_PORTS'] = "'5000', '35357'" config['FIREWALL_PORTS'] = "'5000', '35357'"
config['FIREWALL_CHAIN'] = "INPUT" config['FIREWALL_CHAIN'] = "INPUT"
manifestdata += getManifestTemplate("firewall.pp") manifestdata += getManifestTemplate("firewall.pp")
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
Installs and configures MySQL Installs and configures MySQL
""" """
@ -9,24 +11,22 @@ from packstack.installer import validators
from packstack.installer import utils from packstack.installer import utils
from packstack.installer.utils import split_hosts 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 #------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-MySQL"
PLUGIN_NAME = "MySQL"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controllerObject): def initConfig(controller):
global controller params = [
controller = controllerObject
logging.debug("Adding MySQL OpenStack configuration")
paramsList = [
{"CMD_OPTION": "mysql-host", {"CMD_OPTION": "mysql-host",
"USAGE" : "The IP address of the server on which to install MySQL", "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", "PROMPT": "Enter the IP address of the MySQL server",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_ssh], "VALIDATORS": [validators.validate_ssh],
@ -37,6 +37,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "mysql-user", {"CMD_OPTION": "mysql-user",
"USAGE": "Username for the MySQL admin user", "USAGE": "Username for the MySQL admin user",
"PROMPT": "Enter the username for the MySQL admin user", "PROMPT": "Enter the username for the MySQL admin user",
@ -49,6 +50,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "mysql-pw", {"CMD_OPTION": "mysql-pw",
"USAGE": "Password for the MySQL admin user", "USAGE": "Password for the MySQL admin user",
"PROMPT": "Enter the password for the MySQL admin user", "PROMPT": "Enter the password for the MySQL admin user",
@ -62,26 +64,26 @@ def initConfig(controllerObject):
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "MYSQL",
groupDict = { "GROUP_NAME" : "MYSQL",
"DESCRIPTION": "MySQL Config parameters", "DESCRIPTION": "MySQL Config parameters",
"PRE_CONDITION": lambda x: 'yes', "PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes", "PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def initSequences(controller): def initSequences(controller):
mysqlsteps = [ mysqlsteps = [
{'title': 'Adding MySQL manifest entries', {'title': 'Adding MySQL manifest entries',
'functions':[createmanifest]} 'functions': [create_manifest]}
] ]
controller.addSequence("Installing MySQL", [], [], mysqlsteps) controller.addSequence("Installing MySQL", [], [], mysqlsteps)
def createmanifest(config): #-------------------------- step functions --------------------------
def create_manifest(config, messages):
if config['CONFIG_MYSQL_INSTALL'] == 'y': if config['CONFIG_MYSQL_INSTALL'] == 'y':
install = True install = True
suffix = 'install' suffix = 'install'
@ -89,11 +91,7 @@ def createmanifest(config):
install = False install = False
suffix = 'noinstall' suffix = 'noinstall'
# In case we are not installing MySQL server, mysql* manifests have manifestfile = "%s_mysql.pp" % config['CONFIG_MYSQL_HOST']
# to be run from Keystone host
host = install and config['CONFIG_MYSQL_HOST'] \
or config['CONFIG_KEYSTONE_HOST']
manifestfile = "%s_mysql.pp" % host
manifestdata = [getManifestTemplate('mysql_%s.pp' % suffix)] manifestdata = [getManifestTemplate('mysql_%s.pp' % suffix)]
def append_for(module, suffix): def append_for(module, suffix):
@ -104,28 +102,12 @@ def createmanifest(config):
manifestdata.append(getManifestTemplate(template)) manifestdata.append(getManifestTemplate(template))
append_for("keystone", suffix) append_for("keystone", suffix)
hosts = set()
for mod in ['nova', 'cinder', 'glance', 'neutron', 'heat']: for mod in ['nova', 'cinder', 'glance', 'neutron', 'heat']:
if config['CONFIG_%s_INSTALL' % mod.upper()] == 'y': if config['CONFIG_%s_INSTALL' % mod.upper()] == 'y':
append_for(mod, suffix) append_for(mod, suffix)
# Check wich modules are enabled so we can allow their
# hosts on the firewall hosts = set([config['CONFIG_CONTROLLER_HOST']])
if mod != 'nova' and mod != 'neutron': hosts |= split_hosts(config['CONFIG_COMPUTE_HOSTS'])
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())
config['FIREWALL_SERVICE_NAME'] = "mysql" config['FIREWALL_SERVICE_NAME'] = "mysql"
config['FIREWALL_PORTS'] = "'3306'" config['FIREWALL_PORTS'] = "'3306'"

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
Installs and configures Nagios Installs and configures Nagios
""" """
@ -10,36 +12,18 @@ from packstack.installer import basedefs, output_messages
from packstack.installer import utils from packstack.installer import utils
from packstack.modules.common import filtered_hosts from packstack.modules.common import filtered_hosts
from packstack.modules.ospluginutils import gethostlist,\ from packstack.modules.ospluginutils import (getManifestTemplate,
getManifestTemplate,\ appendManifestFile)
appendManifestFile
# Controller object will be initialized from main flow
controller = None
# Plugin name #------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-Nagios" PLUGIN_NAME = "OS-Nagios"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controllerObject): def initConfig(controller):
global controller params = [
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", {"CMD_OPTION": "nagios-passwd",
"USAGE": "The password of the nagiosadmin user on the Nagios server", "USAGE": "The password of the nagiosadmin user on the Nagios server",
"PROMPT": "Enter the password for the nagiosadmin user", "PROMPT": "Enter the password for the nagiosadmin user",
@ -53,29 +37,30 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "NAGIOS",
groupDict = { "GROUP_NAME" : "NAGIOS",
"DESCRIPTION": "Nagios Config parameters", "DESCRIPTION": "Nagios Config parameters",
"PRE_CONDITION": "CONFIG_NAGIOS_INSTALL", "PRE_CONDITION": "CONFIG_NAGIOS_INSTALL",
"PRE_CONDITION_MATCH": "y", "PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def initSequences(controller): def initSequences(controller):
conf = controller.CONF if controller.CONF['CONFIG_NAGIOS_INSTALL'] != 'y':
if conf['CONFIG_NAGIOS_INSTALL'] != 'y':
return return
nagiossteps = [ nagiossteps = [
{'title': 'Adding Nagios server manifest entries', 'functions':[createmanifest]}, {'title': 'Adding Nagios server manifest entries',
{'title': 'Adding Nagios host manifest entries', 'functions':[createnrpemanifests]} 'functions': [create_manifest]},
{'title': 'Adding Nagios host manifest entries',
'functions': [create_nrpe_manifests]}
] ]
controller.addSequence("Installing Nagios", [], [], nagiossteps) controller.addSequence("Installing Nagios", [], [], nagiossteps)
#------------------------- helper functions -------------------------
def _serviceentry(**kwargs): def _serviceentry(**kwargs):
s = 'define service {\n' s = 'define service {\n'
for key in sorted(kwargs.keys()): for key in sorted(kwargs.keys()):
@ -83,6 +68,7 @@ def _serviceentry(**kwargs):
s += "\t}\n" s += "\t}\n"
return s return s
def _copy_script(**kwargs): def _copy_script(**kwargs):
# TODO : Replace all these shell templates with with python # TODO : Replace all these shell templates with with python
return ('file{"/usr/lib64/nagios/plugins/%(name)s":' return ('file{"/usr/lib64/nagios/plugins/%(name)s":'
@ -93,6 +79,7 @@ def _copy_script(**kwargs):
'command_line => "/usr/lib64/nagios/plugins/%(name)s",}\n' 'command_line => "/usr/lib64/nagios/plugins/%(name)s",}\n'
% kwargs) % kwargs)
def nagios_host(hostname, **kwargs): def nagios_host(hostname, **kwargs):
out = ("nagios_host { '%s': " % hostname) out = ("nagios_host { '%s': " % hostname)
for key, value in kwargs.items(): for key, value in kwargs.items():
@ -100,61 +87,83 @@ def nagios_host(hostname, **kwargs):
return "%s}\n" % out return "%s}\n" % out
def createmanifest(config): #-------------------------- step functions --------------------------
def create_manifest(config, messages):
manifest_entries = '' manifest_entries = ''
# I should be adding service entries with nagios_service but it appears to be broken # I should be adding service entries with nagios_service
# http://projects.puppetlabs.com/issues/3420 # but it appears to be broken http://projects.puppetlabs.com/issues/3420
service_entries = '' service_entries = ''
for hostname in gethostlist(config): for hostname in filtered_hosts(config):
manifest_entries += nagios_host(hostname, address=hostname, use='linux-server') manifest_entries += nagios_host(hostname, address=hostname,
use='linux-server')
service_entries += _serviceentry(name='load5-%s'%hostname, service_description='5 minute load average', service_entries += _serviceentry(
host_name=hostname, check_command="check_nrpe!load5", use="generic-service", name='load5-%s' % hostname,
normal_check_interval='5') 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_entries += _serviceentry(
name='df_var-%s' % hostname,
service_description='Percent disk space used on /var', service_description='Percent disk space used on /var',
host_name=hostname, host_name=hostname,
check_command="check_nrpe!df_var", use="generic-service") check_command="check_nrpe!df_var",
use="generic-service"
)
manifest_entries += _copy_script(name="keystone-user-list") 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', service_description='number of keystone users',
host_name=controller.CONF['CONFIG_NAGIOS_HOST'], host_name=config['CONFIG_CONTROLLER_HOST'],
check_command="keystone-user-list", use="generic-service", check_command="keystone-user-list",
normal_check_interval='5') 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") 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', 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", 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") 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', 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", 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") 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', 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", 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") 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', 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", check_command="swift-list", use="generic-service",
normal_check_interval='5') normal_check_interval='5'
)
manifest_entries += ("file { '/etc/nagios/nagios_service.cfg': \n" manifest_entries += ("file { '/etc/nagios/nagios_service.cfg': \n"
"ensure => present, mode => 644,\n" "ensure => present, mode => 644,\n"
@ -162,19 +171,20 @@ def createmanifest(config):
"before => Service['nagios'],\n" "before => Service['nagios'],\n"
"content => '%s'}" % service_entries) "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") manifestdata = getManifestTemplate("nagios_server.pp")
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
def createnrpemanifests(config):
for hostname in filtered_hosts(controller.CONF): def create_nrpe_manifests(config, messages):
controller.CONF['CONFIG_NRPE_HOST'] = hostname for hostname in filtered_hosts(config):
config['CONFIG_NRPE_HOST'] = hostname
manifestfile = "%s_nagios_nrpe.pp" % hostname manifestfile = "%s_nagios_nrpe.pp" % hostname
manifestdata = getManifestTemplate("nagios_nrpe.pp") manifestdata = getManifestTemplate("nagios_nrpe.pp")
# Only the Nagios host is allowed to talk to nrpe # Only the Nagios host is allowed to talk to nrpe
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_NAGIOS_HOST'] config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST']
config['FIREWALL_SERVICE_NAME'] = "nagios-nrpe" config['FIREWALL_SERVICE_NAME'] = "nagios-nrpe"
config['FIREWALL_SERVICE_ID'] = "nagios_nrpe" config['FIREWALL_SERVICE_ID'] = "nagios_nrpe"
config['FIREWALL_PORTS'] = '5666' config['FIREWALL_PORTS'] = '5666'
@ -182,7 +192,7 @@ def createnrpemanifests(config):
manifestdata += getManifestTemplate("firewall.pp") manifestdata += getManifestTemplate("firewall.pp")
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
controller.MESSAGES.append("To use Nagios, browse to http://%s/nagios " messages.append("To use Nagios, browse to "
"username : nagiosadmin, password : %s" % "http://%(CONFIG_CONTROLLER_HOST)s/nagios "
(controller.CONF['CONFIG_NAGIOS_HOST'], "username: nagiosadmin, password: %(CONFIG_NAGIOS_PW)s"
controller.CONF['CONFIG_NAGIOS_PW'])) % config)

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
Installs and configures neutron Installs and configures neutron
""" """
@ -12,38 +14,22 @@ from packstack.installer import validators
from packstack.installer.utils import split_hosts from packstack.installer.utils import split_hosts
from packstack.modules.shortcuts import get_mq 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
# Plugin name #------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-NEUTRON"
logging.debug("plugin %s loaded", __name__) PLUGIN_NAME = "OS-Neutron"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
def initConfig(controllerObject):
global controller
controller = controllerObject
logging.debug("Adding OpenStack Neutron configuration")
def initConfig(controller):
conf_params = { conf_params = {
"NEUTRON": [ "NEUTRON": [
{"CMD_OPTION" : "neutron-server-host", {"CMD_OPTION": "os-neutron-ks-password",
"USAGE" : "The IP addresses of the server on which to install the Neutron server", "USAGE": ("The password to use for Neutron to authenticate "
"PROMPT" : "Enter the IP address of the Neutron server", "with Keystone"),
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ip, validators.validate_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NEUTRON_SERVER_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "neutron-ks-password",
"USAGE" : "The password to use for Neutron to authenticate with Keystone",
"PROMPT": "Enter the password for Neutron Keystone access", "PROMPT": "Enter the password for Neutron Keystone access",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@ -54,7 +40,8 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-db-password",
{"CMD_OPTION": "os-neutron-db-password",
"USAGE": "The password to use for Neutron to access DB", "USAGE": "The password to use for Neutron to access DB",
"PROMPT": "Enter the password for Neutron DB access", "PROMPT": "Enter the password for Neutron DB access",
"OPTION_LIST": [], "OPTION_LIST": [],
@ -66,21 +53,14 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-l3-hosts",
"USAGE" : "A comma separated list of IP addresses on which to install Neutron L3 agent", {"CMD_OPTION": "os-neutron-l3-ext-bridge",
"PROMPT" : "Enter a comma separated list of IP addresses on which to install the Neutron L3 agent", "USAGE": ("The name of the bridge that the Neutron L3 agent will "
"OPTION_LIST" : [], "use for external traffic, or 'provider' if using "
"VALIDATORS" : [validators.validate_multi_ssh], "provider networks"),
"DEFAULT_VALUE" : utils.get_localhost_ip(), "PROMPT": ("Enter the bridge the Neutron L3 agent will use for "
"MASK_INPUT" : False, "external traffic, or 'provider' if using provider "
"LOOSE_VALIDATION": True, "networks"),
"CONF_NAME" : "CONFIG_NEUTRON_L3_HOSTS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "neutron-l3-ext-bridge",
"USAGE" : "The name of the bridge that the Neutron L3 agent will use for external traffic, or 'provider' if using provider networks",
"PROMPT" : "Enter the bridge the Neutron L3 agent will use for external traffic, or 'provider' if using provider networks",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": "br-ex", "DEFAULT_VALUE": "br-ex",
@ -90,33 +70,11 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-dhcp-hosts",
"USAGE" : "A comma separated list of IP addresses on which to install Neutron DHCP agent", {"CMD_OPTION": "os-neutron-l2-plugin",
"PROMPT" : "Enter a comma separated list of IP addresses on which to install Neutron DHCP agent",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_multi_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NEUTRON_DHCP_HOSTS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "neutron-lbaas-hosts",
"USAGE" : "A comma separated list of IP addresses on which to install Neutron LBaaS agent",
"PROMPT" : "Enter a comma separated list of IP addresses on which to install Neutron LBaaS agent",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_multi_ssh],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NEUTRON_LBAAS_HOSTS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "neutron-l2-plugin",
"USAGE": "The name of the L2 plugin to be used with Neutron", "USAGE": "The name of the L2 plugin to be used with Neutron",
"PROMPT" : "Enter the name of the L2 plugin to be used with Neutron", "PROMPT": ("Enter the name of the L2 plugin to be used "
"with Neutron"),
"OPTION_LIST": ["linuxbridge", "openvswitch", "ml2"], "OPTION_LIST": ["linuxbridge", "openvswitch", "ml2"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "openvswitch", "DEFAULT_VALUE": "openvswitch",
@ -126,21 +84,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-metadata-hosts",
"USAGE" : "A comma separated list of IP addresses on which to install Neutron metadata agent", {"CMD_OPTION": "os-neutron-metadata-pw",
"PROMPT" : "Enter a comma separated list of IP addresses on which to install the Neutron metadata agent", "USAGE": "Neutron metadata agent password",
"OPTION_LIST" : [], "PROMPT": "Enter Neutron metadata agent password",
"VALIDATORS" : [validators.validate_multi_ssh],
"DEFAULT_VALUE" : utils.get_localhost_ip(),
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NEUTRON_METADATA_HOSTS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "neutron-metadata-pw",
"USAGE" : "A comma separated list of IP addresses on which to install Neutron metadata agent",
"PROMPT" : "Enter a comma separated list of IP addresses on which to install the Neutron metadata agent",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": uuid.uuid4().hex[:16], "DEFAULT_VALUE": uuid.uuid4().hex[:16],
@ -150,11 +97,28 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-neutron-lbaas-install",
"USAGE": ("Set to 'y' if you would like Packstack to install "
"Neutron LBaaS"),
"PROMPT": "Should Packstack install Neutron LBaaS",
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n",
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_LBAAS_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
], ],
"NEUTRON_LB_PLUGIN": [ "NEUTRON_LB_PLUGIN": [
{"CMD_OPTION" : "neutron-lb-tenant-network-type", {"CMD_OPTION": "os-neutron-lb-tenant-network-type",
"USAGE" : "The type of network to allocate for tenant networks (eg. vlan, local)", "USAGE": ("The type of network to allocate for tenant networks "
"PROMPT" : "Enter the type of network to allocate for tenant networks", "(eg. vlan, local)"),
"PROMPT": ("Enter the type of network to allocate for tenant "
"networks"),
"OPTION_LIST": ["local", "vlan"], "OPTION_LIST": ["local", "vlan"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "local", "DEFAULT_VALUE": "local",
@ -164,9 +128,13 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-lb-vlan-ranges",
"USAGE" : "A comma separated list of VLAN ranges for the Neutron linuxbridge plugin (eg. physnet1:1:4094,physnet2,physnet3:3000:3999)", {"CMD_OPTION": "os-neutron-lb-vlan-ranges",
"PROMPT" : "Enter a comma separated list of VLAN ranges for the Neutron linuxbridge plugin", "USAGE": ("A comma separated list of VLAN ranges for the Neutron "
"linuxbridge plugin (eg. physnet1:1:4094,physnet2,"
"physnet3:3000:3999)"),
"PROMPT": ("Enter a comma separated list of VLAN ranges for "
"the Neutron linuxbridge plugin"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -177,10 +145,14 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
], ],
"NEUTRON_LB_PLUGIN_AND_AGENT": [ "NEUTRON_LB_PLUGIN_AND_AGENT": [
{"CMD_OPTION" : "neutron-lb-interface-mappings", {"CMD_OPTION": "os-neutron-lb-interface-mappings",
"USAGE" : "A comma separated list of interface mappings for the Neutron linuxbridge plugin (eg. physnet1:br-eth1,physnet2:br-eth2,physnet3:br-eth3)", "USAGE": ("A comma separated list of interface mappings for the "
"PROMPT" : "Enter a comma separated list of interface mappings for the Neutron linuxbridge plugin", "Neutron linuxbridge plugin (eg. physnet1:br-eth1,"
"physnet2:br-eth2,physnet3:br-eth3)"),
"PROMPT": ("Enter a comma separated list of interface mappings "
"for the Neutron linuxbridge plugin"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -191,10 +163,13 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
], ],
"NEUTRON_OVS_PLUGIN": [ "NEUTRON_OVS_PLUGIN": [
{"CMD_OPTION" : "neutron-ovs-tenant-network-type", {"CMD_OPTION": "os-neutron-ovs-tenant-network-type",
"USAGE" : "Type of network to allocate for tenant networks (eg. vlan, local, gre, vxlan)", "USAGE": ("Type of network to allocate for tenant networks "
"PROMPT" : "Enter the type of network to allocate for tenant networks", "(eg. vlan, local, gre, vxlan)"),
"PROMPT": ("Enter the type of network to allocate for tenant "
"networks"),
"OPTION_LIST": ["local", "vlan", "gre", "vxlan"], "OPTION_LIST": ["local", "vlan", "gre", "vxlan"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "local", "DEFAULT_VALUE": "local",
@ -204,9 +179,13 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-ovs-vlan-ranges",
"USAGE" : "A comma separated list of VLAN ranges for the Neutron openvswitch plugin (eg. physnet1:1:4094,physnet2,physnet3:3000:3999)", {"CMD_OPTION": "os-neutron-ovs-vlan-ranges",
"PROMPT" : "Enter a comma separated list of VLAN ranges for the Neutron openvswitch plugin", "USAGE": ("A comma separated list of VLAN ranges for the Neutron "
"openvswitch plugin (eg. physnet1:1:4094,physnet2,"
"physnet3:3000:3999)"),
"PROMPT": ("Enter a comma separated list of VLAN ranges for the "
"Neutron openvswitch plugin"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -217,10 +196,14 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
], ],
"NEUTRON_OVS_PLUGIN_AND_AGENT": [ "NEUTRON_OVS_PLUGIN_AND_AGENT": [
{"CMD_OPTION" : "neutron-ovs-bridge-mappings", {"CMD_OPTION": "os-neutron-ovs-bridge-mappings",
"USAGE" : "A comma separated list of bridge mappings for the Neutron openvswitch plugin (eg. physnet1:br-eth1,physnet2:br-eth2,physnet3:br-eth3)", "USAGE": ("A comma separated list of bridge mappings for the "
"PROMPT" : "Enter a comma separated list of bridge mappings for the Neutron openvswitch plugin", "Neutron openvswitch plugin (eg. physnet1:br-eth1,"
"physnet2:br-eth2,physnet3:br-eth3)"),
"PROMPT": ("Enter a comma separated list of bridge mappings for "
"the Neutron openvswitch plugin"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -230,9 +213,13 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-ovs-bridge-interfaces",
"USAGE" : "A comma separated list of colon-separated OVS bridge:interface pairs. The interface will be added to the associated bridge.", {"CMD_OPTION": "os-neutron-ovs-bridge-interfaces",
"PROMPT" : "Enter a comma separated list of OVS bridge:interface pairs for the Neutron openvswitch plugin", "USAGE": ("A comma separated list of colon-separated OVS "
"bridge:interface pairs. The interface will be added "
"to the associated bridge."),
"PROMPT": ("Enter a comma separated list of OVS bridge:interface "
"pairs for the Neutron openvswitch plugin"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -243,10 +230,13 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
], ],
"NEUTRON_OVS_PLUGIN_TUNNEL": [ "NEUTRON_OVS_PLUGIN_TUNNEL": [
{"CMD_OPTION" : "neutron-ovs-tunnel-ranges", {"CMD_OPTION": "os-neutron-ovs-tunnel-ranges",
"USAGE" : "A comma separated list of tunnel ranges for the Neutron openvswitch plugin (eg. 1:1000)", "USAGE": ("A comma separated list of tunnel ranges for the "
"PROMPT" : "Enter a comma separated list of tunnel ranges for the Neutron openvswitch plugin", "Neutron openvswitch plugin (eg. 1:1000)"),
"PROMPT": ("Enter a comma separated list of tunnel ranges for "
"the Neutron openvswitch plugin"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -257,10 +247,15 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
], ],
"NEUTRON_OVS_PLUGIN_AND_AGENT_TUNNEL": [ "NEUTRON_OVS_PLUGIN_AND_AGENT_TUNNEL": [
{"CMD_OPTION" : "neutron-ovs-tunnel-if", {"CMD_OPTION": "os-neutron-ovs-tunnel-if",
"USAGE" : "The interface for the OVS tunnel. Packstack will override the IP address used for tunnels on this hypervisor to the IP found on the specified interface. (eg. eth1) ", "USAGE": ("The interface for the OVS tunnel. Packstack will "
"PROMPT" : "Enter interface with IP to override the default tunnel local_ip", "override the IP address used for tunnels on this "
"hypervisor to the IP found on the specified interface."
" (eg. eth1)"),
"PROMPT": ("Enter interface with IP to override the default "
"tunnel local_ip"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -271,8 +266,9 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
], ],
"NEUTRON_OVS_PLUGIN_AND_AGENT_VXLAN": [ "NEUTRON_OVS_PLUGIN_AND_AGENT_VXLAN": [
{"CMD_OPTION" : "neutron-ovs-vxlan-udp-port", {"CMD_OPTION": "os-neutron-ovs-vxlan-udp-port",
"CONF_NAME": "CONFIG_NEUTRON_OVS_VXLAN_UDP_PORT", "CONF_NAME": "CONFIG_NEUTRON_OVS_VXLAN_UDP_PORT",
"USAGE": "VXLAN UDP port", "USAGE": "VXLAN UDP port",
"PROMPT": "Enter VXLAN UDP port number", "PROMPT": "Enter VXLAN UDP port number",
@ -286,14 +282,15 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
], ],
"NEUTRON_ML2_PLUGIN": [ "NEUTRON_ML2_PLUGIN": [
{"CMD_OPTION" : "neutron-ml2-type-drivers", {"CMD_OPTION": "os-neutron-ml2-type-drivers",
"CONF_NAME": "CONFIG_NEUTRON_ML2_TYPE_DRIVERS", "CONF_NAME": "CONFIG_NEUTRON_ML2_TYPE_DRIVERS",
"USAGE" : ("A comma separated list of network type " "USAGE": ("A comma separated list of network type driver "
"driver entrypoints to be loaded from the " "entrypoints to be loaded from the "
"neutron.ml2.type_drivers namespace."), "neutron.ml2.type_drivers namespace."),
"PROMPT" : ("Enter a comma separated list of network " "PROMPT": ("Enter a comma separated list of network type driver "
"type driver entrypoints"), "entrypoints"),
"OPTION_LIST": ["local", "flat", "vlan", "gre", "vxlan"], "OPTION_LIST": ["local", "flat", "vlan", "gre", "vxlan"],
"VALIDATORS": [validators.validate_multi_options], "VALIDATORS": [validators.validate_multi_options],
"DEFAULT_VALUE": "local", "DEFAULT_VALUE": "local",
@ -302,16 +299,15 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-ml2-tenant-network-types",
{"CMD_OPTION": "os-neutron-ml2-tenant-network-types",
"CONF_NAME": "CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES", "CONF_NAME": "CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES",
"USAGE" : ("A comma separated ordered list of " "USAGE": ("A comma separated ordered list of network_types to "
"network_types to allocate as tenant " "allocate as tenant networks. The value 'local' is "
"networks. The value 'local' is only useful " "only useful for single-box testing but provides no "
"for single-box testing but provides no "
"connectivity between hosts."), "connectivity between hosts."),
"PROMPT": ("Enter a comma separated ordered list of " "PROMPT": ("Enter a comma separated ordered list of "
"network_types to allocate as tenant " "network_types to allocate as tenant networks"),
"networks"),
"OPTION_LIST": ["local", "vlan", "gre", "vxlan"], "OPTION_LIST": ["local", "vlan", "gre", "vxlan"],
"VALIDATORS": [validators.validate_multi_options], "VALIDATORS": [validators.validate_multi_options],
"DEFAULT_VALUE": "local", "DEFAULT_VALUE": "local",
@ -320,17 +316,17 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-ml2-mechanism-drivers",
{"CMD_OPTION": "os-neutron-ml2-mechanism-drivers",
"CONF_NAME": "CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS", "CONF_NAME": "CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS",
"USAGE" : ("A comma separated ordered list of " "USAGE": ("A comma separated ordered list of networking "
"networking mechanism driver entrypoints " "mechanism driver entrypoints to be loaded from the "
"to be loaded from the "
"neutron.ml2.mechanism_drivers namespace."), "neutron.ml2.mechanism_drivers namespace."),
"PROMPT" : ("Enter a comma separated ordered list of " "PROMPT": ("Enter a comma separated ordered list of networking "
"networking mechanism driver entrypoints"), "mechanism driver entrypoints"),
"OPTION_LIST" : ["logger", "test", "linuxbridge", "OPTION_LIST": ["logger", "test", "linuxbridge", "openvswitch",
"openvswitch", "hyperv", "ncs", "arista", "hyperv", "ncs", "arista", "cisco_nexus",
"cisco_nexus", "l2population"], "l2population"],
"VALIDATORS": [validators.validate_multi_options], "VALIDATORS": [validators.validate_multi_options],
"DEFAULT_VALUE": "openvswitch", "DEFAULT_VALUE": "openvswitch",
"MASK_INPUT": False, "MASK_INPUT": False,
@ -338,15 +334,15 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-ml2-flat-networks",
{"CMD_OPTION": "os-neutron-ml2-flat-networks",
"CONF_NAME": "CONFIG_NEUTRON_ML2_FLAT_NETWORKS", "CONF_NAME": "CONFIG_NEUTRON_ML2_FLAT_NETWORKS",
"USAGE" : ("A comma separated list of physical_network" "USAGE": ("A comma separated list of physical_network names "
" names with which flat networks can be " "with which flat networks can be created. Use * to "
"created. Use * to allow flat networks with " "allow flat networks with arbitrary physical_network "
"arbitrary physical_network names."), "names."),
"PROMPT" : ("Enter a comma separated list of " "PROMPT": ("Enter a comma separated list of physical_network "
"physical_network names with which flat " "names with which flat networks can be created"),
"networks can be created"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
"DEFAULT_VALUE": "*", "DEFAULT_VALUE": "*",
@ -355,17 +351,17 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-ml2-vlan-ranges",
{"CMD_OPTION": "os-neutron-ml2-vlan-ranges",
"CONF_NAME": "CONFIG_NEUTRON_ML2_VLAN_RANGES", "CONF_NAME": "CONFIG_NEUTRON_ML2_VLAN_RANGES",
"USAGE" : ("A comma separated list of " "USAGE": ("A comma separated list of <physical_network>:"
"<physical_network>:<vlan_min>:<vlan_max> " "<vlan_min>:<vlan_max> or <physical_network> "
"or <physical_network> specifying " "specifying physical_network names usable for VLAN "
"physical_network names usable for VLAN " "provider and tenant networks, as well as ranges of "
"provider and tenant networks, as well as " "VLAN tags on each available for allocation to tenant "
"ranges of VLAN tags on each available for " "networks."),
"allocation to tenant networks."), "PROMPT": ("Enter a comma separated list of physical_network "
"PROMPT" : ("Enter a comma separated list of " "names usable for VLAN"),
"physical_network names usable for VLAN"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -374,17 +370,16 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-ml2-tunnel-id-ranges",
{"CMD_OPTION": "os-neutron-ml2-tunnel-id-ranges",
"CONF_NAME": "CONFIG_NEUTRON_ML2_TUNNEL_ID_RANGES", "CONF_NAME": "CONFIG_NEUTRON_ML2_TUNNEL_ID_RANGES",
"USAGE" : ("A comma separated list of <tun_min>:" "USAGE": ("A comma separated list of <tun_min>:<tun_max> tuples "
"<tun_max> tuples enumerating ranges of GRE " "enumerating ranges of GRE tunnel IDs that are "
"tunnel IDs that are available for tenant " "available for tenant network allocation. Should be "
"network allocation. Should be an array with" "an array with tun_max +1 - tun_min > 1000000"),
" tun_max +1 - tun_min > 1000000"), "PROMPT": ("Enter a comma separated list of <tun_min>:<tun_max> "
"PROMPT" : ("Enter a comma separated list of <tun_min>:" "tuples enumerating ranges of GRE tunnel IDs that "
"<tun_max> tuples enumerating ranges of GRE " "are available for tenant network allocation"),
"tunnel IDs that are available for tenant "
"network allocation"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -393,14 +388,14 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-ml2-vxlan-group",
{"CMD_OPTION": "os-neutron-ml2-vxlan-group",
"CONF_NAME": "CONFIG_NEUTRON_ML2_VXLAN_GROUP", "CONF_NAME": "CONFIG_NEUTRON_ML2_VXLAN_GROUP",
"USAGE" : ("Multicast group for VXLAN. If unset, " "USAGE": ("Multicast group for VXLAN. If unset, disables VXLAN "
"disables VXLAN enable sending allocate " "enable sending allocate broadcast traffic to this "
"broadcast traffic to this multicast group. " "multicast group. When left unconfigured, will disable "
"When left unconfigured, will disable " "multicast VXLAN mode. Should be an Multicast IP "
"multicast VXLAN mode. Should be an " "(v4 or v6) address."),
"Multicast IP (v4 or v6) address."),
"PROMPT": "Enter a multicast group for VXLAN", "PROMPT": "Enter a multicast group for VXLAN",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
@ -410,17 +405,16 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-ml2-vni-ranges",
{"CMD_OPTION": "os-neutron-ml2-vni-ranges",
"CONF_NAME": "CONFIG_NEUTRON_ML2_VNI_RANGES", "CONF_NAME": "CONFIG_NEUTRON_ML2_VNI_RANGES",
"USAGE" : ("A comma separated list of <vni_min>:" "USAGE": ("A comma separated list of <vni_min>:<vni_max> tuples "
"<vni_max> tuples enumerating ranges of " "enumerating ranges of VXLAN VNI IDs that are "
"VXLAN VNI IDs that are available for tenant" "available for tenant network allocation. Min value "
" network allocation. Min value is 0 and Max" "is 0 and Max value is 16777215."),
" value is 16777215."), "PROMPT": ("Enter a comma separated list of <vni_min>:<vni_max> "
"PROMPT" : ("Enter a comma separated list of <vni_min>:" "tuples enumerating ranges of VXLAN VNI IDs that are "
"<vni_max> tuples enumerating ranges of " "available for tenant network allocation"),
"VXLAN VNI IDs that are available for tenant"
" network allocation"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [], "VALIDATORS": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -429,9 +423,12 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "neutron-l2-agent", # We need to ask for this only in case of ML2 plugins
# We need to ask for this only in case of ML2 plugins
{"CMD_OPTION": "os-neutron-l2-agent",
"USAGE": "The name of the L2 agent to be used with Neutron", "USAGE": "The name of the L2 agent to be used with Neutron",
"PROMPT" : "Enter the name of the L2 agent to be used with Neutron", "PROMPT": ("Enter the name of the L2 agent to be used "
"with Neutron"),
"OPTION_LIST": ["linuxbridge", "openvswitch"], "OPTION_LIST": ["linuxbridge", "openvswitch"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "openvswitch", "DEFAULT_VALUE": "openvswitch",
@ -480,7 +477,8 @@ def initConfig(controllerObject):
return use_openvswitch_plugin(config) or use_ml2_with_ovs(config) return use_openvswitch_plugin(config) or use_ml2_with_ovs(config)
def use_openvswitch_agent_tunnel(config): def use_openvswitch_agent_tunnel(config):
return use_openvswitch_plugin_tunnel(config) or use_ml2_with_ovs(config) return (use_openvswitch_plugin_tunnel(config) or
use_ml2_with_ovs(config))
def use_openvswitch_vxlan(config): def use_openvswitch_vxlan(config):
ovs_vxlan = ( ovs_vxlan = (
@ -493,7 +491,6 @@ def initConfig(controllerObject):
) )
return ovs_vxlan or ml2_vxlan return ovs_vxlan or ml2_vxlan
conf_groups = [ conf_groups = [
{"GROUP_NAME": "NEUTRON", {"GROUP_NAME": "NEUTRON",
"DESCRIPTION": "Neutron config", "DESCRIPTION": "Neutron config",
@ -501,48 +498,56 @@ def initConfig(controllerObject):
"PRE_CONDITION_MATCH": "y", "PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NEUTRON_ML2_PLUGIN", {"GROUP_NAME": "NEUTRON_ML2_PLUGIN",
"DESCRIPTION": "Neutron ML2 plugin config", "DESCRIPTION": "Neutron ML2 plugin config",
"PRE_CONDITION": use_ml2_plugin, "PRE_CONDITION": use_ml2_plugin,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NEUTRON_LB_PLUGIN", {"GROUP_NAME": "NEUTRON_LB_PLUGIN",
"DESCRIPTION": "Neutron LB plugin config", "DESCRIPTION": "Neutron LB plugin config",
"PRE_CONDITION": use_linuxbridge_plugin, "PRE_CONDITION": use_linuxbridge_plugin,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NEUTRON_LB_PLUGIN_AND_AGENT", {"GROUP_NAME": "NEUTRON_LB_PLUGIN_AND_AGENT",
"DESCRIPTION": "Neutron LB agent config", "DESCRIPTION": "Neutron LB agent config",
"PRE_CONDITION": use_linuxbridge_agent, "PRE_CONDITION": use_linuxbridge_agent,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NEUTRON_OVS_PLUGIN", {"GROUP_NAME": "NEUTRON_OVS_PLUGIN",
"DESCRIPTION": "Neutron OVS plugin config", "DESCRIPTION": "Neutron OVS plugin config",
"PRE_CONDITION": use_openvswitch_plugin, "PRE_CONDITION": use_openvswitch_plugin,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NEUTRON_OVS_PLUGIN_AND_AGENT", {"GROUP_NAME": "NEUTRON_OVS_PLUGIN_AND_AGENT",
"DESCRIPTION": "Neutron OVS agent config", "DESCRIPTION": "Neutron OVS agent config",
"PRE_CONDITION": use_openvswitch_agent, "PRE_CONDITION": use_openvswitch_agent,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NEUTRON_OVS_PLUGIN_TUNNEL", {"GROUP_NAME": "NEUTRON_OVS_PLUGIN_TUNNEL",
"DESCRIPTION": "Neutron OVS plugin config for tunnels", "DESCRIPTION": "Neutron OVS plugin config for tunnels",
"PRE_CONDITION": use_openvswitch_plugin_tunnel, "PRE_CONDITION": use_openvswitch_plugin_tunnel,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NEUTRON_OVS_PLUGIN_AND_AGENT_TUNNEL", {"GROUP_NAME": "NEUTRON_OVS_PLUGIN_AND_AGENT_TUNNEL",
"DESCRIPTION": "Neutron OVS agent config for tunnels", "DESCRIPTION": "Neutron OVS agent config for tunnels",
"PRE_CONDITION": use_openvswitch_agent_tunnel, "PRE_CONDITION": use_openvswitch_agent_tunnel,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NEUTRON_OVS_PLUGIN_AND_AGENT_VXLAN", {"GROUP_NAME": "NEUTRON_OVS_PLUGIN_AND_AGENT_VXLAN",
"DESCRIPTION": "Neutron OVS agent config for VXLAN", "DESCRIPTION": "Neutron OVS agent config for VXLAN",
"PRE_CONDITION": use_openvswitch_vxlan, "PRE_CONDITION": use_openvswitch_vxlan,
@ -550,18 +555,9 @@ def initConfig(controllerObject):
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
] ]
for group in conf_groups: for group in conf_groups:
paramList = conf_params[group["GROUP_NAME"]] params = conf_params[group["GROUP_NAME"]]
controller.addGroup(group, paramList) controller.addGroup(group, params)
def get_if_driver(config):
agent = config['CONFIG_NEUTRON_L2_AGENT']
if agent == "openvswitch":
return 'neutron.agent.linux.interface.OVSInterfaceDriver'
elif agent == 'linuxbridge':
return 'neutron.agent.linux.interface.BridgeInterfaceDriver'
def initSequences(controller): def initSequences(controller):
@ -595,16 +591,13 @@ def initSequences(controller):
config['CONFIG_NEUTRON_L2_DBNAME'] = plugin_db config['CONFIG_NEUTRON_L2_DBNAME'] = plugin_db
config['CONFIG_NEUTRON_CORE_PLUGIN'] = plugin_path config['CONFIG_NEUTRON_CORE_PLUGIN'] = plugin_path
global api_hosts, l3_hosts, dhcp_hosts, lbaas_hosts, compute_hosts, meta_hosts, q_hosts global api_hosts, network_hosts, compute_hosts, q_hosts
api_hosts = split_hosts(config['CONFIG_NEUTRON_SERVER_HOST']) api_hosts = split_hosts(config['CONFIG_CONTROLLER_HOST'])
l3_hosts = split_hosts(config['CONFIG_NEUTRON_L3_HOSTS']) network_hosts = split_hosts(config['CONFIG_NETWORK_HOSTS'])
dhcp_hosts = split_hosts(config['CONFIG_NEUTRON_DHCP_HOSTS'])
lbaas_hosts = split_hosts(config['CONFIG_NEUTRON_LBAAS_HOSTS'])
meta_hosts = split_hosts(config['CONFIG_NEUTRON_METADATA_HOSTS'])
compute_hosts = set() compute_hosts = set()
if config['CONFIG_NOVA_INSTALL'] == 'y': if config['CONFIG_NOVA_INSTALL'] == 'y':
compute_hosts = split_hosts(config['CONFIG_NOVA_COMPUTE_HOSTS']) compute_hosts = split_hosts(config['CONFIG_COMPUTE_HOSTS'])
q_hosts = api_hosts | l3_hosts | dhcp_hosts | lbaas_hosts | compute_hosts | meta_hosts q_hosts = api_hosts | network_hosts | compute_hosts
neutron_steps = [ neutron_steps = [
{'title': 'Adding Neutron API manifest entries', {'title': 'Adding Neutron API manifest entries',
@ -626,11 +619,45 @@ def initSequences(controller):
neutron_steps) neutron_steps)
def create_manifests(config): #------------------------- helper functions -------------------------
def get_if_driver(config):
agent = config['CONFIG_NEUTRON_L2_AGENT']
if agent == "openvswitch":
return 'neutron.agent.linux.interface.OVSInterfaceDriver'
elif agent == 'linuxbridge':
return 'neutron.agent.linux.interface.BridgeInterfaceDriver'
def find_mapping(haystack, needle):
return needle in [x.split(':')[1].strip() for x in get_values(haystack)]
def get_values(val):
return [x.strip() for x in val.split(',')] if val else []
def get_agent_type(config):
# The only real use case I can think of for multiples right now is to list
# "vlan,gre" or "vlan,vxlan" so that VLANs are used if available,
# but tunnels are used if not.
tenant_types = config.get('CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES',
"['local']").strip('[]')
tenant_types = [i.strip('"\'') for i in tenant_types.split(',')]
for i in ['gre', 'vxlan', 'vlan']:
if i in tenant_types:
return i
return tenant_types[0]
#-------------------------- step functions --------------------------
def create_manifests(config, messages):
global q_hosts global q_hosts
service_plugins = [] service_plugins = []
if config['CONFIG_NEUTRON_LBAAS_HOSTS']: if config['CONFIG_LBAAS_INSTALL'] == 'y':
service_plugins.append( service_plugins.append(
'neutron.services.loadbalancer.plugin.LoadBalancerPlugin' 'neutron.services.loadbalancer.plugin.LoadBalancerPlugin'
) )
@ -639,7 +666,6 @@ def create_manifests(config):
service_plugins.append( service_plugins.append(
'neutron.services.l3_router.l3_router_plugin.L3RouterPlugin' 'neutron.services.l3_router.l3_router_plugin.L3RouterPlugin'
) )
config['SERVICE_PLUGINS'] = (str(service_plugins) if service_plugins config['SERVICE_PLUGINS'] = (str(service_plugins) if service_plugins
else 'undef') else 'undef')
@ -651,15 +677,6 @@ def create_manifests(config):
elif config['CONFIG_NEUTRON_L2_PLUGIN'] == 'ml2': elif config['CONFIG_NEUTRON_L2_PLUGIN'] == 'ml2':
plugin_manifest = 'neutron_ml2_plugin.pp' plugin_manifest = 'neutron_ml2_plugin.pp'
# host to which allow neutron server
allowed_hosts = set(q_hosts)
if config['CONFIG_CLIENT_INSTALL'] == 'y':
allowed_hosts.add(config['CONFIG_OSCLIENT_HOST'])
if config['CONFIG_HORIZON_INSTALL'] == 'y':
allowed_hosts.add(config['CONFIG_HORIZON_HOST'])
if config['CONFIG_NOVA_INSTALL'] == 'y':
allowed_hosts.add(config['CONFIG_NOVA_API_HOST'])
config['FIREWALL_SERVICE_NAME'] = "neutron server" config['FIREWALL_SERVICE_NAME'] = "neutron server"
config['FIREWALL_PORTS'] = "'9696'" config['FIREWALL_PORTS'] = "'9696'"
config['FIREWALL_CHAIN'] = "INPUT" config['FIREWALL_CHAIN'] = "INPUT"
@ -676,9 +693,10 @@ def create_manifests(config):
manifest_data += getManifestTemplate("neutron_notifications.pp") manifest_data += getManifestTemplate("neutron_notifications.pp")
# Firewall Rules # Firewall Rules
for f_host in allowed_hosts: for f_host in q_hosts:
config['FIREWALL_ALLOWED'] = "'%s'" % f_host config['FIREWALL_ALLOWED'] = "'%s'" % f_host
config['FIREWALL_SERVICE_ID'] = "neutron_server_%s_%s" % (host, f_host) config['FIREWALL_SERVICE_ID'] = ("neutron_server_%s_%s"
% (host, f_host))
manifest_data += getManifestTemplate("firewall.pp") manifest_data += getManifestTemplate("firewall.pp")
appendManifestFile(manifest_file, manifest_data, 'neutron') appendManifestFile(manifest_file, manifest_data, 'neutron')
@ -689,44 +707,39 @@ def create_manifests(config):
appendManifestFile(manifest_file, manifest_data, 'neutron') appendManifestFile(manifest_file, manifest_data, 'neutron')
def create_keystone_manifest(config): def create_keystone_manifest(config, messages):
manifestfile = "%s_keystone.pp" % config['CONFIG_KEYSTONE_HOST'] manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone_neutron.pp") manifestdata = getManifestTemplate("keystone_neutron.pp")
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
def find_mapping(haystack, needle): def create_l3_manifests(config, messages):
return needle in [x.split(':')[1].strip() for x in get_values(haystack)] global network_hosts
def create_l3_manifests(config):
global l3_hosts
plugin = config['CONFIG_NEUTRON_L2_PLUGIN'] plugin = config['CONFIG_NEUTRON_L2_PLUGIN']
if config['CONFIG_NEUTRON_L3_EXT_BRIDGE'] == 'provider': if config['CONFIG_NEUTRON_L3_EXT_BRIDGE'] == 'provider':
config['CONFIG_NEUTRON_L3_EXT_BRIDGE'] = '' config['CONFIG_NEUTRON_L3_EXT_BRIDGE'] = ''
for host in l3_hosts: for host in network_hosts:
config['CONFIG_NEUTRON_L3_HOST'] = host config['CONFIG_NEUTRON_L3_HOST'] = host
config['CONFIG_NEUTRON_L3_INTERFACE_DRIVER'] = get_if_driver(config) config['CONFIG_NEUTRON_L3_INTERFACE_DRIVER'] = get_if_driver(config)
manifestdata = getManifestTemplate("neutron_l3.pp") manifestdata = getManifestTemplate("neutron_l3.pp")
manifestfile = "%s_neutron.pp" % (host,) manifestfile = "%s_neutron.pp" % (host,)
appendManifestFile(manifestfile, manifestdata + '\n') appendManifestFile(manifestfile, manifestdata + '\n')
if (config['CONFIG_NEUTRON_L2_PLUGIN'] == 'openvswitch' and ext_bridge = config['CONFIG_NEUTRON_L3_EXT_BRIDGE']
config['CONFIG_NEUTRON_L3_EXT_BRIDGE'] and mapping = find_mapping(config['CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS'],
not find_mapping(config['CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS'], ext_bridge) if ext_bridge else None
config['CONFIG_NEUTRON_L3_EXT_BRIDGE'])): if config['CONFIG_NEUTRON_L2_PLUGIN'] == 'openvswitch' and not mapping:
config['CONFIG_NEUTRON_OVS_BRIDGE'] = config['CONFIG_NEUTRON_L3_EXT_BRIDGE'] config['CONFIG_NEUTRON_OVS_BRIDGE'] = ext_bridge
manifestdata = getManifestTemplate('neutron_ovs_bridge.pp') manifestdata = getManifestTemplate('neutron_ovs_bridge.pp')
appendManifestFile(manifestfile, manifestdata + '\n') appendManifestFile(manifestfile, manifestdata + '\n')
def create_dhcp_manifests(config): def create_dhcp_manifests(config, messages):
global dhcp_hosts global network_hosts
plugin = config['CONFIG_NEUTRON_L2_PLUGIN'] plugin = config['CONFIG_NEUTRON_L2_PLUGIN']
for host in network_hosts:
for host in dhcp_hosts:
config["CONFIG_NEUTRON_DHCP_HOST"] = host config["CONFIG_NEUTRON_DHCP_HOST"] = host
config['CONFIG_NEUTRON_DHCP_INTERFACE_DRIVER'] = get_if_driver(config) config['CONFIG_NEUTRON_DHCP_INTERFACE_DRIVER'] = get_if_driver(config)
manifest_data = getManifestTemplate("neutron_dhcp.pp") manifest_data = getManifestTemplate("neutron_dhcp.pp")
@ -736,12 +749,14 @@ def create_dhcp_manifests(config):
for f_host in q_hosts: for f_host in q_hosts:
config['FIREWALL_ALLOWED'] = "'%s'" % f_host config['FIREWALL_ALLOWED'] = "'%s'" % f_host
config['FIREWALL_SERVICE_NAME'] = "neutron dhcp in" config['FIREWALL_SERVICE_NAME'] = "neutron dhcp in"
config['FIREWALL_SERVICE_ID'] = "neutron_dhcp_in_%s_%s" % (host, f_host) config['FIREWALL_SERVICE_ID'] = ("neutron_dhcp_in_%s_%s"
% (host, f_host))
config['FIREWALL_PORTS'] = "'67'" config['FIREWALL_PORTS'] = "'67'"
config['FIREWALL_CHAIN'] = "INPUT" config['FIREWALL_CHAIN'] = "INPUT"
manifest_data += getManifestTemplate("firewall.pp") manifest_data += getManifestTemplate("firewall.pp")
config['FIREWALL_SERVICE_NAME'] = "neutron dhcp out" config['FIREWALL_SERVICE_NAME'] = "neutron dhcp out"
config['FIREWALL_SERVICE_ID'] = "neutron_dhcp_out_%s_%s" % (host, f_host) config['FIREWALL_SERVICE_ID'] = ("neutron_dhcp_out_%s_%s"
% (host, f_host))
config['FIREWALL_PORTS'] = "'68'" config['FIREWALL_PORTS'] = "'68'"
config['FIREWALL_CHAIN'] = "OUTPUT" config['FIREWALL_CHAIN'] = "OUTPUT"
manifest_data += getManifestTemplate("firewall.pp") manifest_data += getManifestTemplate("firewall.pp")
@ -749,34 +764,21 @@ def create_dhcp_manifests(config):
appendManifestFile(manifest_file, manifest_data, 'neutron') appendManifestFile(manifest_file, manifest_data, 'neutron')
def create_lbaas_manifests(config, messages):
global api_hosts
def create_lbaas_manifests(config): if not config['CONFIG_LBAAS_INSTALL'] == 'y':
global lbaas_hosts return
for host in lbaas_hosts:
controller.CONF['CONFIG_NEUTRON_LBAAS_INTERFACE_DRIVER'] = get_if_driver(config) for host in api_hosts:
config['CONFIG_NEUTRON_LBAAS_INTERFACE_DRIVER'] = get_if_driver(config)
manifestdata = getManifestTemplate("neutron_lbaas.pp") manifestdata = getManifestTemplate("neutron_lbaas.pp")
manifestfile = "%s_neutron.pp" % (host,) manifestfile = "%s_neutron.pp" % (host,)
appendManifestFile(manifestfile, manifestdata + "\n") appendManifestFile(manifestfile, manifestdata + "\n")
def get_values(val): def create_l2_agent_manifests(config, messages):
return [x.strip() for x in val.split(',')] if val else [] global q_hosts
def get_agent_type(config):
# The only real use case I can think of for multiples right now is to list
# "vlan,gre" or "vlan,vxlan" so that VLANs are used if available,
# but tunnels are used if not.
tenant_types = config.get('CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES',
"['local']").strip('[]')
tenant_types = [i.strip('"\'') for i in tenant_types.split(',')]
for i in ['gre', 'vxlan', 'vlan']:
if i in tenant_types:
return i
return tenant_types[0]
def create_l2_agent_manifests(config):
global api_hosts, compute_hosts, dhcp_host, l3_hosts
plugin = config['CONFIG_NEUTRON_L2_PLUGIN'] plugin = config['CONFIG_NEUTRON_L2_PLUGIN']
agent = config["CONFIG_NEUTRON_L2_AGENT"] agent = config["CONFIG_NEUTRON_L2_AGENT"]
@ -798,9 +800,9 @@ def create_l2_agent_manifests(config):
# The CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS parameter contains a # The CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS parameter contains a
# comma-separated list of bridge mappings. Since the puppet module # comma-separated list of bridge mappings. Since the puppet module
# expects this parameter to be an array, this parameter must be properly # expects this parameter to be an array, this parameter must be
# formatted by packstack, then consumed by the puppet module. # properly formatted by packstack, then consumed by the puppet module.
# For example, the input string 'A, B, C' should formatted as '['A','B','C']'. # For example, the input string 'A, B' should formatted as '['A','B']'.
config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"] = str(bm_arr) config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"] = str(bm_arr)
elif agent == "linuxbridge": elif agent == "linuxbridge":
host_var = 'CONFIG_NEUTRON_LB_HOST' host_var = 'CONFIG_NEUTRON_LB_HOST'
@ -810,14 +812,16 @@ def create_l2_agent_manifests(config):
# Install l2 agents on every compute host in addition to any hosts listed # Install l2 agents on every compute host in addition to any hosts listed
# specifically for the l2 agent # specifically for the l2 agent
for host in api_hosts | compute_hosts | dhcp_hosts | l3_hosts: for host in q_hosts:
config[host_var] = host config[host_var] = host
manifestfile = "%s_neutron.pp" % (host,) manifestfile = "%s_neutron.pp" % (host,)
manifestdata = getManifestTemplate(template_name) manifestdata = getManifestTemplate(template_name)
appendManifestFile(manifestfile, manifestdata + "\n") appendManifestFile(manifestfile, manifestdata + "\n")
if agent == "openvswitch" and ovs_type == 'vlan': if agent == "openvswitch" and ovs_type == 'vlan':
for if_map in iface_arr: for if_map in iface_arr:
config['CONFIG_NEUTRON_OVS_BRIDGE'], config['CONFIG_NEUTRON_OVS_IFACE'] = if_map.split(':') bridge_key = 'CONFIG_NEUTRON_OVS_BRIDGE'
iface_key = 'CONFIG_NEUTRON_OVS_IFACE'
config[bridge_key], config[iface_key] = if_map.split(':')
manifestdata = getManifestTemplate("neutron_ovs_port.pp") manifestdata = getManifestTemplate("neutron_ovs_port.pp")
appendManifestFile(manifestfile, manifestdata + "\n") appendManifestFile(manifestfile, manifestdata + "\n")
# Additional configurations required for compute hosts # Additional configurations required for compute hosts
@ -826,12 +830,12 @@ def create_l2_agent_manifests(config):
appendManifestFile(manifestfile, manifestdata + '\n') appendManifestFile(manifestfile, manifestdata + '\n')
def create_metadata_manifests(config): def create_metadata_manifests(config, messages):
global meta_hosts global network_hosts
if config.get('CONFIG_NOVA_INSTALL') == 'n': if config.get('CONFIG_NOVA_INSTALL') == 'n':
return return
for host in meta_hosts: for host in network_hosts:
controller.CONF['CONFIG_NEUTRON_METADATA_HOST'] = host config['CONFIG_NEUTRON_METADATA_HOST'] = host
manifestdata = getManifestTemplate('neutron_metadata.pp') manifestdata = getManifestTemplate('neutron_metadata.pp')
manifestfile = "%s_neutron.pp" % (host,) manifestfile = "%s_neutron.pp" % (host,)
appendManifestFile(manifestfile, manifestdata + "\n") appendManifestFile(manifestfile, manifestdata + "\n")

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
Installs and configures nova Installs and configures nova
""" """
@ -12,19 +14,17 @@ from packstack.installer import basedefs, processors, utils, validators
from packstack.installer.exceptions import ScriptRuntimeError from packstack.installer.exceptions import ScriptRuntimeError
from packstack.modules.shortcuts import get_mq 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": if platform.linux_distribution()[0] == "Fedora":
primary_netif = "em1" primary_netif = "em1"
secondary_netif = "em2" secondary_netif = "em2"
@ -34,66 +34,6 @@ def initConfig(controllerObject):
nova_params = { nova_params = {
"NOVA": [ "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", {"CMD_OPTION": "nova-db-passwd",
"USAGE": "The password to use for the Nova to access DB", "USAGE": "The password to use for the Nova to access DB",
"PROMPT": "Enter the password for the Nova DB access", "PROMPT": "Enter the password for the Nova DB access",
@ -106,8 +46,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "nova-ks-passwd", {"CMD_OPTION": "nova-ks-passwd",
"USAGE" : "The password to use for the Nova to authenticate with Keystone", "USAGE": ("The password to use for the Nova to authenticate "
"with Keystone"),
"PROMPT": "Enter the password for the Nova Keystone access", "PROMPT": "Enter the password for the Nova Keystone access",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@ -118,23 +60,12 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "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", {"CMD_OPTION": "novasched-cpu-allocation-ratio",
"USAGE" : "The overcommitment ratio for virtual to physical CPUs. " "USAGE": ("The overcommitment ratio for virtual to physical CPUs."
"Set to 1.0 to disable CPU overcommitment", " Set to 1.0 to disable CPU overcommitment"),
"PROMPT" : "Enter the CPU overcommitment ratio. " "PROMPT": "Enter the CPU overcommitment ratio. Set to 1.0 to "
"Set to 1.0 to disable CPU overcommitment", "disable CPU overcommitment",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_float], "VALIDATORS": [validators.validate_float],
"DEFAULT_VALUE": 16.0, "DEFAULT_VALUE": 16.0,
@ -144,11 +75,12 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "novasched-ram-allocation-ratio", {"CMD_OPTION": "novasched-ram-allocation-ratio",
"USAGE" : "The overcommitment ratio for virtual to physical RAM. " "USAGE": ("The overcommitment ratio for virtual to physical RAM. "
"Set to 1.0 to disable RAM overcommitment", "Set to 1.0 to disable RAM overcommitment"),
"PROMPT" : "Enter the RAM overcommitment ratio. " "PROMPT": ("Enter the RAM overcommitment ratio. Set to 1.0 to "
"Set to 1.0 to disable RAM overcommitment", "disable RAM overcommitment"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_float], "VALIDATORS": [validators.validate_float],
"DEFAULT_VALUE": 1.5, "DEFAULT_VALUE": 1.5,
@ -159,10 +91,13 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
], ],
"NOVA_NETWORK": [ "NOVA_NETWORK": [
{"CMD_OPTION": "novacompute-privif", {"CMD_OPTION": "novacompute-privif",
"USAGE" : "Private interface for Flat DHCP on the Nova compute servers", "USAGE": ("Private interface for Flat DHCP on the Nova compute "
"PROMPT" : "Enter the Private interface for Flat DHCP on the Nova compute servers", "servers"),
"PROMPT": ("Enter the Private interface for Flat DHCP on the Nova"
" compute servers"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": secondary_netif, "DEFAULT_VALUE": secondary_netif,
@ -172,18 +107,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": 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", {"CMD_OPTION": "novanetwork-manager",
"USAGE": "Nova network manager", "USAGE": "Nova network manager",
"PROMPT": "Enter the Nova network manager", "PROMPT": "Enter the Nova network manager",
@ -196,6 +120,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "novanetwork-pubif", {"CMD_OPTION": "novanetwork-pubif",
"USAGE": "Public interface on the Nova network server", "USAGE": "Public interface on the Nova network server",
"PROMPT": "Enter the Public interface on the Nova network server", "PROMPT": "Enter the Public interface on the Nova network server",
@ -208,9 +133,12 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "novanetwork-privif", {"CMD_OPTION": "novanetwork-privif",
"USAGE" : "Private interface for network manager on the Nova network server", "USAGE": ("Private interface for network manager on the Nova "
"PROMPT" : "Enter the Private interface for network manager on the Nova network server", "network server"),
"PROMPT": ("Enter the Private interface for network manager on "
"the Nova network server"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": secondary_netif, "DEFAULT_VALUE": secondary_netif,
@ -220,6 +148,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "novanetwork-fixed-range", {"CMD_OPTION": "novanetwork-fixed-range",
"USAGE": "IP Range for network manager", "USAGE": "IP Range for network manager",
"PROMPT": "Enter the IP Range for network manager", "PROMPT": "Enter the IP Range for network manager",
@ -233,6 +162,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "novanetwork-floating-range", {"CMD_OPTION": "novanetwork-floating-range",
"USAGE": "IP Range for Floating IP's", "USAGE": "IP Range for Floating IP's",
"PROMPT": "Enter the IP Range for Floating IP's", "PROMPT": "Enter the IP Range for Floating IP's",
@ -246,8 +176,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "novanetwork-default-floating-pool", {"CMD_OPTION": "novanetwork-default-floating-pool",
"USAGE" : "Name of the default floating pool to which the specified floating ranges are added to", "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?", "PROMPT": "What should the default floating pool be called?",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@ -258,9 +190,11 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "novanetwork-auto-assign-floating-ip", {"CMD_OPTION": "novanetwork-auto-assign-floating-ip",
"USAGE": "Automatically assign a floating IP to new instances", "USAGE": "Automatically assign a floating IP to new instances",
"PROMPT" : "Should new instances automatically have a floating IP assigned?", "PROMPT": ("Should new instances automatically have a floating "
"IP assigned?"),
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "n", "DEFAULT_VALUE": "n",
@ -271,6 +205,7 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
], ],
"NOVA_NETWORK_VLAN": [ "NOVA_NETWORK_VLAN": [
{"CMD_OPTION": "novanetwork-vlan-start", {"CMD_OPTION": "novanetwork-vlan-start",
"USAGE": "First VLAN for private networks", "USAGE": "First VLAN for private networks",
@ -284,6 +219,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "novanetwork-num-networks", {"CMD_OPTION": "novanetwork-num-networks",
"USAGE": "Number of networks to support", "USAGE": "Number of networks to support",
"PROMPT": "How many networks should be supported", "PROMPT": "How many networks should be supported",
@ -296,6 +232,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "novanetwork-network-size", {"CMD_OPTION": "novanetwork-network-size",
"USAGE": "Number of addresses in each private subnet", "USAGE": "Number of addresses in each private subnet",
"PROMPT": "How many addresses should be in each private subnet", "PROMPT": "How many addresses should be in each private subnet",
@ -312,14 +249,14 @@ def initConfig(controllerObject):
} }
def use_nova_network(config): def use_nova_network(config):
return config['CONFIG_NOVA_INSTALL'] == 'y' and \ return (config['CONFIG_NOVA_INSTALL'] == 'y' and
config['CONFIG_NEUTRON_INSTALL'] != 'y' config['CONFIG_NEUTRON_INSTALL'] != 'y')
def use_nova_network_vlan(config): def use_nova_network_vlan(config):
manager = 'nova.network.manager.VlanManager' manager = 'nova.network.manager.VlanManager'
return config['CONFIG_NOVA_INSTALL'] == 'y' and \ return (config['CONFIG_NOVA_INSTALL'] == 'y' and
config['CONFIG_NEUTRON_INSTALL'] != 'y' and \ config['CONFIG_NEUTRON_INSTALL'] != 'y' and
config['CONFIG_NOVA_NETWORK_MANAGER'] == manager config['CONFIG_NOVA_NETWORK_MANAGER'] == manager)
nova_groups = [ nova_groups = [
{"GROUP_NAME": "NOVA", {"GROUP_NAME": "NOVA",
@ -328,12 +265,14 @@ def initConfig(controllerObject):
"PRE_CONDITION_MATCH": "y", "PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NOVA_NETWORK", {"GROUP_NAME": "NOVA_NETWORK",
"DESCRIPTION": "Nova Network Options", "DESCRIPTION": "Nova Network Options",
"PRE_CONDITION": use_nova_network, "PRE_CONDITION": use_nova_network,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
{"GROUP_NAME": "NOVA_NETWORK_VLAN", {"GROUP_NAME": "NOVA_NETWORK_VLAN",
"DESCRIPTION": "Nova Network VLAN Options", "DESCRIPTION": "Nova Network VLAN Options",
"PRE_CONDITION": use_nova_network_vlan, "PRE_CONDITION": use_nova_network_vlan,
@ -341,79 +280,53 @@ def initConfig(controllerObject):
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
] ]
for group in nova_groups: for group in nova_groups:
paramList = nova_params[group["GROUP_NAME"]] params = nova_params[group["GROUP_NAME"]]
controller.addGroup(group, paramList) controller.addGroup(group, params)
def initSequences(controller): def initSequences(controller):
if controller.CONF['CONFIG_NOVA_INSTALL'] != 'y': if controller.CONF['CONFIG_NOVA_INSTALL'] != 'y':
return return
novaapisteps = [ novaapisteps = [
{'title': 'Adding Nova API manifest entries', 'functions':[createapimanifest]}, {'title': 'Adding Nova API manifest entries',
{'title': 'Adding Nova Keystone manifest entries', 'functions':[createkeystonemanifest]}, 'functions': [create_api_manifest]},
{'title': 'Adding Nova Cert manifest entries', 'functions':[createcertmanifest]}, {'title': 'Adding Nova Keystone manifest entries',
{'title': 'Adding Nova Conductor manifest entries', 'functions':[createconductormanifest]}, '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', {'title': 'Creating ssh keys for Nova migration',
'functions': [create_ssh_keys]}, 'functions': [create_ssh_keys]},
{'title': 'Gathering ssh host keys for Nova migration', {'title': 'Gathering ssh host keys for Nova migration',
'functions': [gather_host_keys]}, 'functions': [gather_host_keys]},
{'title': 'Adding Nova Compute manifest entries', 'functions':[createcomputemanifest]}, {'title': 'Adding Nova Compute manifest entries',
{'title': 'Adding Nova Scheduler manifest entries', 'functions':[createschedmanifest]}, 'functions': [create_compute_manifest]},
{'title': 'Adding Nova VNC Proxy manifest entries', 'functions':[createvncproxymanifest]}, {'title': 'Adding Nova Scheduler manifest entries',
{'title': 'Adding Nova Common manifest entries', 'functions':[createcommonmanifest]}, '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': 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: else:
novaapisteps.append({'title': 'Adding Nova Network manifest entries', 'functions':[createnetworkmanifest]}) novaapisteps.append(
{'title': 'Adding Nova Network manifest entries',
controller.addSequence("Installing OpenStack Nova API", [], [], novaapisteps) 'functions': [create_network_manifest]}
)
controller.addSequence("Installing OpenStack Nova API", [], [],
novaapisteps)
def createapimanifest(config): #------------------------- helper functions -------------------------
# 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)
def check_ifcfg(host, device): def check_ifcfg(host, device):
""" """
@ -447,7 +360,9 @@ def bring_up_ifcfg(host, device):
raise ScriptRuntimeError(msg) 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') migration_key = os.path.join(basedefs.VAR_DIR, 'nova_migration_key')
# Generate key # Generate key
local = utils.ScriptRunner() local = utils.ScriptRunner()
@ -463,7 +378,8 @@ def create_ssh_keys(config):
config['NOVA_MIGRATION_KEY_PUBLIC'] = public.split()[1] config['NOVA_MIGRATION_KEY_PUBLIC'] = public.split()[1]
config['NOVA_MIGRATION_KEY_SECRET'] = secret config['NOVA_MIGRATION_KEY_SECRET'] = secret
def gather_host_keys(config):
def gather_host_keys(config, messages):
global compute_hosts global compute_hosts
for host in compute_hosts: for host in compute_hosts:
@ -472,7 +388,50 @@ def gather_host_keys(config):
retcode, hostkey = local.execute() retcode, hostkey = local.execute()
config['HOST_KEYS_%s' % host] = hostkey 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 global compute_hosts, network_hosts
ssh_hostkeys = '' ssh_hostkeys = ''
@ -489,8 +448,9 @@ def createcomputemanifest(config):
_, host_key_type, host_key_data = hostkey.split() _, host_key_type, host_key_data = hostkey.split()
config['SSH_HOST_NAME'] = host_name config['SSH_HOST_NAME'] = host_name
config['SSH_HOST_ALIASES'] = ','.join('"%s"' % addr config['SSH_HOST_ALIASES'] = ','.join(
for addr in host_aliases + host_addrs) '"%s"' % addr for addr in host_aliases + host_addrs
)
config['SSH_HOST_KEY'] = host_key_data config['SSH_HOST_KEY'] = host_key_data
config['SSH_HOST_KEY_TYPE'] = host_key_type config['SSH_HOST_KEY_TYPE'] = host_key_type
ssh_hostkeys += getManifestTemplate("sshkey.pp") ssh_hostkeys += getManifestTemplate("sshkey.pp")
@ -515,23 +475,23 @@ def createcomputemanifest(config):
nova_config_options = NovaConfig() nova_config_options = NovaConfig()
if config['CONFIG_NEUTRON_INSTALL'] != 'y': if config['CONFIG_NEUTRON_INSTALL'] != 'y':
if host not in network_hosts: if host not in network_hosts:
nova_config_options.addOption("DEFAULT/flat_interface", nova_config_options.addOption(
config['CONFIG_NOVA_COMPUTE_PRIVIF']) "DEFAULT/flat_interface",
config['CONFIG_NOVA_COMPUTE_PRIVIF']
)
check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF'])
try: try:
bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF'])
except ScriptRuntimeError as ex: except ScriptRuntimeError as ex:
# just warn user to do it by himself # just warn user to do it by himself
controller.MESSAGES.append(str(ex)) messages.append(str(ex))
if config['CONFIG_CEILOMETER_INSTALL'] == 'y': 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") manifestdata += getManifestTemplate("nova_ceilometer.pp")
# According to the docs the only element that connects directly to nova compute config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST']
# 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_SERVICE_NAME'] = "nova compute" config['FIREWALL_SERVICE_NAME'] = "nova compute"
config['FIREWALL_SERVICE_ID'] = "nova_compute" config['FIREWALL_SERVICE_ID'] = "nova_compute"
config['FIREWALL_PORTS'] = "'5900-5999'" config['FIREWALL_PORTS'] = "'5900-5999'"
@ -543,7 +503,7 @@ def createcomputemanifest(config):
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
def createnetworkmanifest(config): def create_network_manifest(config, messages):
global compute_hosts, network_hosts global compute_hosts, network_hosts
if config['CONFIG_NEUTRON_INSTALL'] == "y": if config['CONFIG_NEUTRON_INSTALL'] == "y":
return return
@ -554,7 +514,7 @@ def createnetworkmanifest(config):
('CONFIG_NOVA_NETWORK_NUMBER', 1)]: ('CONFIG_NOVA_NETWORK_NUMBER', 1)]:
config[key] = config.get(key, value) config[key] = config.get(key, value)
api_host = config['CONFIG_NOVA_API_HOST'] api_host = config['CONFIG_CONTROLLER_HOST']
multihost = len(network_hosts) > 1 multihost = len(network_hosts) > 1
config['CONFIG_NOVA_NETWORK_MULTIHOST'] = multihost and 'true' or 'false' config['CONFIG_NOVA_NETWORK_MULTIHOST'] = multihost and 'true' or 'false'
for host in network_hosts: for host in network_hosts:
@ -564,7 +524,7 @@ def createnetworkmanifest(config):
bring_up_ifcfg(host, config[i]) bring_up_ifcfg(host, config[i])
except ScriptRuntimeError as ex: except ScriptRuntimeError as ex:
# just warn user to do it by himself # just warn user to do it by himself
controller.MESSAGES.append(str(ex)) messages.append(str(ex))
key = 'CONFIG_NOVA_NETWORK_AUTOASSIGNFLOATINGIP' key = 'CONFIG_NOVA_NETWORK_AUTOASSIGNFLOATINGIP'
config[key] = config[key] == "y" config[key] = config[key] == "y"
@ -583,29 +543,24 @@ def createnetworkmanifest(config):
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
def createschedmanifest(config): def create_sched_manifest(config, messages):
manifestfile = "%s_nova.pp"%controller.CONF['CONFIG_NOVA_SCHED_HOST'] manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_sched.pp") manifestdata = getManifestTemplate("nova_sched.pp")
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
def createvncproxymanifest(config): def create_vncproxy_manifest(config, messages):
manifestfile = "%s_nova.pp"%controller.CONF['CONFIG_NOVA_VNCPROXY_HOST'] manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("nova_vncproxy.pp") manifestdata = getManifestTemplate("nova_vncproxy.pp")
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
def createcommonmanifest(config): def create_common_manifest(config, messages):
global compute_hosts, network_hosts global compute_hosts, network_hosts
network_type = (config['CONFIG_NEUTRON_INSTALL'] == "y" and network_type = (config['CONFIG_NEUTRON_INSTALL'] == "y" and
'neutron' or 'nova') 'neutron' or 'nova')
network_multi = len(network_hosts) > 1 network_multi = len(network_hosts) > 1
dirty = [config.get('CONFIG_NOVA_CONDUCTOR_HOST'), dbacces_hosts = set([config.get('CONFIG_CONTROLLER_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 |= network_hosts dbacces_hosts |= network_hosts
for manifestfile, marker in manifestfiles.getFiles(): for manifestfile, marker in manifestfiles.getFiles():
@ -628,7 +583,7 @@ def createcommonmanifest(config):
host in compute_hosts): host in compute_hosts):
metadata = host metadata = host
else: else:
metadata = config['CONFIG_NOVA_API_HOST'] metadata = config['CONFIG_CONTROLLER_HOST']
config['CONFIG_NOVA_METADATA_HOST'] = metadata config['CONFIG_NOVA_METADATA_HOST'] = metadata
data = getManifestTemplate(get_mq(config, "nova_common")) data = getManifestTemplate(get_mq(config, "nova_common"))
@ -636,11 +591,12 @@ def createcommonmanifest(config):
appendManifestFile(os.path.split(manifestfile)[1], data) appendManifestFile(os.path.split(manifestfile)[1], data)
def createneutronmanifest(config): def create_neutron_manifest(config, messages):
if controller.CONF['CONFIG_NEUTRON_INSTALL'] != "y": if config['CONFIG_NEUTRON_INSTALL'] != "y":
return 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(): for manifestfile, marker in manifestfiles.getFiles():
if manifestfile.endswith("_nova.pp"): if manifestfile.endswith("_nova.pp"):

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
Installs and configures an OpenStack Client 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 basedefs, output_messages
from packstack.installer import utils 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 #------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-CLIENT"
PLUGIN_NAME = "OS-Client"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controllerObject): def initConfig(controller):
global controller group = {"GROUP_NAME": "NOVACLIENT",
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", "DESCRIPTION": "NOVACLIENT Config parameters",
"PRE_CONDITION": "CONFIG_CLIENT_INSTALL", "PRE_CONDITION": "CONFIG_CLIENT_INSTALL",
"PRE_CONDITION_MATCH": "y", "PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, [])
controller.addGroup(groupDict, paramsList)
def initSequences(controller): def initSequences(controller):
@ -54,13 +36,17 @@ def initSequences(controller):
return return
osclientsteps = [ 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): #-------------------------- step functions --------------------------
client_host = config['CONFIG_OSCLIENT_HOST'].strip()
def create_manifest(config, messages):
client_host = config['CONFIG_CONTROLLER_HOST'].strip()
manifestfile = "%s_osclient.pp" % client_host manifestfile = "%s_osclient.pp" % client_host
server = utils.ScriptRunner(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" 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.") " %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: if no_root_allinone:
msg = ("Copy of keystonerc_admin file has been created for non-root " msg = ("Copy of keystonerc_admin file has been created for non-root "
"user in %s.") "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 Installs and configures an OpenStack Client
""" """
import logging import logging
from packstack.installer import utils
from packstack.modules.common import filtered_hosts from packstack.modules.common import filtered_hosts
from packstack.modules.ospluginutils import (getManifestTemplate, from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile) appendManifestFile)
# Controller object will be initialized from main flow
controller = None
# Plugin name #------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-POSTSCRIPT"
logging.debug("plugin %s loaded", __name__) PLUGIN_NAME = "Postscript"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
def initConfig(controllerObject):
global controller
controller = controllerObject
logging.debug("Executing post run scripts")
groupDict = {"GROUP_NAME" : "POSTSCRIPT", def initConfig(controller):
group = {"GROUP_NAME": "POSTSCRIPT",
"DESCRIPTION": "POSTSCRIPT Config parameters", "DESCRIPTION": "POSTSCRIPT Config parameters",
"PRE_CONDITION": lambda x: 'yes', "PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes", "PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, [])
controller.addGroup(groupDict, [])
def initSequences(controller): def initSequences(controller):
osclientsteps = [ postscript_steps = [
{'title': 'Adding post install manifest entries', 'functions':[createmanifest]} {'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): for hostname in filtered_hosts(config):
manifestfile = "%s_postscript.pp" % hostname manifestfile = "%s_postscript.pp" % hostname
manifestdata = getManifestTemplate("postscript.pp") manifestdata = getManifestTemplate("postscript.pp")
appendManifestFile(manifestfile, manifestdata, 'postscript') appendManifestFile(manifestfile, manifestdata, 'postscript')
if config.get("CONFIG_PROVISION_ALL_IN_ONE_OVS_BRIDGE") != 'n': 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") manifestdata = getManifestTemplate("persist_ovs_bridge.pp")
appendManifestFile(manifestfile, manifestdata, 'postscript') appendManifestFile(manifestfile, manifestdata, 'postscript')

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
Plugin responsible for setting OpenStack global options Plugin responsible for setting OpenStack global options
""" """
@ -16,34 +18,35 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
appendManifestFile) appendManifestFile)
# Controller object will be initialized from main flow #------------------ oVirt installer initialization ------------------
controller = None
# Plugin name PLUGIN_NAME = "Prescript"
PLUGIN_NAME = "OS-PRESCRIPT" PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controllerObject): def initConfig(controller):
global controller default_ssh_key = os.path.join(os.environ["HOME"], ".ssh/*.pub")
controller = controllerObject default_ssh_key = (glob.glob(default_ssh_key) + [""])[0]
params = [
paramsList = [{"CMD_OPTION" : "ssh-public-key", {"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", "USAGE": ("Path to a Public key to install on servers. If a usable "
"PROMPT" : "Enter the path to your ssh Public key to install on servers", "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": [], "OPTION_LIST": [],
"VALIDATORS" : [validators.validate_file, "VALIDATORS": [validators.validate_file, validators.validate_sshkey],
validators.validate_sshkey],
"PROCESSORS": [processors.process_ssh_key], "PROCESSORS": [processors.process_ssh_key],
"DEFAULT_VALUE" : (glob.glob(os.path.join(os.environ["HOME"], ".ssh/*.pub"))+[""])[0], "DEFAULT_VALUE": default_ssh_key,
"MASK_INPUT": False, "MASK_INPUT": False,
"LOOSE_VALIDATION": False, "LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_SSH_KEY", "CONF_NAME": "CONFIG_SSH_KEY",
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION" : "os-mysql-install",
{"CMD_OPTION": "mysql-install",
"USAGE": "Set to 'y' if you would like Packstack to install MySQL", "USAGE": "Set to 'y' if you would like Packstack to install MySQL",
"PROMPT": "Should Packstack install MySQL DB", "PROMPT": "Should Packstack install MySQL DB",
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
@ -55,8 +58,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-glance-install", {"CMD_OPTION": "os-glance-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Image Service (Glance)", "USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Image Service (Glance)"),
"PROMPT": "Should Packstack install OpenStack Image Service (Glance)", "PROMPT": "Should Packstack install OpenStack Image Service (Glance)",
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
@ -67,9 +72,12 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-cinder-install", {"CMD_OPTION": "os-cinder-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Block Storage (Cinder)", "USAGE": ("Set to 'y' if you would like Packstack to install "
"PROMPT" : "Should Packstack install OpenStack Block Storage (Cinder) service", "OpenStack Block Storage (Cinder)"),
"PROMPT": ("Should Packstack install OpenStack Block Storage "
"(Cinder) service"),
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y", "DEFAULT_VALUE": "y",
@ -79,8 +87,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-nova-install", {"CMD_OPTION": "os-nova-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Compute (Nova)", "USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Compute (Nova)"),
"PROMPT": "Should Packstack install OpenStack Compute (Nova) service", "PROMPT": "Should Packstack install OpenStack Compute (Nova) service",
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
@ -91,9 +101,13 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-neutron-install", {"CMD_OPTION": "os-neutron-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Networking (Neutron)", "USAGE": ("Set to 'y' if you would like Packstack to install "
"PROMPT" : "Should Packstack install OpenStack Networking (Neutron) service", "OpenStack Networking (Neutron). Otherwise Nova Network "
"will be used."),
"PROMPT": ("Should Packstack install OpenStack Networking (Neutron) "
"service"),
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": "y", "DEFAULT_VALUE": "y",
@ -103,8 +117,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-horizon-install", {"CMD_OPTION": "os-horizon-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Dashboard (Horizon)", "USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Dashboard (Horizon)"),
"PROMPT": "Should Packstack install OpenStack Dashboard (Horizon)", "PROMPT": "Should Packstack install OpenStack Dashboard (Horizon)",
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
@ -115,8 +131,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-swift-install", {"CMD_OPTION": "os-swift-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Object Storage (Swift)", "USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Object Storage (Swift)"),
"PROMPT": "Should Packstack install OpenStack Object Storage (Swift)", "PROMPT": "Should Packstack install OpenStack Object Storage (Swift)",
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
@ -127,8 +145,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-ceilometer-install", {"CMD_OPTION": "os-ceilometer-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Metering (Ceilometer)", "USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Metering (Ceilometer)"),
"PROMPT": "Should Packstack install OpenStack Metering (Ceilometer)", "PROMPT": "Should Packstack install OpenStack Metering (Ceilometer)",
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
@ -139,8 +159,10 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-heat-install", {"CMD_OPTION": "os-heat-install",
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Orchestration (Heat)", "USAGE": ("Set to 'y' if you would like Packstack to install "
"OpenStack Orchestration (Heat)"),
"PROMPT": "Should Packstack install OpenStack Orchestration (Heat)", "PROMPT": "Should Packstack install OpenStack Orchestration (Heat)",
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
@ -151,8 +173,11 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-client-install", {"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", "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", "PROMPT": "Should Packstack install OpenStack client tools",
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
@ -163,9 +188,13 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "ntp-servers", {"CMD_OPTION": "ntp-servers",
"USAGE" : "Comma separated list of NTP servers. Leave plain if Packstack should not install ntpd on instances.", "USAGE": ("Comma separated list of NTP servers. Leave plain if "
"PROMPT" : "Enter a comma separated list of NTP server(s). Leave plain if Packstack should not install ntpd on instances.", "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": [], "OPTION_LIST": [],
"DEFAULT_VALUE": '', "DEFAULT_VALUE": '',
"MASK_INPUT": False, "MASK_INPUT": False,
@ -174,9 +203,12 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "nagios-install", {"CMD_OPTION": "nagios-install",
"USAGE" : "Set to 'y' if you would like Packstack to install Nagios to monitor OpenStack hosts", "USAGE": ("Set to 'y' if you would like Packstack to install Nagios "
"PROMPT" : "Should Packstack install Nagios to monitor OpenStack hosts", "to monitor OpenStack hosts"),
"PROMPT": ("Should Packstack install Nagios to monitor OpenStack "
"hosts"),
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": 'y', "DEFAULT_VALUE": 'y',
@ -186,9 +218,15 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "exclude-servers", {"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.", "USAGE": ("Comma separated list of servers to be excluded from "
"PROMPT" : "Enter a comma separated list of server(s) to be excluded. Leave plain if you don't need to exclude any server.", "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": [], "OPTION_LIST": [],
"DEFAULT_VALUE": '', "DEFAULT_VALUE": '',
"MASK_INPUT": False, "MASK_INPUT": False,
@ -197,12 +235,11 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-debug-mode", {"CMD_OPTION": "os-debug-mode",
"USAGE" : ("Set to 'y' if you want to run " "USAGE": ("Set to 'y' if you want to run OpenStack services in debug "
"OpenStack services in debug mode. " "mode. Otherwise set to 'n'."),
"Otherwise set to 'n'."), "PROMPT": "Do you want to run OpenStack services in debug mode",
"PROMPT" : ("Do you want to run OpenStack services"
" in debug mode"),
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"DEFAULT_VALUE": "n", "DEFAULT_VALUE": "n",
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
@ -212,12 +249,61 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": 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", {"CMD_OPTION": "os-vmware",
"USAGE" : ("Set to 'y' if you want to use " "USAGE": ("Set to 'y' if you want to use VMware vCenter as hypervisor"
"VMware vCenter as hypervisor and storage" " and storage. Otherwise set to 'n'."),
"Otherwise set to 'n'."), "PROMPT": ("Do you want to use VMware vCenter as hypervisor and "
"PROMPT" : ("Do you want to use VMware vCenter as" "datastore"),
" hypervisor and datastore"),
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
"DEFAULT_VALUE": "n", "DEFAULT_VALUE": "n",
"VALIDATORS": [validators.validate_options], "VALIDATORS": [validators.validate_options],
@ -228,22 +314,23 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
groupDict = { "GROUP_NAME" : "GLOBAL", group = {"GROUP_NAME": "GLOBAL",
"DESCRIPTION": "Global Options", "DESCRIPTION": "Global Options",
"PRE_CONDITION": lambda x: 'yes', "PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes", "PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(groupDict, paramsList) controller.addGroup(group, params)
def use_vcenter(config): def use_vcenter(config):
return (config['CONFIG_NOVA_INSTALL'] == 'y' and return (config['CONFIG_NOVA_INSTALL'] == 'y' and
config['CONFIG_VMWARE_BACKEND'] == 'y') config['CONFIG_VMWARE_BACKEND'] == 'y')
paramsList = [ params = [
{"CMD_OPTION": "vcenter-host", {"CMD_OPTION": "vcenter-host",
"USAGE" : ("The IP address of the VMware vCenter server"), "USAGE": "The IP address of the VMware vCenter server",
"PROMPT" : ("Enter the IP address of the VMware vCenter server to use with Nova"), "PROMPT": ("Enter the IP address of the VMware vCenter server to use "
"with Nova"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_ip], "VALIDATORS": [validators.validate_ip],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -253,46 +340,50 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "vcenter-username", {"CMD_OPTION": "vcenter-username",
"USAGE" : ("The username to authenticate to VMware vCenter server"), "USAGE": "The username to authenticate to VMware vCenter server",
"PROMPT" : ("Enter the username to authenticate on VMware vCenter server"), "PROMPT": ("Enter the username to authenticate on VMware "
"vCenter server"),
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": False, "MASK_INPUT": False,
"LOOSE_VALIDATION": True, "LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_VCENTER_USER", "CONF_NAME": "CONFIG_VCENTER_USER",
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION" : False,}, "CONDITION": False},
{"CMD_OPTION": "vcenter-password", {"CMD_OPTION": "vcenter-password",
"USAGE" : ("The password to authenticate to VMware vCenter server"), "USAGE": "The password to authenticate to VMware vCenter server",
"PROMPT" : ("Enter the password to authenticate on VMware vCenter server"), "PROMPT": ("Enter the password to authenticate on VMware "
"vCenter server"),
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": True, "MASK_INPUT": True,
"LOOSE_VALIDATION": True, "LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_VCENTER_PASSWORD", "CONF_NAME": "CONFIG_VCENTER_PASSWORD",
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION" : False,}, "CONDITION": False},
{"CMD_OPTION": "vcenter-cluster", {"CMD_OPTION": "vcenter-cluster",
"USAGE" : ("The name of the vCenter cluster"), "USAGE": "The name of the vCenter cluster",
"PROMPT" : ("Enter the name of the vCenter datastore"), "PROMPT": "Enter the name of the vCenter datastore",
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": False, "MASK_INPUT": False,
"LOOSE_VALIDATION": True, "LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_VCENTER_CLUSTER_NAME", "CONF_NAME": "CONFIG_VCENTER_CLUSTER_NAME",
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION" : False,}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "VMWARE",
groupDict = {"GROUP_NAME" : "VMWARE",
"DESCRIPTION": "vCenter Config Parameters", "DESCRIPTION": "vCenter Config Parameters",
"PRE_CONDITION": use_vcenter, "PRE_CONDITION": use_vcenter,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
controller.addGroup(groupDict, paramsList)
def initSequences(controller): def initSequences(controller):
prescript_steps = [ prescript_steps = [
@ -305,21 +396,21 @@ def initSequences(controller):
] ]
if controller.CONF['CONFIG_NTP_SERVERS']: if controller.CONF['CONFIG_NTP_SERVERS']:
prescript_steps.append({ prescript_steps.append(
'title': 'Installing time synchronization via NTP', {'title': 'Installing time synchronization via NTP',
'functions': [create_ntp_manifest], 'functions': [create_ntp_manifest]})
})
else: else:
controller.MESSAGES.append('Time synchronization installation ' controller.MESSAGES.append('Time synchronization installation was '
'was skipped. Please note that ' 'skipped. Please note that unsynchronized '
'unsynchronized time on server ' 'time on server instances might be problem '
'instances might be problem for ' 'for some OpenStack components.')
'some OpenStack components.')
controller.addSequence("Running pre install scripts", [], [], controller.addSequence("Running pre install scripts", [], [],
prescript_steps) prescript_steps)
def install_keys(config): #-------------------------- step functions --------------------------
def install_keys(config, messages):
with open(config["CONFIG_SSH_KEY"]) as fp: with open(config["CONFIG_SSH_KEY"]) as fp:
sshkeydata = fp.read().strip() sshkeydata = fp.read().strip()
for hostname in filtered_hosts(config): for hostname in filtered_hosts(config):
@ -337,7 +428,7 @@ def install_keys(config):
server.execute() server.execute()
def discover(config): def discover(config, messages):
""" """
Discovers details about hosts. Discovers details about hosts.
""" """
@ -382,7 +473,7 @@ def discover(config):
config['HOST_DETAILS'] = details config['HOST_DETAILS'] = details
def create_manifest(config): def create_manifest(config, messages):
key = 'CONFIG_DEBUG_MODE' key = 'CONFIG_DEBUG_MODE'
config[key] = config[key] == 'y' and 'true' or 'false' config[key] = config[key] == 'y' and 'true' or 'false'
@ -392,7 +483,7 @@ def create_manifest(config):
appendManifestFile(manifestfile, manifestdata) appendManifestFile(manifestfile, manifestdata)
def create_ntp_manifest(config): def create_ntp_manifest(config, messages):
srvlist = [i.strip() srvlist = [i.strip()
for i in config['CONFIG_NTP_SERVERS'].split(',') for i in config['CONFIG_NTP_SERVERS'].split(',')
if i.strip()] if i.strip()]

View File

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

View File

@ -3,6 +3,7 @@
""" """
Installs and configures puppet Installs and configures puppet
""" """
import sys import sys
import logging import logging
import os import os
@ -17,62 +18,117 @@ from packstack.modules.common import filtered_hosts
from packstack.modules.ospluginutils import manifestfiles from packstack.modules.ospluginutils import manifestfiles
from packstack.modules.puppet import scan_logfile, validate_logfile from packstack.modules.puppet import scan_logfile, validate_logfile
# Controller object will be initialized from main flow
controller = None
# Plugin name #------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OSPUPPET"
PLUGIN_NAME = "Puppet"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') 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') MODULE_DIR = os.path.join(PUPPET_DIR, 'modules')
def initConfig(controllerObject): def initConfig(controller):
global controller group = {"GROUP_NAME": "PUPPET",
controller = controllerObject
logging.debug("Adding OpenStack Puppet configuration")
paramsList = [
]
groupDict = {"GROUP_NAME" : "PUPPET",
"DESCRIPTION": "Puppet Config parameters", "DESCRIPTION": "Puppet Config parameters",
"PRE_CONDITION": lambda x: 'yes', "PRE_CONDITION": lambda x: 'yes',
"PRE_CONDITION_MATCH": "yes", "PRE_CONDITION_MATCH": "yes",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True}
controller.addGroup(group, [])
controller.addGroup(groupDict, paramsList)
def initSequences(controller): def initSequences(controller):
puppetpresteps = [ puppetpresteps = [
{'title': 'Clean Up', 'functions':[runCleanup]}, {'title': 'Clean Up', 'functions': [run_cleanup]},
] ]
controller.insertSequence("Clean Up", [], [], puppetpresteps, index=0) controller.insertSequence("Clean Up", [], [], puppetpresteps, index=0)
puppetsteps = [ puppetsteps = [
{'title': 'Installing Dependencies', {'title': 'Installing Dependencies',
'functions': [installdeps]}, 'functions': [install_deps]},
{'title': 'Copying Puppet modules and manifests', {'title': 'Copying Puppet modules and manifests',
'functions': [copyPuppetModules]}, 'functions': [copy_puppet_modules]},
{'title': 'Applying Puppet manifests', {'title': 'Applying Puppet manifests',
'functions': [applyPuppetManifest]}, 'functions': [apply_puppet_manifest]},
{'title': 'Finalizing', {'title': 'Finalizing',
'functions': [finalize]} 'functions': [finalize]}
] ]
controller.addSequence("Puppet", [], [], puppetsteps) 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 = utils.ScriptRunner()
localserver.append("rm -rf %s/*pp" % basedefs.PUPPET_MANIFEST_DIR) localserver.append("rm -rf %s/*pp" % basedefs.PUPPET_MANIFEST_DIR)
localserver.execute() localserver.execute()
def installdeps(config): def install_deps(config, messages):
deps = ["puppet", "openssh-clients", "tar", "nc"] deps = ["puppet", "openssh-clients", "tar", "nc"]
modules_pkg = 'openstack-puppet-modules' modules_pkg = 'openstack-puppet-modules'
@ -91,18 +147,19 @@ def installdeps(config):
for hostname in filtered_hosts(config): for hostname in filtered_hosts(config):
server = utils.ScriptRunner(hostname) server = utils.ScriptRunner(hostname)
for package in deps: 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() server.execute()
def copyPuppetModules(config): def copy_puppet_modules(config, messages):
os_modules = ' '.join(('apache', 'ceilometer', 'certmonger', 'cinder', os_modules = ' '.join(('apache', 'ceilometer', 'certmonger', 'cinder',
'concat', 'firewall', 'glance', 'heat', 'horizon', 'concat', 'firewall', 'glance', 'heat', 'horizon',
'inifile', 'keystone', 'memcached', 'mongodb', 'inifile', 'keystone', 'memcached', 'mongodb',
'mysql', 'neutron', 'nova', 'nssdb', 'openstack', 'mysql', 'neutron', 'nova', 'nssdb', 'openstack',
'packstack', 'qpid', 'rabbitmq', 'rsync', 'ssh', 'stdlib', 'packstack', 'qpid', 'rabbitmq', 'rsync', 'ssh',
'swift', 'sysctl', 'tempest', 'vcsrepo', 'vlan', 'stdlib', 'swift', 'sysctl', 'tempest', 'vcsrepo',
'vswitch', 'xinetd')) 'vlan', 'vswitch', 'xinetd'))
# write puppet manifest to disk # write puppet manifest to disk
manifestfiles.writeManifests() manifestfiles.writeManifests()
@ -119,9 +176,11 @@ def copyPuppetModules(config):
"root@%s tar -C %s -xpzf -" % (hostname, host_dir)) "root@%s tar -C %s -xpzf -" % (hostname, host_dir))
# copy resources # 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 " server.append("scp -o StrictHostKeyChecking=no "
"-o UserKnownHostsFile=/dev/null %s root@%s:%s/resources/%s" % "-o UserKnownHostsFile=/dev/null "
"%s root@%s:%s/resources/%s" %
(path, hostname, host_dir, localname)) (path, hostname, host_dir, localname))
# copy Puppet modules required by Packstack # copy Puppet modules required by Packstack
@ -130,65 +189,12 @@ def copyPuppetModules(config):
"ssh -o StrictHostKeyChecking=no " "ssh -o StrictHostKeyChecking=no "
"-o UserKnownHostsFile=/dev/null " "-o UserKnownHostsFile=/dev/null "
"root@%s tar -C %s -xpzf -" % "root@%s tar -C %s -xpzf -" %
(os_modules, hostname, os.path.join(host_dir, 'modules'))) (os_modules, hostname,
os.path.join(host_dir, 'modules')))
server.execute() server.execute()
def waitforpuppet(currently_running): def apply_puppet_manifest(config, messages):
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):
if config.get("DRY_RUN"): if config.get("DRY_RUN"):
return return
currently_running = [] currently_running = []
@ -201,8 +207,8 @@ def applyPuppetManifest(config):
for manifest, marker in manifestfiles.getFiles(): for manifest, marker in manifestfiles.getFiles():
# if the marker has changed then we don't want to proceed until # if the marker has changed then we don't want to proceed until
# all of the previous puppet runs have finished # all of the previous puppet runs have finished
if lastmarker != None and lastmarker != marker: if lastmarker is not None and lastmarker != marker:
waitforpuppet(currently_running) wait_for_puppet(currently_running, messages)
lastmarker = marker lastmarker = marker
for hostname in filtered_hosts(config): for hostname in filtered_hosts(config):
@ -220,22 +226,24 @@ def applyPuppetManifest(config):
running_logfile = "%s.running" % man_path running_logfile = "%s.running" % man_path
finished_logfile = "%s.finished" % man_path finished_logfile = "%s.finished" % man_path
currently_running.append((hostname, finished_logfile)) 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("touch %s" % running_logfile)
server.append("chmod 600 %s" % running_logfile) server.append("chmod 600 %s" % running_logfile)
server.append("export PACKSTACK_VAR_DIR=%s" % host_dir) 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) cmd = ("( flock %s/ps.lock "
server.append(command) "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) server.execute(log=logcmd)
# wait for outstanding puppet runs befor exiting # 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): for hostname in filtered_hosts(config):
server = utils.ScriptRunner(hostname) server = utils.ScriptRunner(hostname)
server.append("installed=$(rpm -q kernel --last | head -n1 | " server.append("installed=$(rpm -q kernel --last | head -n1 | "
@ -245,5 +253,5 @@ def finalize(config):
try: try:
rc, out = server.execute() rc, out = server.execute()
except ScriptRuntimeError: except ScriptRuntimeError:
controller.MESSAGES.append('Because of the kernel update the host ' messages.append('Because of the kernel update the host %s '
'%s requires reboot.' % hostname) 'requires reboot.' % hostname)

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
prepare server prepare server
""" """
@ -15,19 +17,14 @@ from packstack.installer import validators
from packstack.modules.common import filtered_hosts, is_all_in_one 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 = "OS-SERVERPREPARE"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controllerObject): def initConfig(controller):
global controller
controller = controllerObject
logging.debug("Adding SERVERPREPARE KEY configuration")
conf_params = { conf_params = {
"SERVERPREPARE": [ "SERVERPREPARE": [
{"CMD_OPTION": "use-epel", {"CMD_OPTION": "use-epel",
@ -44,8 +41,10 @@ def initConfig(controllerObject):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "additional-repo", {"CMD_OPTION": "additional-repo",
"USAGE" : "A comma separated list of URLs to any additional yum repositories to install", "USAGE": ("A comma separated list of URLs to any additional yum "
"PROMPT" : "Enter a comma separated list of URLs to any additional yum repositories to install", "repositories to install"),
"PROMPT": ("Enter a comma separated list of URLs to any "
"additional yum repositories to install"),
"OPTION_LIST": [], "OPTION_LIST": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": False, "MASK_INPUT": False,
@ -53,12 +52,14 @@ def initConfig(controllerObject):
"CONF_NAME": "CONFIG_REPO", "CONF_NAME": "CONFIG_REPO",
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION" : False }], "CONDITION": False}
],
"RHEL": [ "RHEL": [
{"CMD_OPTION": "rh-username", {"CMD_OPTION": "rh-username",
"USAGE" : "To subscribe each server with Red Hat subscription manager, include this with CONFIG_RH_PW", "USAGE": ("To subscribe each server with Red Hat subscription "
"PROMPT" : "To subscribe each server to Red Hat enter a username here", "manager, include this with CONFIG_RH_PW"),
"PROMPT": "To subscribe each server to Red Hat enter a username ",
"OPTION_LIST": [], "OPTION_LIST": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": False, "MASK_INPUT": False,
@ -69,8 +70,10 @@ def initConfig(controllerObject):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "rh-password", {"CMD_OPTION": "rh-password",
"USAGE" : "To subscribe each server with Red Hat subscription manager, include this with CONFIG_RH_USER", "USAGE": ("To subscribe each server with Red Hat subscription "
"PROMPT" : "To subscribe each server to Red Hat enter your password here", "manager, include this with CONFIG_RH_USER"),
"PROMPT": ("To subscribe each server to Red Hat enter your "
"password"),
"OPTION_LIST": [], "OPTION_LIST": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": True, "MASK_INPUT": True,
@ -80,26 +83,13 @@ def initConfig(controllerObject):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": 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", {"CMD_OPTION": "rhn-satellite-server",
"USAGE" : ("To subscribe each server with RHN Satellite," "USAGE": ("To subscribe each server with RHN Satellite,fill "
"fill Satellite's URL here. Note that either " "Satellite's URL here. Note that either satellite's "
"satellite's username/password or activation " "username/password or activation key has "
"key has to be provided"), "to be provided"),
"PROMPT" : ("To subscribe each server with RHN Satellite " "PROMPT": ("To subscribe each server with RHN Satellite enter "
"enter RHN Satellite server URL"), "RHN Satellite server URL"),
"OPTION_LIST": [], "OPTION_LIST": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": False, "MASK_INPUT": False,
@ -107,13 +97,14 @@ def initConfig(controllerObject):
"CONF_NAME": "CONFIG_SATELLITE_URL", "CONF_NAME": "CONFIG_SATELLITE_URL",
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION" : False }], "CONDITION": False}
],
"SATELLITE": [ "SATELLITE": [
{"CMD_OPTION": "rhn-satellite-username", {"CMD_OPTION": "rhn-satellite-username",
"USAGE": "Username to access RHN Satellite", "USAGE": "Username to access RHN Satellite",
"PROMPT" : ("Enter RHN Satellite username or leave plain " "PROMPT": ("Enter RHN Satellite username or leave plain if you "
"if you will use activation key instead"), "will use activation key instead"),
"OPTION_LIST": [], "OPTION_LIST": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": False, "MASK_INPUT": False,
@ -125,8 +116,8 @@ def initConfig(controllerObject):
{"CMD_OPTION": "rhn-satellite-password", {"CMD_OPTION": "rhn-satellite-password",
"USAGE": "Password to access RHN Satellite", "USAGE": "Password to access RHN Satellite",
"PROMPT" : ("Enter RHN Satellite password or leave plain " "PROMPT": ("Enter RHN Satellite password or leave plain if you "
"if you will use activation key instead"), "will use activation key instead"),
"OPTION_LIST": [], "OPTION_LIST": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": True, "MASK_INPUT": True,
@ -138,8 +129,8 @@ def initConfig(controllerObject):
{"CMD_OPTION": "rhn-satellite-activation-key", {"CMD_OPTION": "rhn-satellite-activation-key",
"USAGE": "Activation key for subscription to RHN Satellite", "USAGE": "Activation key for subscription to RHN Satellite",
"PROMPT" : ("Enter RHN Satellite activation key or leave plain " "PROMPT": ("Enter RHN Satellite activation key or leave plain if "
"if you used username/password instead"), "you used username/password instead"),
"OPTION_LIST": [], "OPTION_LIST": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": True, "MASK_INPUT": True,
@ -162,12 +153,12 @@ def initConfig(controllerObject):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "rhn-satellite-profile", {"CMD_OPTION": "rhn-satellite-profile",
"USAGE" : ("If required specify the profile name that should " "USAGE": ("If required specify the profile name that should be "
"be used as an identifier for the system in RHN " "used as an identifier for the system "
"Satellite"), "in RHN Satellite"),
"PROMPT" : ("If required specify the profile name that should " "PROMPT": ("If required specify the profile name that should be "
"be used as an identifier for the system in RHN " "used as an identifier for the system "
"Satellite"), "in RHN Satellite"),
"OPTION_LIST": [], "OPTION_LIST": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": True, "MASK_INPUT": True,
@ -178,9 +169,10 @@ def initConfig(controllerObject):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "rhn-satellite-flags", {"CMD_OPTION": "rhn-satellite-flags",
"USAGE" : ("Comma separated list of flags passed to rhnreg_ks. Valid " "USAGE": ("Comma separated list of flags passed to rhnreg_ks. "
"flags are: novirtinfo, norhnsd, nopackages"), "Valid flags are: novirtinfo, norhnsd, nopackages"),
"PROMPT" : "Enter comma separated list of flags passed to rhnreg_ks", "PROMPT": ("Enter comma separated list of flags passed "
"to rhnreg_ks"),
"OPTION_LIST": ['novirtinfo', 'norhnsd', 'nopackages'], "OPTION_LIST": ['novirtinfo', 'norhnsd', 'nopackages'],
"VALIDATORS": [validators.validate_multi_options], "VALIDATORS": [validators.validate_multi_options],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
@ -201,12 +193,15 @@ def initConfig(controllerObject):
"CONF_NAME": "CONFIG_SATELLITE_PROXY", "CONF_NAME": "CONFIG_SATELLITE_PROXY",
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION" : False }], "CONDITION": False}
],
"SATELLITE_PROXY": [ "SATELLITE_PROXY": [
{"CMD_OPTION": "rhn-satellite-proxy-username", {"CMD_OPTION": "rhn-satellite-proxy-username",
"USAGE" : "Specify a username to use with an authenticated HTTP proxy", "USAGE": ("Specify a username to use with an authenticated "
"PROMPT" : "Specify a username to use with an authenticated HTTP proxy", "HTTP proxy"),
"PROMPT": ("Specify a username to use with an authenticated "
"HTTP proxy"),
"OPTION_LIST": [], "OPTION_LIST": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": True, "MASK_INPUT": True,
@ -217,8 +212,10 @@ def initConfig(controllerObject):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "rhn-satellite-proxy-password", {"CMD_OPTION": "rhn-satellite-proxy-password",
"USAGE" : "Specify a password to use with an authenticated HTTP proxy.", "USAGE": ("Specify a password to use with an authenticated "
"PROMPT" : "Specify a password to use with an authenticated HTTP proxy.", "HTTP proxy."),
"PROMPT": ("Specify a password to use with an authenticated "
"HTTP proxy."),
"OPTION_LIST": [], "OPTION_LIST": [],
"DEFAULT_VALUE": "", "DEFAULT_VALUE": "",
"MASK_INPUT": True, "MASK_INPUT": True,
@ -226,7 +223,9 @@ def initConfig(controllerObject):
"CONF_NAME": "CONFIG_SATELLITE_PROXY_PW", "CONF_NAME": "CONFIG_SATELLITE_PROXY_PW",
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION" : False }]} "CONDITION": False}
]
}
def filled_satellite(config): def filled_satellite(config):
return bool(config.get('CONFIG_SATELLITE_URL')) return bool(config.get('CONFIG_SATELLITE_URL'))
@ -243,8 +242,8 @@ def initConfig(controllerObject):
"POST_CONDITION_MATCH": True}, "POST_CONDITION_MATCH": True},
] ]
if ((is_all_in_one(controller.CONF) and is_rhel()) or config = controller.CONF
not is_all_in_one(controller.CONF)): if (is_all_in_one(config) and is_rhel()) or not is_all_in_one(config):
conf_groups.append({"GROUP_NAME": "RHEL", conf_groups.append({"GROUP_NAME": "RHEL",
"DESCRIPTION": "RHEL config", "DESCRIPTION": "RHEL config",
"PRE_CONDITION": lambda x: 'yes', "PRE_CONDITION": lambda x: 'yes',
@ -267,10 +266,19 @@ def initConfig(controllerObject):
"POST_CONDITION_MATCH": True}) "POST_CONDITION_MATCH": True})
for group in conf_groups: for group in conf_groups:
paramList = conf_params[group["GROUP_NAME"]] params = conf_params[group["GROUP_NAME"]]
controller.addGroup(group, paramList) controller.addGroup(group, params)
def initSequences(controller):
preparesteps = [
{'title': 'Preparing servers', 'functions': [server_prep]}
]
controller.addSequence("Preparing servers", [], [], preparesteps)
#------------------------- helper functions -------------------------
def is_rhel(): def is_rhel():
return 'Red Hat Enterprise Linux' in platform.linux_distribution()[0] 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) server = utils.ScriptRunner(host)
# check satellite server url # check satellite server url
server_url = server_url.rstrip('/').endswith('/XMLRPC') \ server_url = (server_url.rstrip('/').endswith('/XMLRPC')
and server_url \ and server_url or '%s/XMLRPC' % server_url)
or '%s/XMLRPC' % server_url
cmd.extend(['--serverUrl', server_url]) cmd.extend(['--serverUrl', server_url])
if activation_key: if activation_key:
@ -339,7 +346,7 @@ def run_rhn_reg(host, server_url, username=None, password=None,
server.execute(mask_list=mask) 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. Registers given host to Red Hat Repositories via subscription manager.
""" """
@ -357,12 +364,12 @@ def run_rhsm_reg(host, username, password, beta):
"grep -e 'Red Hat OpenStack' -m 1 -A 2 | grep 'Pool Id' | " "grep -e 'Red Hat OpenStack' -m 1 -A 2 | grep 'Pool Id' | "
"awk '{print $3}')") "awk '{print $3}')")
server.append(cmd % pool) 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("yum clean all")
server.append("rpm -q --whatprovides yum-utils || yum install -y yum-utils") server.append("rpm -q --whatprovides yum-utils || "
if beta: "yum install -y yum-utils")
server.append("yum-config-manager --enable rhel-6-server-beta-rpms")
server.append("yum clean metadata") server.append("yum clean metadata")
server.execute(mask_list=[password]) server.execute(mask_list=[password])
@ -409,7 +416,8 @@ def manage_epel(host, config):
server.append('yum-config-manager --%(cmd)s epel' % locals()) server.append('yum-config-manager --%(cmd)s epel' % locals())
rc, out = server.execute() 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) match = re.search('enabled\s*\=\s*%(enabled)s' % locals(), out)
if match: if match:
return return
@ -428,7 +436,6 @@ def manage_epel(host, config):
logger.warn(msg % host) logger.warn(msg % host)
def manage_rdo(host, config): def manage_rdo(host, config):
""" """
Installs and enables RDO repo on host in case it is installed locally. 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 reponame = 'openstack-%s' % version
server.clear() server.clear()
server.append('yum-config-manager --enable %(reponame)s' % locals()) 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() rc, out = server.execute()
match = re.search('enabled\s*=\s*(1|True)', out) match = re.search('enabled\s*=\s*(1|True)', out)
if not match: if not match:
@ -467,14 +475,9 @@ def manage_rdo(host, config):
raise exceptions.ScriptRuntimeError(msg) raise exceptions.ScriptRuntimeError(msg)
def initSequences(controller): #-------------------------- step functions --------------------------
preparesteps = [
{'title': 'Preparing servers', 'functions':[serverprep]}
]
controller.addSequence("Preparing servers", [], [], preparesteps)
def server_prep(config, messages):
def serverprep(config):
rh_username = None rh_username = None
sat_url = None sat_url = None
if is_rhel(): if is_rhel():
@ -489,7 +492,8 @@ def serverprep(config):
sat_flags = [i.strip() for i in flag_list if i.strip()] sat_flags = [i.strip() for i in flag_list if i.strip()]
sat_proxy_user = config.get("CONFIG_SATELLITE_PROXY_USER", '') sat_proxy_user = config.get("CONFIG_SATELLITE_PROXY_USER", '')
sat_proxy_pass = config.get("CONFIG_SATELLITE_PROXY_PW", '') sat_proxy_pass = config.get("CONFIG_SATELLITE_PROXY_PW", '')
sat_args = {'username': config["CONFIG_SATELLITE_USER"].strip(), sat_args = {
'username': config["CONFIG_SATELLITE_USER"].strip(),
'password': config["CONFIG_SATELLITE_PW"].strip(), 'password': config["CONFIG_SATELLITE_PW"].strip(),
'cacert': config["CONFIG_SATELLITE_CACERT"].strip(), 'cacert': config["CONFIG_SATELLITE_CACERT"].strip(),
'activation_key': config["CONFIG_SATELLITE_AKEY"].strip(), 'activation_key': config["CONFIG_SATELLITE_AKEY"].strip(),
@ -497,13 +501,13 @@ def serverprep(config):
'proxy_host': config["CONFIG_SATELLITE_PROXY"].strip(), 'proxy_host': config["CONFIG_SATELLITE_PROXY"].strip(),
'proxy_user': sat_proxy_user.strip(), 'proxy_user': sat_proxy_user.strip(),
'proxy_pass': sat_proxy_pass.strip(), 'proxy_pass': sat_proxy_pass.strip(),
'flags': sat_flags} 'flags': sat_flags
}
for hostname in filtered_hosts(config): for hostname in filtered_hosts(config):
# Subscribe to Red Hat Repositories if configured # Subscribe to Red Hat Repositories if configured
if rh_username: if rh_username:
run_rhsm_reg(hostname, rh_username, rh_password, run_rhsm_reg(hostname, rh_username, rh_password)
config["CONFIG_RH_BETA_REPO"] == 'y')
# Subscribe to RHN Satellite if configured # Subscribe to RHN Satellite if configured
if sat_url and hostname not in sat_registered: if sat_url and hostname not in sat_registered:

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
""" """
Installs and configures an OpenStack Swift Installs and configures an OpenStack Swift
""" """
@ -13,36 +15,21 @@ from packstack.installer import basedefs
from packstack.installer import utils from packstack.installer import utils
from packstack.installer.utils import split_hosts 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 #------------------ oVirt installer initialization ------------------
PLUGIN_NAME = "OS-SWIFT"
PLUGIN_NAME = "OS-Swift"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
logging.debug("plugin %s loaded", __name__)
def initConfig(controllerObject): def initConfig(controller):
global controller params = [
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", {"CMD_OPTION": "os-swift-ks-passwd",
"USAGE" : "The password to use for the Swift to authenticate with Keystone", "USAGE": ("The password to use for the Swift to authenticate "
"with Keystone"),
"PROMPT": "Enter the password for the Swift Keystone access", "PROMPT": "Enter the password for the Swift Keystone access",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@ -53,21 +40,31 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "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", {"CMD_OPTION": "os-swift-storages",
"PROMPT" : "Enter the Swift Storage servers e.g. host/dev,host/dev", "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": [], "OPTION_LIST": [],
"VALIDATORS" : [validators.validate_not_empty, validate_storage], "VALIDATORS": [],
"DEFAULT_VALUE" : utils.get_localhost_ip(), "DEFAULT_VALUE": '',
"MASK_INPUT": False, "MASK_INPUT": False,
"LOOSE_VALIDATION": True, "LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_SWIFT_STORAGE_HOSTS", "CONF_NAME": "CONFIG_SWIFT_STORAGES",
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-swift-storage-zones", {"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", "USAGE": ("Number of swift storage zones, this number MUST be "
"PROMPT" : "Enter the number of swift storage zones, MUST be no bigger than the number of storage devices configured", "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": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_integer], "VALIDATORS": [validators.validate_integer],
"DEFAULT_VALUE": "1", "DEFAULT_VALUE": "1",
@ -77,9 +74,12 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-swift-storage-replicas", {"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", "USAGE": ("Number of swift storage replicas, this number MUST be "
"PROMPT" : "Enter the number of swift storage replicas, MUST be no bigger than the number of storage zones configured", "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": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_integer], "VALIDATORS": [validators.validate_integer],
"DEFAULT_VALUE": "1", "DEFAULT_VALUE": "1",
@ -89,6 +89,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-swift-storage-fstype", {"CMD_OPTION": "os-swift-storage-fstype",
"USAGE": "FileSystem type for storage nodes", "USAGE": "FileSystem type for storage nodes",
"PROMPT": "Enter FileSystem type for storage nodes", "PROMPT": "Enter FileSystem type for storage nodes",
@ -101,6 +102,7 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-swift-hash", {"CMD_OPTION": "os-swift-hash",
"USAGE": "Shared secret for Swift", "USAGE": "Shared secret for Swift",
"PROMPT": "Enter hash for Swift shared secret", "PROMPT": "Enter hash for Swift shared secret",
@ -113,9 +115,11 @@ def initConfig(controllerObject):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "os-swift-storage-size", {"CMD_OPTION": "os-swift-storage-size",
"USAGE": "Size of the swift loopback file storage device", "USAGE": "Size of the swift loopback file storage device",
"PROMPT" : "Enter the size of the storage device (eg. 2G, 2000M, 2000000K)", "PROMPT": ("Enter the size of the storage device (eg. 2G, 2000M, "
"2000000K)"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validate_storage_size], "VALIDATORS": [validate_storage_size],
"DEFAULT_VALUE": "2G", "DEFAULT_VALUE": "2G",
@ -125,24 +129,36 @@ def initConfig(controllerObject):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "OSSWIFT",
groupDict = { "GROUP_NAME" : "OSSWIFT",
"DESCRIPTION": "OpenStack Swift Config parameters", "DESCRIPTION": "OpenStack Swift Config parameters",
"PRE_CONDITION": "CONFIG_SWIFT_INSTALL", "PRE_CONDITION": "CONFIG_SWIFT_INSTALL",
"PRE_CONDITION_MATCH": "y", "PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "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): #------------------------- helper functions -------------------------
for host in param.split(','):
host = host.split('/', 1)[0]
validators.validate_ip(host.strip(), options)
def validate_storage_size(param, options=None): def validate_storage_size(param, options=None):
match = re.match(r'\d+G|\d+M|\d+K', param, re.IGNORECASE) 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)' msg = 'Storage size not have a valid value (eg. 1G, 1000M, 1000000K)'
raise ParamValidationError(msg) raise ParamValidationError(msg)
def initSequences(controller):
if controller.CONF['CONFIG_SWIFT_INSTALL'] != 'y':
return
steps = [ def parse_devices(config):
{'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):
""" """
Returns dict containing information about Swift storage devices. Returns dict containing information about Swift storage devices.
""" """
devices = []
device_number = 0 device_number = 0
num_zones = int(controller.CONF["CONFIG_SWIFT_STORAGE_ZONES"]) num_zones = int(config["CONFIG_SWIFT_STORAGE_ZONES"])
for host in config_swift_storage_hosts.split(","): for device in config["CONFIG_SWIFT_STORAGES"].split(","):
host = host.strip() device = device.strip()
if not device:
continue
device_number += 1 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) 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}) 'device_name': 'device%s' % device_number})
if not devices:
devices.append({'device': None, 'zone': 1,
'device_name': 'swiftloopback'})
return devices 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): def check_device(host, device):
""" """
Raises ScriptRuntimeError if given device is not mounted on given Raises ScriptRuntimeError if given device is not mounted on given
@ -230,62 +196,102 @@ def check_device(host, device):
server = utils.ScriptRunner(host) server = utils.ScriptRunner(host)
# the device MUST exist # the device MUST exist
cmd = 'ls -l /dev/%s' cmd = 'ls -l %s'
server.append(cmd % device) server.append(cmd % device)
# if it is not mounted then we can use it # 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) server.append(cmd % device)
# if it is mounted then the mount point has to be in /srv/node # 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) server.append(cmd % device)
# if we got here without exiting then we can't use this device # if we got here without exiting then we can't use this device
server.append('exit 1') server.append('exit 1')
server.execute() server.execute()
return False
def get_storage_size(size):
def get_storage_size(config):
ranges = {'G': 1048576, 'M': 1024, 'K': 1} ranges = {'G': 1048576, 'M': 1024, 'K': 1}
size.strip() size = config['CONFIG_SWIFT_STORAGE_SIZE'].strip()
for measure in ['G', 'M', 'K']: for measure in ['G', 'M', 'K']:
if re.match('\d+' + measure, size, re.IGNORECASE): if re.match('\d+' + measure, size, re.IGNORECASE):
intsize = int(size.rstrip(measure)) * ranges[measure] intsize = int(size.rstrip(measure)) * ranges[measure]
return intsize return intsize
def createstoragemanifest(config):
# this need to happen once per storage host #-------------------------- step functions --------------------------
for host in set([device['host'] for device in devices]):
controller.CONF["CONFIG_SWIFT_STORAGE_CURRENT"] = host def create_keystone_manifest(config, messages):
manifestfile = "%s_swift.pp"%host # parse devices in first step
manifestdata = getManifestTemplate("swift_storage.pp") global devices
devices = parse_devices(config)
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
manifestdata = getManifestTemplate("keystone_swift.pp")
appendManifestFile(manifestfile, manifestdata) 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 # this need to happen once per storage device
for device in devices: for device in devices:
host = device['host'] host = config['CONFIG_CONTROLLER_HOST']
devicename = device['device_name'] devicename = device['device_name']
device = device['device'] device = device['device']
fstype = config["CONFIG_SWIFT_STORAGE_FSTYPE"]
if device: if device:
check_device(host, device) check_device(host, device)
manifestdata += ('\nswift::storage::%s { "%s":\n'
manifestfile = "%s_swift.pp"%host ' device => "%s",\n}\n'
if device: % (fstype, devicename, device))
manifestdata = "\n" + 'swift::storage::%s{"%s":\n device => "/dev/%s",\n}'% (controller.CONF["CONFIG_SWIFT_STORAGE_FSTYPE"], devicename, device)
else: else:
config['SWIFT_STORAGE_SEEK'] = get_storage_size(config['CONFIG_SWIFT_STORAGE_SIZE']) # create loopback device if none was specified
controller.CONF["SWIFT_STORAGE_DEVICES"] = "'%s'"%devicename config['CONFIG_SWIFT_STORAGE_SEEK'] = get_storage_size(config)
manifestdata = "\n" + getManifestTemplate("swift_loopback.pp") manifestdata += "\n" + getManifestTemplate("swift_loopback.pp")
appendManifestFile(manifestfile, manifestdata)
# set allowed hosts for firewall # set allowed hosts for firewall
swift_hosts = get_swift_hosts(config) hosts = set([config['CONFIG_CONTROLLER_HOST']])
hosts = swift_hosts.copy()
manifestdata = ""
if config['CONFIG_NOVA_INSTALL'] == 'y': 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_SERVICE_NAME'] = "swift storage and rsync"
config['FIREWALL_PORTS'] = "'6000', '6001', '6002', '873'" config['FIREWALL_PORTS'] = "'6000', '6001', '6002', '873'"
@ -296,22 +302,11 @@ def createstoragemanifest(config):
config['FIREWALL_SERVICE_ID'] = "swift_storage_and_rsync_%s" % host config['FIREWALL_SERVICE_ID'] = "swift_storage_and_rsync_%s" % host
manifestdata += getManifestTemplate("firewall.pp") 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(): for manifestfile, marker in manifestfiles.getFiles():
if manifestfile.endswith("_swift.pp"): if manifestfile.endswith("_swift.pp"):
data = getManifestTemplate("swift_common.pp") data = getManifestTemplate("swift_common.pp")
appendManifestFile(os.path.split(manifestfile)[1], data) 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 { case $amqp {
'qpid': { 'qpid': {
enable_qpid {"qpid": enable_qpid {"qpid":

View File

@ -6,7 +6,7 @@ class { 'ceilometer::collector':
} }
class { 'ceilometer::agent::auth': 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', auth_password => '%(CONFIG_CEILOMETER_KS_PW)s',
} }
@ -20,6 +20,6 @@ class { 'ceilometer::alarm::evaluator':
} }
class { 'ceilometer::api': class { 'ceilometer::api':
keystone_host => '%(CONFIG_KEYSTONE_HOST)s', keystone_host => '%(CONFIG_CONTROLLER_HOST)s',
keystone_password => '%(CONFIG_CEILOMETER_KS_PW)s', keystone_password => '%(CONFIG_CEILOMETER_KS_PW)s',
} }

View File

@ -1,5 +1,5 @@
cinder_config { cinder_config {
"DEFAULT/glance_host": value => "%(CONFIG_GLANCE_HOST)s"; "DEFAULT/glance_host": value => "%(CONFIG_CONTROLLER_HOST)s";
} }
package {'python-keystone': package {'python-keystone':
@ -10,7 +10,7 @@ class {'cinder::api':
keystone_password => '%(CONFIG_CINDER_KS_PW)s', keystone_password => '%(CONFIG_CINDER_KS_PW)s',
keystone_tenant => "services", keystone_tenant => "services",
keystone_user => "cinder", keystone_user => "cinder",
keystone_auth_host => "%(CONFIG_KEYSTONE_HOST)s", keystone_auth_host => "%(CONFIG_CONTROLLER_HOST)s",
} }
class {'cinder::scheduler': class {'cinder::scheduler':
@ -20,5 +20,5 @@ class {'cinder::volume':
} }
class {'cinder::volume::iscsi': 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': 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'] Class['cinder::api'] ~> Service['cinder-backup']

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
class { 'heat': class { 'heat':
keystone_host => '%(CONFIG_KEYSTONE_HOST)s', keystone_host => '%(CONFIG_CONTROLLER_HOST)s',
keystone_password => '%(CONFIG_HEAT_KS_PW)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', rpc_backend => 'heat.openstack.common.rpc.impl_qpid',
qpid_hostname => '%(CONFIG_AMQP_HOST)s', qpid_hostname => '%(CONFIG_AMQP_HOST)s',
qpid_username => '%(CONFIG_AMQP_AUTH_USER)s', qpid_username => '%(CONFIG_AMQP_AUTH_USER)s',

View File

@ -1,7 +1,7 @@
class { 'heat': class { 'heat':
keystone_host => '%(CONFIG_KEYSTONE_HOST)s', keystone_host => '%(CONFIG_CONTROLLER_HOST)s',
keystone_password => '%(CONFIG_HEAT_KS_PW)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', rpc_backend => 'heat.openstack.common.rpc.impl_kombu',
rabbit_host => '%(CONFIG_AMQP_HOST)s', rabbit_host => '%(CONFIG_AMQP_HOST)s',
rabbit_userid => '%(CONFIG_AMQP_AUTH_USER)s', rabbit_userid => '%(CONFIG_AMQP_AUTH_USER)s',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@ class nagios_configs(){
content => "export OS_USERNAME=admin content => "export OS_USERNAME=admin
export OS_TENANT_NAME=admin export OS_TENANT_NAME=admin
export OS_PASSWORD=%(CONFIG_KEYSTONE_ADMIN_PW)s 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 %(CONFIG_NAGIOS_MANIFEST_CONFIG)s
} }

View File

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

View File

@ -1,6 +1,6 @@
class {'neutron::agents::metadata': class {'neutron::agents::metadata':
auth_password => '%(CONFIG_NEUTRON_KS_PW)s', 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', 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_username => 'nova',
nova_admin_password => '%(CONFIG_NOVA_KS_PW)s', nova_admin_password => '%(CONFIG_NOVA_KS_PW)s',
nova_admin_tenant_name => 'services', nova_admin_tenant_name => 'services',
nova_url => 'http://%(CONFIG_NOVA_API_HOST)s:8774/v2', nova_url => 'http://%(CONFIG_CONTROLLER_HOST)s:8774/v2',
nova_admin_auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0', nova_admin_auth_url => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
} }

View File

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

View File

@ -1,6 +1,6 @@
class { 'ceilometer::agent::auth': 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', auth_password => '%(CONFIG_CEILOMETER_KS_PW)s',
} }

View File

@ -5,7 +5,5 @@ Firewall <| |> -> Class['nova']
nova_config{ nova_config{
"DEFAULT/sql_connection": value => "%(CONFIG_NOVA_SQL_CONN)s"; "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": 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_hostname => "%(CONFIG_AMQP_HOST)s",
qpid_username => '%(CONFIG_AMQP_AUTH_USER)s', qpid_username => '%(CONFIG_AMQP_AUTH_USER)s',
qpid_password => '%(CONFIG_AMQP_AUTH_PASSWORD)s', qpid_password => '%(CONFIG_AMQP_AUTH_PASSWORD)s',

View File

@ -1,6 +1,6 @@
class { "nova": 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_host => "%(CONFIG_AMQP_HOST)s",
rabbit_port => '%(CONFIG_AMQP_CLIENTS_PORT)s', rabbit_port => '%(CONFIG_AMQP_CLIENTS_PORT)s',
rabbit_userid => '%(CONFIG_AMQP_AUTH_USER)s', rabbit_userid => '%(CONFIG_AMQP_AUTH_USER)s',

View File

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

View File

@ -2,9 +2,9 @@
class {"nova::network::neutron": class {"nova::network::neutron":
neutron_admin_password => "%(CONFIG_NEUTRON_KS_PW)s", neutron_admin_password => "%(CONFIG_NEUTRON_KS_PW)s",
neutron_auth_strategy => "keystone", 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_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": class {"nova::compute::neutron":

View File

@ -8,7 +8,7 @@ package { $clientlibs: }
$rcadmin_content = "export OS_USERNAME=admin $rcadmin_content = "export OS_USERNAME=admin
export OS_TENANT_NAME=admin export OS_TENANT_NAME=admin
export OS_PASSWORD=%(CONFIG_KEYSTONE_ADMIN_PW)s 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)]\\$ ' export PS1='[\\u@\\h \\W(keystone_admin)]\\$ '
" "
@ -25,7 +25,7 @@ if '%(CONFIG_PROVISION_DEMO)s' == 'y' {
content => "export OS_USERNAME=demo content => "export OS_USERNAME=demo
export OS_TENANT_NAME=demo export OS_TENANT_NAME=demo
export OS_PASSWORD=%(CONFIG_KEYSTONE_DEMO_PW)s 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)]\\$ ' 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 # sets up an rsync db that can be used to sync the ring DB
class { 'swift::ringserver': class { 'swift::ringserver':
local_net_ip => "%(CONFIG_SWIFT_BUILDER_HOST)s", local_net_ip => "%(CONFIG_CONTROLLER_HOST)s",
}
@@swift::ringsync { ['account', 'object', 'container']:
ring_server => $swift_local_net_ip
} }
if ($::selinux != "false"){ 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', base_dir => '/srv/loopback-device',
mnt_base_dir => '/srv/node', mnt_base_dir => '/srv/node',
require => Class['swift'], require => Class['swift'],
fstype => '%(CONFIG_SWIFT_STORAGE_FSTYPE)s', 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': class { 'swift::proxy':
proxy_local_net_ip => '%(CONFIG_SWIFT_PROXY)s', proxy_local_net_ip => '%(CONFIG_CONTROLLER_HOST)s',
pipeline => [ pipeline => [
'bulk', 'bulk',
'catch_errors', 'catch_errors',
@ -62,7 +62,7 @@ class { 'swift::proxy::authtoken':
admin_tenant_name => 'services', admin_tenant_name => 'services',
admin_password => '%(CONFIG_SWIFT_KS_PW)s', admin_password => '%(CONFIG_SWIFT_KS_PW)s',
# assume that the controller host is the swift api server # 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': firewall { '001 swift proxy incoming':

View File

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

View File

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

View File

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