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:
parent
8f2f18b302
commit
3d92f24ccc
|
@ -26,15 +26,16 @@ class Step(object):
|
|||
"Object %s is not callable." % function)
|
||||
self.function = function
|
||||
|
||||
def run(self, config=None):
|
||||
config = config or {}
|
||||
def run(self, config=None, messages=None):
|
||||
config = config if config is not None else {}
|
||||
messages = messages if messages is not None else []
|
||||
# TO-DO: complete logger name when logging will be setup correctly
|
||||
logger = logging.getLogger()
|
||||
logger.debug('Running step %s.' % self.name)
|
||||
|
||||
# execute and report state
|
||||
try:
|
||||
self.function(config)
|
||||
self.function(config, messages)
|
||||
except Exception, ex:
|
||||
logger.debug(traceback.format_exc())
|
||||
state = utils.state_message(self.title, 'ERROR', 'red')
|
||||
|
@ -75,16 +76,17 @@ class Sequence(object):
|
|||
result = config.get(self.condition)
|
||||
return result == self.cond_match
|
||||
|
||||
def run(self, config=None, step=None):
|
||||
def run(self, config=None, messages=None, step=None):
|
||||
"""
|
||||
Runs sequence of steps. Runs only specific step if step's name
|
||||
is given via 'step' parameter.
|
||||
"""
|
||||
config = config or {}
|
||||
config = config if config is not None else {}
|
||||
messages = messages if messages is not None else []
|
||||
if not self.validate_condition(config):
|
||||
return
|
||||
if step:
|
||||
self.steps[step].run(config=config)
|
||||
self.steps[step].run(config=config, messages=messages)
|
||||
return
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
@ -93,4 +95,4 @@ class Sequence(object):
|
|||
sys.stdout.write('%s\n' % self.title)
|
||||
sys.stdout.flush()
|
||||
for step in self.steps.itervalues():
|
||||
step.run(config=config)
|
||||
step.run(config=config, messages=messages)
|
||||
|
|
|
@ -671,15 +671,12 @@ def single_step_install(options):
|
|||
hosts = [host.strip() for host in hosts.split(',')]
|
||||
for group in controller.getAllGroups():
|
||||
for param in group.parameters.itervalues():
|
||||
# we don't need magic in case CONFIG_NEUTRON_LBAAS_HOSTS
|
||||
if param.CONF_NAME == 'CONFIG_NEUTRON_LBAAS_HOSTS':
|
||||
continue
|
||||
# and directives that contain _HOST are set to the controller node
|
||||
if param.CONF_NAME.find("_HOST") != -1:
|
||||
overrides[param.CONF_NAME] = hosts[0]
|
||||
# If there are more than one host, all but the first are a compute nodes
|
||||
if len(hosts) > 1:
|
||||
overrides["CONFIG_NOVA_COMPUTE_HOSTS"] = ','.join(hosts[1:])
|
||||
overrides["CONFIG_COMPUTE_HOSTS"] = ','.join(hosts[1:])
|
||||
|
||||
# We can also override defaults with command line options
|
||||
_set_command_line_values(options)
|
||||
|
|
|
@ -35,22 +35,6 @@ class Controller(object):
|
|||
self.__single = object.__new__(self, *args, **kwargs)
|
||||
return self.__single
|
||||
|
||||
def __init__(self):
|
||||
# Resources that should be copied to each host along with the puppet
|
||||
# files, on the remote host the file will be placed in
|
||||
# $PACKSTACK_VAR_DIR/resources. This controller should copy the files,
|
||||
# for now the puppet plugin is doing it format
|
||||
# {'host':[('/path/to/fileordirectory', 'filenameonremotehost'), ..]}
|
||||
self.resources = {}
|
||||
|
||||
|
||||
def addResource(self, host, localpath, remotename):
|
||||
""" Populates self.resources """
|
||||
current_value_for_host = self.resources.get(host, [])
|
||||
current_value_for_host.append((localpath,remotename))
|
||||
self.resources[host] = current_value_for_host
|
||||
|
||||
|
||||
# PLugins
|
||||
def addPlugin(self, plugObj):
|
||||
self.__PLUGINS.append(plugObj)
|
||||
|
@ -81,7 +65,7 @@ class Controller(object):
|
|||
|
||||
def runAllSequences(self):
|
||||
for sequence in self.__SEQUENCES:
|
||||
sequence.run(self.CONF)
|
||||
sequence.run(config=self.CONF, messages=self.MESSAGES)
|
||||
|
||||
def getSequenceByDesc(self, desc):
|
||||
for sequence in self.getAllSequences():
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
|
||||
def get_mq(config, plugin):
|
||||
return plugin + "_%s.pp" % config.get('CONFIG_AMQP_SERVER')
|
||||
return plugin + "_%s.pp" % config.get('CONFIG_AMQP_BACKEND')
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures amqp
|
||||
"""
|
||||
|
@ -11,38 +13,35 @@ from packstack.installer import basedefs
|
|||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.common import filtered_hosts
|
||||
from packstack.modules.ospluginutils import gethostlist,\
|
||||
getManifestTemplate,\
|
||||
appendManifestFile
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OS-AMQP"
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "AMQP"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding OpenStack AMQP configuration")
|
||||
paramsList = [
|
||||
{"CMD_OPTION" : "amqp-server",
|
||||
"USAGE" : "Set the server for the AMQP service",
|
||||
"PROMPT" : "Set the server for the AMQP service (qpid, rabbitmq)? ",
|
||||
def initConfig(controller):
|
||||
params = [
|
||||
{"CMD_OPTION": "amqp-backend",
|
||||
"USAGE": ("Set the AMQP service backend. Allowed values are: "
|
||||
"qpid, rabbitmq"),
|
||||
"PROMPT": "Set the AMQP service backend",
|
||||
"OPTION_LIST": ["qpid", "rabbitmq"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "rabbitmq",
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME" : "CONFIG_AMQP_SERVER",
|
||||
"CONF_NAME": "CONFIG_AMQP_BACKEND",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "amqp-host",
|
||||
"USAGE" : "The IP address of the server on which to install the AMQP service",
|
||||
"USAGE": ("The IP address of the server on which to install the "
|
||||
"AMQP service"),
|
||||
"PROMPT": "Enter the IP address of the AMQP service",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_ssh],
|
||||
|
@ -53,6 +52,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "amqp-enable-ssl",
|
||||
"USAGE": "Enable SSL for the AMQP service",
|
||||
"PROMPT": "Enable SSL for the AMQP service?",
|
||||
|
@ -65,6 +65,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "amqp-enable-auth",
|
||||
"USAGE": "Enable Authentication for the AMQP service",
|
||||
"PROMPT": "Enable Authentication for the AMQP service?",
|
||||
|
@ -78,20 +79,18 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
|
||||
groupDict = { "GROUP_NAME" : "AMQPLANCE",
|
||||
group = {"GROUP_NAME": "AMQP",
|
||||
"DESCRIPTION": "AMQP Config parameters",
|
||||
"PRE_CONDITION": False,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
controller.addGroup(group, params)
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
|
||||
paramsList = [
|
||||
params = [
|
||||
{"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",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
|
@ -102,8 +101,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "amqp-ssl-port",
|
||||
"USAGE" : "The port in which the AMQP service listens to SSL connections",
|
||||
"USAGE": ("The port in which the AMQP service listens to SSL "
|
||||
"connections"),
|
||||
"PROMPT": "Enter the SSL port for the AMQP service",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
|
@ -114,9 +115,12 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "amqp-ssl-cert-file",
|
||||
"USAGE" : "The filename of the certificate that the AMQP service is going to use",
|
||||
"PROMPT" : "Enter the filename of the SSL certificate for the AMQP service",
|
||||
"USAGE": ("The filename of the certificate that the AMQP service "
|
||||
"is going to use"),
|
||||
"PROMPT": ("Enter the filename of the SSL certificate for the AMQP "
|
||||
"service"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": "/etc/pki/tls/certs/amqp_selfcert.pem",
|
||||
|
@ -126,8 +130,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "amqp-ssl-key-file",
|
||||
"USAGE" : "The filename of the private key that the AMQP service is going to use",
|
||||
"USAGE": ("The filename of the private key that the AMQP service "
|
||||
"is going to use"),
|
||||
"PROMPT": "Enter the private key filename",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
|
@ -138,6 +144,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "amqp-ssl-self-signed",
|
||||
"USAGE": "Auto Generates self signed SSL certificate and key",
|
||||
"PROMPT": "Generate Self Signed SSL Certificate",
|
||||
|
@ -151,17 +158,15 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "AMQPSSL",
|
||||
group = {"GROUP_NAME": "AMQPSSL",
|
||||
"DESCRIPTION": "AMQP Config SSL parameters",
|
||||
"PRE_CONDITION": "CONFIG_AMQP_ENABLE_SSL",
|
||||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
controller.addGroup(group, params)
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
|
||||
paramsList = [
|
||||
params = [
|
||||
{"CMD_OPTION": "amqp-auth-user",
|
||||
"USAGE": "User for amqp authentication",
|
||||
"PROMPT": "Enter the user for amqp authentication",
|
||||
|
@ -174,6 +179,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "amqp-auth-password",
|
||||
"USAGE": "Password for user authentication",
|
||||
"PROMPT": "Enter the password for user authentication",
|
||||
|
@ -186,36 +192,39 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "AMQPAUTH",
|
||||
group = {"GROUP_NAME": "AMQPAUTH",
|
||||
"DESCRIPTION": "AMQP Config Athentication parameters",
|
||||
"PRE_CONDITION": "CONFIG_AMQP_ENABLE_AUTH",
|
||||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
controller.addGroup(group, params)
|
||||
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
|
||||
def initSequences(controller):
|
||||
amqpsteps = [
|
||||
{'title': 'Adding AMQP manifest entries', 'functions':[createmanifest]}
|
||||
{'title': 'Adding AMQP manifest entries',
|
||||
'functions': [create_manifest]}
|
||||
]
|
||||
controller.addSequence("Installing AMQP", [], [], amqpsteps)
|
||||
|
||||
def createmanifest(config):
|
||||
manifestfile = "%s_amqp.pp"%config['CONFIG_AMQP_HOST']
|
||||
manifestdata = ""
|
||||
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_manifest(config, messages):
|
||||
server = utils.ScriptRunner(config['CONFIG_AMQP_HOST'])
|
||||
if config['CONFIG_AMQP_ENABLE_SSL'] == 'y':
|
||||
config['CONFIG_AMQP_ENABLE_SSL'] = 'true'
|
||||
config['CONFIG_AMQP_PROTOCOL'] = 'ssl'
|
||||
config['CONFIG_AMQP_CLIENTS_PORT'] = "5671"
|
||||
if config['CONFIG_AMQP_SSL_SELF_SIGNED'] == 'y':
|
||||
server.append( "openssl req -batch -new -x509 -nodes -keyout %s -out %s -days 1095"
|
||||
% (config['CONFIG_AMQP_SSL_KEY_FILE'], config['CONFIG_AMQP_SSL_CERT_FILE']) )
|
||||
server.append(
|
||||
"openssl req -batch -new -x509 -nodes -keyout %s "
|
||||
"-out %s -days 1095"
|
||||
% (config['CONFIG_AMQP_SSL_KEY_FILE'],
|
||||
config['CONFIG_AMQP_SSL_CERT_FILE'])
|
||||
)
|
||||
server.execute()
|
||||
else:
|
||||
# Set default values
|
||||
|
@ -231,6 +240,7 @@ def createmanifest(config):
|
|||
config['CONFIG_AMQP_AUTH_PASSWORD'] = 'guest'
|
||||
config['CONFIG_AMQP_AUTH_USER'] = 'guest'
|
||||
|
||||
manifestfile = "%s_amqp.pp" % config['CONFIG_AMQP_HOST']
|
||||
manifestdata = getManifestTemplate('amqp.pp')
|
||||
|
||||
# All hosts should be able to talk to amqp
|
||||
|
|
|
@ -14,67 +14,49 @@ from packstack.modules.shortcuts import get_mq
|
|||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "OS-Ceilometer"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding OpenStack Ceilometer configuration")
|
||||
|
||||
def initConfig(controller):
|
||||
ceilometer_params = {
|
||||
"CEILOMETER": [
|
||||
{"CMD_OPTION" : "ceilometer-host",
|
||||
"USAGE" : ("The IP address of the server on which "
|
||||
"to install Ceilometer"),
|
||||
"PROMPT" : ("Enter the IP address of the Ceilometer "
|
||||
"server"),
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_CEILOMETER_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False},
|
||||
{"CMD_OPTION" : "ceilometer-secret",
|
||||
"USAGE" : "Secret key for signing metering messages.",
|
||||
{"CONF_NAME": "CONFIG_CEILOMETER_SECRET",
|
||||
"CMD_OPTION": "ceilometer-secret",
|
||||
"USAGE": "Secret key for signing metering messages",
|
||||
"PROMPT": "Enter the Ceilometer secret key",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME" : "CONFIG_CEILOMETER_SECRET",
|
||||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "ceilometer-ks-passwd",
|
||||
"USAGE" : "The password to use for Ceilometer to authenticate with Keystone",
|
||||
|
||||
{"CONF_NAME": "CONFIG_CEILOMETER_KS_PW",
|
||||
"CMD_OPTION": "ceilometer-ks-passwd",
|
||||
"USAGE": ("The password to use for Ceilometer to authenticate "
|
||||
"with Keystone"),
|
||||
"PROMPT": "Enter the password for the Ceilometer Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME" : "CONFIG_CEILOMETER_KS_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"MONGODB": [
|
||||
{"CMD_OPTION": "mongodb-host",
|
||||
"USAGE" : ("The IP address of the server on which "
|
||||
"to install mongodb"),
|
||||
"PROMPT" : ("Enter the IP address of the mongodb server"),
|
||||
"USAGE": ("The IP address of the server on which to install "
|
||||
"MongoDB"),
|
||||
"PROMPT": "Enter the IP address of the MongoDB server",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_ssh],
|
||||
"DEFAULT_VALUE": utils.get_localhost_ip(),
|
||||
|
@ -94,6 +76,7 @@ def initConfig(controllerObject):
|
|||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "MONGODB",
|
||||
"DESCRIPTION": "MONGODB Config parameters",
|
||||
"PRE_CONDITION": "CONFIG_CEILOMETER_INSTALL",
|
||||
|
@ -101,11 +84,11 @@ def initConfig(controllerObject):
|
|||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
]
|
||||
|
||||
for group in ceilometer_groups:
|
||||
paramList = ceilometer_params[group["GROUP_NAME"]]
|
||||
controller.addGroup(group, paramList)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
if controller.CONF['CONFIG_CEILOMETER_INSTALL'] != 'y':
|
||||
return
|
||||
|
@ -120,10 +103,13 @@ def initSequences(controller):
|
|||
steps)
|
||||
|
||||
|
||||
def create_manifest(config):
|
||||
manifestfile = "%s_ceilometer.pp" % config['CONFIG_CEILOMETER_HOST']
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_manifest(config, messages):
|
||||
manifestfile = "%s_ceilometer.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate(get_mq(config, "ceilometer"))
|
||||
manifestdata += getManifestTemplate("ceilometer.pp")
|
||||
|
||||
config['FIREWALL_ALLOWED'] = "'ALL'"
|
||||
config['FIREWALL_SERVICE_NAME'] = 'ceilometer-api'
|
||||
config['FIREWALL_SERVICE_ID'] = 'ceilometer_api'
|
||||
|
@ -136,16 +122,18 @@ def create_manifest(config):
|
|||
manifestdata += getManifestTemplate("ceilometer_nova_disabled.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
def create_mongodb_manifest(config):
|
||||
|
||||
def create_mongodb_manifest(config, messages):
|
||||
manifestfile = "%s_mongodb.pp" % config['CONFIG_MONGODB_HOST']
|
||||
manifestdata = getManifestTemplate("mongodb.pp")
|
||||
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CEILOMETER_HOST']
|
||||
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST']
|
||||
config['FIREWALL_SERVICE_NAME'] = 'mongodb-server'
|
||||
config['FIREWALL_PORTS'] = "'27017'"
|
||||
manifestdata += getManifestTemplate("firewall.pp")
|
||||
appendManifestFile(manifestfile, manifestdata, 'pre')
|
||||
|
||||
def create_keystone_manifest(config):
|
||||
manifestfile = "%s_keystone.pp" % config['CONFIG_KEYSTONE_HOST']
|
||||
|
||||
def create_keystone_manifest(config, messages):
|
||||
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("keystone_ceilometer.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures Cinder
|
||||
"""
|
||||
|
@ -15,39 +17,23 @@ from packstack.installer.utils import split_hosts
|
|||
from packstack.installer import basedefs
|
||||
from packstack.installer import utils
|
||||
|
||||
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
from packstack.installer import exceptions
|
||||
from packstack.installer import output_messages
|
||||
|
||||
# Controller object will
|
||||
# be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "OS-Cinder"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding OpenStack Cinder configuration")
|
||||
paramsList = [
|
||||
{"CMD_OPTION" : "cinder-host",
|
||||
"USAGE" : "The IP address of the server on which to install Cinder",
|
||||
"PROMPT" : "Enter the IP address of the Cinder server",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_CINDER_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
def initConfig(controller):
|
||||
params = [
|
||||
{"CMD_OPTION": "cinder-db-passwd",
|
||||
"USAGE": "The password to use for the Cinder to access DB",
|
||||
"PROMPT": "Enter the password for the Cinder DB access",
|
||||
|
@ -60,8 +46,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "cinder-ks-passwd",
|
||||
"USAGE" : "The password to use for the Cinder to authenticate with Keystone",
|
||||
"USAGE": ("The password to use for the Cinder to authenticate with "
|
||||
"Keystone"),
|
||||
"PROMPT": "Enter the password for the Cinder Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
|
@ -72,11 +60,12 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "cinder-backend",
|
||||
"USAGE" : ("The Cinder backend to use, valid options are: "
|
||||
"lvm, gluster, nfs, vmdk"),
|
||||
"USAGE": ("The Cinder backend to use, valid options are: lvm, "
|
||||
"gluster, nfs"),
|
||||
"PROMPT": "Enter the Cinder backend to be configured",
|
||||
"OPTION_LIST" : ["lvm", "gluster", "nfs", "vmdk"],
|
||||
"OPTION_LIST": ["lvm", "gluster", "nfs"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "lvm",
|
||||
"MASK_INPUT": False,
|
||||
|
@ -86,28 +75,26 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "CINDER",
|
||||
group = {"GROUP_NAME": "CINDER",
|
||||
"DESCRIPTION": "Cinder Config parameters",
|
||||
"PRE_CONDITION": "CONFIG_CINDER_INSTALL",
|
||||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, params)
|
||||
|
||||
def check_lvm_options(config):
|
||||
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
|
||||
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'lvm')
|
||||
|
||||
paramsList = [
|
||||
params = [
|
||||
{"CMD_OPTION": "cinder-volumes-create",
|
||||
"USAGE" : ("Create Cinder's volumes group. This should only be done for "
|
||||
"testing on a proof-of-concept installation of Cinder. This "
|
||||
"will create a file-backed volume group and is not suitable "
|
||||
"for production usage."),
|
||||
"PROMPT" : ("Should Cinder's volumes group be created (for proof-of-concept "
|
||||
"installation)?"),
|
||||
"USAGE": ("Create Cinder's volumes group. This should only be done "
|
||||
"for testing on a proof-of-concept installation of Cinder. "
|
||||
"This will create a file-backed volume group and is not "
|
||||
"suitable for production usage."),
|
||||
"PROMPT": ("Should Cinder's volumes group be created (for "
|
||||
"proof-of-concept installation)?"),
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "y",
|
||||
|
@ -118,22 +105,20 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "CINDERVOLUMECREATE",
|
||||
group = {"GROUP_NAME": "CINDERVOLUMECREATE",
|
||||
"DESCRIPTION": "Cinder volume create Config parameters",
|
||||
"PRE_CONDITION": check_lvm_options,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, params)
|
||||
|
||||
def check_lvm_vg_options(config):
|
||||
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
|
||||
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'lvm' and
|
||||
config.get('CONFIG_CINDER_VOLUMES_CREATE', 'y') == 'y')
|
||||
|
||||
paramsList = [
|
||||
params = [
|
||||
{"CMD_OPTION": "cinder-volumes-size",
|
||||
"USAGE": ("Cinder's volumes group size. Note that actual volume size "
|
||||
"will be extended with 3% more space for VG metadata."),
|
||||
|
@ -148,27 +133,25 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "CINDERVOLUMESIZE",
|
||||
group = {"GROUP_NAME": "CINDERVOLUMESIZE",
|
||||
"DESCRIPTION": "Cinder volume size Config parameters",
|
||||
"PRE_CONDITION": check_lvm_vg_options,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, params)
|
||||
|
||||
def check_gluster_options(config):
|
||||
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
|
||||
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'gluster')
|
||||
|
||||
paramsList = [
|
||||
params = [
|
||||
{"CMD_OPTION": "cinder-gluster-mounts",
|
||||
"USAGE": ("A single or comma separated list of gluster volume shares "
|
||||
"to mount, eg: ip-address:/vol-name, domain:/vol-name "),
|
||||
"PROMPT": ("Enter a single or comma separated list of gluster volume "
|
||||
"shares to use with Cinder"),
|
||||
"OPTION_LIST" : ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'", \
|
||||
"OPTION_LIST": ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'",
|
||||
"^'[a-zA-Z0-9][\-\.\w]*:/.*'"],
|
||||
"VALIDATORS": [validators.validate_multi_regexp],
|
||||
"PROCESSORS": [processors.process_add_quotes_around_values],
|
||||
|
@ -180,21 +163,19 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "CINDERGLUSTERMOUNTS",
|
||||
group = {"GROUP_NAME": "CINDERGLUSTERMOUNTS",
|
||||
"DESCRIPTION": "Cinder gluster Config parameters",
|
||||
"PRE_CONDITION": check_gluster_options,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, params)
|
||||
|
||||
def check_nfs_options(config):
|
||||
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
|
||||
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'nfs')
|
||||
|
||||
paramsList = [
|
||||
params = [
|
||||
{"CMD_OPTION": "cinder-nfs-mounts",
|
||||
"USAGE": ("A single or comma seprated list of NFS exports to mount, "
|
||||
"eg: ip-address:/export-name "),
|
||||
|
@ -211,15 +192,13 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "CINDERNFSMOUNTS",
|
||||
group = {"GROUP_NAME": "CINDERNFSMOUNTS",
|
||||
"DESCRIPTION": "Cinder NFS Config parameters",
|
||||
"PRE_CONDITION": check_nfs_options,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, params)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
|
@ -227,30 +206,40 @@ def initSequences(controller):
|
|||
return
|
||||
|
||||
cinder_steps = [
|
||||
{'title': 'Installing dependencies for Cinder', 'functions':[install_cinder_deps]},
|
||||
{'title': 'Adding Cinder Keystone manifest entries', 'functions':[create_keystone_manifest]},
|
||||
{'title': 'Adding Cinder manifest entries', 'functions':[create_manifest]}
|
||||
{'title': 'Installing dependencies for Cinder',
|
||||
'functions': [install_cinder_deps]},
|
||||
{'title': 'Adding Cinder Keystone manifest entries',
|
||||
'functions': [create_keystone_manifest]},
|
||||
{'title': 'Adding Cinder manifest entries',
|
||||
'functions': [create_manifest]}
|
||||
]
|
||||
|
||||
if controller.CONF['CONFIG_CINDER_BACKEND'] == 'lvm':
|
||||
cinder_steps.append({'title': 'Checking if the Cinder server has a cinder-volumes vg', 'functions':[check_cinder_vg]})
|
||||
cinder_steps.append(
|
||||
{'title': 'Checking if the Cinder server has a cinder-volumes vg',
|
||||
'functions': [check_cinder_vg]})
|
||||
controller.addSequence("Installing OpenStack Cinder", [], [], cinder_steps)
|
||||
|
||||
def install_cinder_deps(config):
|
||||
server = utils.ScriptRunner(config['CONFIG_CINDER_HOST'])
|
||||
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def install_cinder_deps(config, messages):
|
||||
server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
|
||||
pkgs = []
|
||||
if config['CONFIG_CINDER_BACKEND'] == 'lvm':
|
||||
pkgs.append('lvm2')
|
||||
for p in pkgs:
|
||||
server.append("rpm -q --whatprovides %(package)s || yum install -y %(package)s" % dict(package=p))
|
||||
server.append("rpm -q --whatprovides %(package)s || "
|
||||
"yum install -y %(package)s" % dict(package=p))
|
||||
server.execute()
|
||||
|
||||
def check_cinder_vg(config):
|
||||
|
||||
def check_cinder_vg(config, messages):
|
||||
cinders_volume = 'cinder-volumes'
|
||||
|
||||
# Do we have a cinder-volumes vg?
|
||||
have_cinders_volume = False
|
||||
server = utils.ScriptRunner(config['CONFIG_CINDER_HOST'])
|
||||
server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
|
||||
server.append('vgdisplay %s' % cinders_volume)
|
||||
try:
|
||||
server.execute()
|
||||
|
@ -259,7 +248,7 @@ def check_cinder_vg(config):
|
|||
pass
|
||||
|
||||
# Configure system LVM settings (snapshot_autoextend)
|
||||
server = utils.ScriptRunner(config['CONFIG_CINDER_HOST'])
|
||||
server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
|
||||
server.append('sed -i -r "s/^ *snapshot_autoextend_threshold +=.*/'
|
||||
' snapshot_autoextend_threshold = 80/" '
|
||||
'/etc/lvm/lvm.conf')
|
||||
|
@ -271,18 +260,18 @@ def check_cinder_vg(config):
|
|||
except exceptions.ScriptRuntimeError:
|
||||
logging.info("Warning: Unable to set system LVM settings.")
|
||||
|
||||
|
||||
if config["CONFIG_CINDER_VOLUMES_CREATE"] != "y":
|
||||
if not have_cinders_volume:
|
||||
raise exceptions.MissingRequirements("The cinder server should "
|
||||
" contain a cinder-volumes volume group")
|
||||
"contain a cinder-volumes "
|
||||
"volume group")
|
||||
else:
|
||||
if have_cinders_volume:
|
||||
controller.MESSAGES.append(
|
||||
messages.append(
|
||||
output_messages.INFO_CINDER_VOLUMES_EXISTS)
|
||||
return
|
||||
|
||||
server = utils.ScriptRunner(config['CONFIG_CINDER_HOST'])
|
||||
server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
|
||||
server.append('systemctl')
|
||||
try:
|
||||
server.execute()
|
||||
|
@ -292,8 +281,6 @@ def check_cinder_vg(config):
|
|||
|
||||
server.clear()
|
||||
logging.info("A new cinder volumes group will be created")
|
||||
err = "Cinder's volume group '%s' could not be created" % \
|
||||
cinders_volume
|
||||
|
||||
cinders_volume_path = '/var/lib/cinder'
|
||||
server.append('mkdir -p %s' % cinders_volume_path)
|
||||
|
@ -338,26 +325,27 @@ def check_cinder_vg(config):
|
|||
# fails.
|
||||
try:
|
||||
logging.debug("Release loop device, volume creation failed")
|
||||
server = utils.ScriptRunner(controller.CONF['CONFIG_CINDER_HOST'])
|
||||
server.append('losetup -d $(losetup -j %s | cut -d : -f 1)' %
|
||||
cinders_volume_path
|
||||
)
|
||||
server = utils.ScriptRunner(config['CONFIG_CONTROLLER_HOST'])
|
||||
server.append('losetup -d $(losetup -j %s | cut -d : -f 1)'
|
||||
% cinders_volume_path)
|
||||
server.execute()
|
||||
except:
|
||||
pass
|
||||
|
||||
raise exceptions.MissingRequirements(err)
|
||||
raise exceptions.MissingRequirements("Cinder's volume group '%s' "
|
||||
"could not be created"
|
||||
% cinders_volume)
|
||||
|
||||
|
||||
def create_keystone_manifest(config):
|
||||
manifestfile = "%s_keystone.pp" % controller.CONF['CONFIG_KEYSTONE_HOST']
|
||||
def create_keystone_manifest(config, messages):
|
||||
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("keystone_cinder.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def create_manifest(config):
|
||||
def create_manifest(config, messages):
|
||||
manifestdata = getManifestTemplate(get_mq(config, "cinder"))
|
||||
manifestfile = "%s_cinder.pp" % controller.CONF['CONFIG_CINDER_HOST']
|
||||
manifestfile = "%s_cinder.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata += getManifestTemplate("cinder.pp")
|
||||
|
||||
if config['CONFIG_CINDER_BACKEND'] == "gluster":
|
||||
|
@ -369,15 +357,15 @@ def create_manifest(config):
|
|||
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
|
||||
manifestdata += getManifestTemplate('cinder_ceilometer.pp')
|
||||
if config['CONFIG_SWIFT_INSTALL'] == 'y':
|
||||
config['CONFIG_SWIFT_PROXY'] = config['CONFIG_SWIFT_PROXY_HOSTS'].split(',')[0].strip()
|
||||
manifestdata += getManifestTemplate('cinder_backup.pp')
|
||||
|
||||
config['FIREWALL_SERVICE_NAME'] = "cinder"
|
||||
config['FIREWALL_PORTS'] = "'3260', '8776'"
|
||||
config['FIREWALL_CHAIN'] = "INPUT"
|
||||
|
||||
if (config['CONFIG_NOVA_INSTALL'] == 'y' and config['CONFIG_VMWARE_BACKEND']=='n'):
|
||||
for host in split_hosts(config['CONFIG_NOVA_COMPUTE_HOSTS']):
|
||||
if (config['CONFIG_NOVA_INSTALL'] == 'y' and
|
||||
config['CONFIG_VMWARE_BACKEND'] == 'n'):
|
||||
for host in split_hosts(config['CONFIG_COMPUTE_HOSTS']):
|
||||
config['FIREWALL_ALLOWED'] = "'%s'" % host
|
||||
config['FIREWALL_SERVICE_ID'] = "cinder_%s" % host
|
||||
manifestdata += getManifestTemplate("firewall.pp")
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
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 utils
|
||||
|
||||
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OS-HORIZON"
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "OS-Horizon"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding OpenStack Horizon configuration")
|
||||
paramsList = [
|
||||
{"CMD_OPTION" : "os-horizon-host",
|
||||
"USAGE" : "The IP address of the server on which to install Horizon",
|
||||
"PROMPT" : "Enter the IP address of the Horizon server",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_HORIZON_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
def initConfig(controller):
|
||||
params = [
|
||||
{"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",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -52,20 +38,23 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "OSHORIZON",
|
||||
group = {"GROUP_NAME": "OSHORIZON",
|
||||
"DESCRIPTION": "OpenStack Horizon Config parameters",
|
||||
"PRE_CONDITION": "CONFIG_HORIZON_INSTALL",
|
||||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
controller.addGroup(group, params)
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
|
||||
paramsList = [
|
||||
params = [
|
||||
{"CMD_OPTION": "os-ssl-cert",
|
||||
"USAGE" : "PEM encoded certificate to be used for ssl on the https server, leave blank if one should be generated, this certificate should not require a passphrase",
|
||||
"PROMPT" : "Enter the path to a PEM encoded certificate to be used on the https server, leave blank if one should be generated, this certificate should not require a passphrase",
|
||||
"USAGE": ("PEM encoded certificate to be used for ssl on the https "
|
||||
"server, leave blank if one should be generated, this "
|
||||
"certificate should not require a passphrase"),
|
||||
"PROMPT": ("Enter the path to a PEM encoded certificate to be used "
|
||||
"on the https server, leave blank if one should be "
|
||||
"generated, this certificate should not require "
|
||||
"a passphrase"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": '',
|
||||
|
@ -75,9 +64,12 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-ssl-key",
|
||||
"USAGE" : "Keyfile corresponding to the certificate if one was entered",
|
||||
"PROMPT" : "Enter the keyfile corresponding to the certificate if one was entered",
|
||||
"USAGE": ("SSL keyfile corresponding to the certificate if one was "
|
||||
"entered"),
|
||||
"PROMPT": ("Enter the SSL keyfile corresponding to the certificate "
|
||||
"if one was entered"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -88,15 +80,13 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "OSSSL",
|
||||
group = {"GROUP_NAME": "OSSSL",
|
||||
"DESCRIPTION": "SSL Config parameters",
|
||||
"PRE_CONDITION": "CONFIG_HORIZON_SSL",
|
||||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, params)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
|
@ -104,28 +94,31 @@ def initSequences(controller):
|
|||
return
|
||||
|
||||
steps = [
|
||||
{'title': 'Adding Horizon manifest entries', 'functions': [createmanifest]}
|
||||
{'title': 'Adding Horizon manifest entries',
|
||||
'functions': [create_manifest]}
|
||||
]
|
||||
controller.addSequence("Installing OpenStack Horizon", [], [], steps)
|
||||
|
||||
|
||||
def createmanifest(config):
|
||||
controller.CONF["CONFIG_HORIZON_SECRET_KEY"] = uuid.uuid4().hex
|
||||
horizon_host = controller.CONF['CONFIG_HORIZON_HOST']
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_manifest(config, messages):
|
||||
config["CONFIG_HORIZON_SECRET_KEY"] = uuid.uuid4().hex
|
||||
horizon_host = config['CONFIG_CONTROLLER_HOST']
|
||||
manifestfile = "%s_horizon.pp" % horizon_host
|
||||
|
||||
proto = "http"
|
||||
controller.CONF["CONFIG_HORIZON_PORT"] = "'80'"
|
||||
config["CONFIG_HORIZON_PORT"] = "'80'"
|
||||
sslmanifestdata = ''
|
||||
if controller.CONF["CONFIG_HORIZON_SSL"] == 'y':
|
||||
controller.CONF["CONFIG_HORIZON_PORT"] = "'443'"
|
||||
if config["CONFIG_HORIZON_SSL"] == 'y':
|
||||
config["CONFIG_HORIZON_PORT"] = "'443'"
|
||||
proto = "https"
|
||||
sslmanifestdata += getManifestTemplate("https.pp")
|
||||
|
||||
# Are we using the users cert/key files
|
||||
if controller.CONF["CONFIG_SSL_CERT"]:
|
||||
ssl_cert = controller.CONF["CONFIG_SSL_CERT"]
|
||||
ssl_key = controller.CONF["CONFIG_SSL_KEY"]
|
||||
if config["CONFIG_SSL_CERT"]:
|
||||
ssl_cert = config["CONFIG_SSL_CERT"]
|
||||
ssl_key = config["CONFIG_SSL_KEY"]
|
||||
|
||||
if not os.path.exists(ssl_cert):
|
||||
raise exceptions.ParamValidationError(
|
||||
|
@ -135,13 +128,13 @@ def createmanifest(config):
|
|||
raise exceptions.ParamValidationError(
|
||||
"The file %s doesn't exist" % ssl_key)
|
||||
|
||||
controller.addResource(horizon_host, ssl_cert, 'ssl_ps_server.crt')
|
||||
resources = config.setdefault('RESOURCES', {})
|
||||
host_resources = resources.setdefault(horizon_host, [])
|
||||
host_resources.append((ssl_cert, 'ssl_ps_server.crt'))
|
||||
if ssl_key:
|
||||
controller.addResource(
|
||||
horizon_host, ssl_key, 'ssl_ps_server.key'
|
||||
)
|
||||
host_resources.append(ssl_key, 'ssl_ps_server.key')
|
||||
else:
|
||||
controller.MESSAGES.append(
|
||||
messages.append(
|
||||
"%sNOTE%s : A certificate was generated to be used for ssl, "
|
||||
"You should change the ssl certificate configured in "
|
||||
"/etc/httpd/conf.d/ssl.conf on %s to use a CA signed cert."
|
||||
|
@ -151,8 +144,8 @@ def createmanifest(config):
|
|||
manifestdata += sslmanifestdata
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
msg = "To access the OpenStack Dashboard browse to %s://%s/dashboard .\n" \
|
||||
"Please, find your login credentials stored in the keystonerc_admin" \
|
||||
" in your home directory." % \
|
||||
(proto, controller.CONF['CONFIG_HORIZON_HOST'])
|
||||
controller.MESSAGES.append(msg)
|
||||
msg = ("To access the OpenStack Dashboard browse to %s://%s/dashboard .\n"
|
||||
"Please, find your login credentials stored in the keystonerc_admin"
|
||||
" in your home directory."
|
||||
% (proto, config['CONFIG_CONTROLLER_HOST']))
|
||||
messages.append(msg)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures Glance
|
||||
"""
|
||||
|
@ -11,34 +13,17 @@ from packstack.installer import utils
|
|||
from packstack.installer.utils import split_hosts
|
||||
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OS-Glance"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding OpenStack Glance configuration")
|
||||
paramsList = [
|
||||
{"CMD_OPTION" : "glance-host",
|
||||
"USAGE" : "The IP address of the server on which to install Glance",
|
||||
"PROMPT" : "Enter the IP address of the Glance server",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_GLANCE_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
def initConfig(controller):
|
||||
params = [
|
||||
{"CMD_OPTION": "glance-db-passwd",
|
||||
"USAGE": "The password to use for the Glance to access DB",
|
||||
"PROMPT": "Enter the password for the Glance DB access",
|
||||
|
@ -51,8 +36,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "glance-ks-passwd",
|
||||
"USAGE" : "The password to use for the Glance to authenticate with Keystone",
|
||||
"USAGE": ("The password to use for the Glance to authenticate "
|
||||
"with Keystone"),
|
||||
"PROMPT": "Enter the password for the Glance Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
|
@ -64,15 +51,13 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "GLANCE",
|
||||
group = {"GROUP_NAME": "GLANCE",
|
||||
"DESCRIPTION": "Glance Config parameters",
|
||||
"PRE_CONDITION": "CONFIG_GLANCE_INSTALL",
|
||||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, params)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
|
@ -84,27 +69,34 @@ def initSequences(controller):
|
|||
return
|
||||
|
||||
glancesteps = [
|
||||
{'title': 'Adding Glance Keystone manifest entries', 'functions':[createkeystonemanifest]},
|
||||
{'title': 'Adding Glance manifest entries', 'functions':[createmanifest]}
|
||||
{'title': 'Adding Glance Keystone manifest entries',
|
||||
'functions': [create_keystone_manifest]},
|
||||
{'title': 'Adding Glance manifest entries',
|
||||
'functions': [create_manifest]}
|
||||
]
|
||||
controller.addSequence("Installing OpenStack Glance", [], [], glancesteps)
|
||||
|
||||
def createkeystonemanifest(config):
|
||||
manifestfile = "%s_keystone.pp" % controller.CONF['CONFIG_KEYSTONE_HOST']
|
||||
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_keystone_manifest(config, messages):
|
||||
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("keystone_glance.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
def createmanifest(config):
|
||||
manifestfile = "%s_glance.pp" % controller.CONF['CONFIG_GLANCE_HOST']
|
||||
|
||||
def create_manifest(config, messages):
|
||||
manifestfile = "%s_glance.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("glance.pp")
|
||||
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
|
||||
manifestdata += getManifestTemplate(get_mq(config, "glance_ceilometer"))
|
||||
mq_template = get_mq(config, "glance_ceilometer")
|
||||
manifestdata += getManifestTemplate(mq_template)
|
||||
|
||||
config['FIREWALL_SERVICE_NAME'] = "glance"
|
||||
config['FIREWALL_PORTS'] = "'9292'"
|
||||
config['FIREWALL_CHAIN'] = "INPUT"
|
||||
if config['CONFIG_NOVA_INSTALL'] == 'y':
|
||||
for host in split_hosts(config['CONFIG_NOVA_COMPUTE_HOSTS']):
|
||||
for host in split_hosts(config['CONFIG_COMPUTE_HOSTS']):
|
||||
config['FIREWALL_ALLOWED'] = "'%s'" % host
|
||||
config['FIREWALL_SERVICE_ID'] = "glance_%s" % host
|
||||
manifestdata += getManifestTemplate("firewall.pp")
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures heat
|
||||
"""
|
||||
|
@ -14,36 +16,18 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
|
|||
manifestfiles,
|
||||
appendManifestFile)
|
||||
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OS-HEAT"
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "OS-Heat"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding OpenStack Heat configuration")
|
||||
def initConfig(controller):
|
||||
parameters = [
|
||||
{"CMD_OPTION" : "heat-host",
|
||||
"USAGE" : ('The IP address of the server on which '
|
||||
'to install Heat service'),
|
||||
"PROMPT" : 'Enter the IP address of the Heat service',
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_HEAT_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
|
||||
{"CMD_OPTION" : "heat-mysql-password",
|
||||
"USAGE" : 'The password used by Heat user to authenticate against MySQL',
|
||||
{"CMD_OPTION": "os-heat-mysql-password",
|
||||
"USAGE": ('The password used by Heat user to authenticate against '
|
||||
'MySQL'),
|
||||
"PROMPT": "Enter the password for the Heat MySQL user",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
|
@ -56,8 +40,10 @@ def initConfig(controllerObject):
|
|||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "heat-auth-encryption-key",
|
||||
"USAGE" : "The encryption key to use for authentication info in database",
|
||||
"PROMPT" : "Enter the authentication key for Heat to use for authenticate info in database",
|
||||
"USAGE": ("The encryption key to use for authentication info "
|
||||
"in database"),
|
||||
"PROMPT": ("Enter the authentication key for Heat to use for "
|
||||
"authenticate info in database"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
|
@ -68,8 +54,9 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION" : "heat-ks-passwd",
|
||||
"USAGE" : "The password to use for the Heat to authenticate with Keystone",
|
||||
{"CMD_OPTION": "os-heat-ks-passwd",
|
||||
"USAGE": ("The password to use for the Heat to authenticate "
|
||||
"with Keystone"),
|
||||
"PROMPT": "Enter the password for the Heat Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
|
@ -82,8 +69,8 @@ def initConfig(controllerObject):
|
|||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-heat-cloudwatch-install",
|
||||
"USAGE" : ("Set to 'y' if you would like Packstack to "
|
||||
"install Heat CloudWatch API"),
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install Heat "
|
||||
"CloudWatch API"),
|
||||
"PROMPT": "Should Packstack install Heat CloudWatch API",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -96,8 +83,8 @@ def initConfig(controllerObject):
|
|||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-heat-cfn-install",
|
||||
"USAGE" : ("Set to 'y' if you would like Packstack to "
|
||||
"install Heat CloudFormation API"),
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install Heat "
|
||||
"CloudFormation API"),
|
||||
"PROMPT": "Should Packstack install Heat CloudFormation API",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -117,113 +104,53 @@ def initConfig(controllerObject):
|
|||
"POST_CONDITION_MATCH": True}
|
||||
controller.addGroup(group, parameters)
|
||||
|
||||
parameters = [
|
||||
{"CMD_OPTION" : "heat-api-cloudwatch-host",
|
||||
"USAGE" : ('The IP address of the server on which '
|
||||
'to install Heat CloudWatch API service'),
|
||||
"PROMPT" : ('Enter the IP address of the Heat CloudWatch API '
|
||||
'server'),
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_HEAT_CLOUDWATCH_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
]
|
||||
|
||||
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):
|
||||
if controller.CONF['CONFIG_HEAT_INSTALL'] != 'y':
|
||||
config = controller.CONF
|
||||
if config['CONFIG_HEAT_INSTALL'] != 'y':
|
||||
return
|
||||
steps = [{'title': 'Adding Heat manifest entries',
|
||||
steps = [
|
||||
{'title': 'Adding Heat manifest entries',
|
||||
'functions': [create_manifest]},
|
||||
{'title': 'Adding Heat Keystone manifest entries',
|
||||
'functions':[create_keystone_manifest]}]
|
||||
'functions': [create_keystone_manifest]}
|
||||
]
|
||||
|
||||
if controller.CONF.get('CONFIG_HEAT_CLOUDWATCH_INSTALL', 'n') == 'y':
|
||||
steps.append({'title': 'Adding Heat CloudWatch API manifest entries',
|
||||
if config.get('CONFIG_HEAT_CLOUDWATCH_INSTALL', 'n') == 'y':
|
||||
steps.append(
|
||||
{'title': 'Adding Heat CloudWatch API manifest entries',
|
||||
'functions': [create_cloudwatch_manifest]})
|
||||
if controller.CONF.get('CONFIG_HEAT_CFN_INSTALL', 'n') == 'y':
|
||||
steps.append({'title': 'Adding Heat CloudFormation API manifest entries',
|
||||
if config.get('CONFIG_HEAT_CFN_INSTALL', 'n') == 'y':
|
||||
steps.append(
|
||||
{'title': 'Adding Heat CloudFormation API manifest entries',
|
||||
'functions': [create_cfn_manifest]})
|
||||
controller.addSequence("Installing Heat", [], [], steps)
|
||||
|
||||
|
||||
def create_manifest(config):
|
||||
if config['CONFIG_HEAT_CLOUDWATCH_INSTALL'] == 'y':
|
||||
config['CONFIG_HEAT_WATCH_HOST'] = config['CONFIG_HEAT_CLOUDWATCH_HOST']
|
||||
else:
|
||||
config['CONFIG_HEAT_WATCH_HOST'] = config['CONFIG_HEAT_HOST']
|
||||
if config['CONFIG_HEAT_CFN_INSTALL'] == 'y':
|
||||
config['CONFIG_HEAT_METADATA_HOST'] = config['CONFIG_HEAT_CFN_HOST']
|
||||
else:
|
||||
config['CONFIG_HEAT_METADATA_HOST'] = config['CONFIG_HEAT_HOST']
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
manifestfile = "%s_heat.pp" % controller.CONF['CONFIG_HEAT_HOST']
|
||||
def create_manifest(config, messages):
|
||||
manifestfile = "%s_heat.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate(get_mq(config, "heat"))
|
||||
manifestdata += getManifestTemplate("heat.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def create_keystone_manifest(config):
|
||||
manifestfile = "%s_keystone.pp" % controller.CONF['CONFIG_KEYSTONE_HOST']
|
||||
def create_keystone_manifest(config, messages):
|
||||
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("keystone_heat.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def create_cloudwatch_manifest(config):
|
||||
manifestfile = "%s_heatcw.pp" % controller.CONF['CONFIG_HEAT_CLOUDWATCH_HOST']
|
||||
def create_cloudwatch_manifest(config, messages):
|
||||
manifestfile = "%s_heatcw.pp" % controller.CONF['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate(get_mq(config, "heat"))
|
||||
manifestdata += getManifestTemplate("heat_cloudwatch.pp")
|
||||
appendManifestFile(manifestfile, manifestdata, marker='heat')
|
||||
|
||||
|
||||
def create_cfn_manifest(config):
|
||||
manifestfile = "%s_heatcnf.pp" % controller.CONF['CONFIG_HEAT_CFN_HOST']
|
||||
def create_cfn_manifest(config, messages):
|
||||
manifestfile = "%s_heatcnf.pp" % controller.CONF['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate(get_mq(config, "heat"))
|
||||
manifestdata += getManifestTemplate("heat_cfn.pp")
|
||||
appendManifestFile(manifestfile, manifestdata, marker='heat')
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures Keystone
|
||||
"""
|
||||
|
@ -9,35 +11,18 @@ from packstack.installer import validators
|
|||
from packstack.installer import basedefs
|
||||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
|
||||
from packstack.installer.utils import host_iter
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "OS-Keystone"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding OpenStack Keystone configuration")
|
||||
paramsList = [
|
||||
{"CMD_OPTION" : "keystone-host",
|
||||
"USAGE" : "The IP address of the server on which to install Keystone",
|
||||
"PROMPT" : "Enter the IP address of the Keystone server",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_KEYSTONE_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
def initConfig(controller):
|
||||
params = [
|
||||
{"CMD_OPTION": "keystone-db-passwd",
|
||||
"USAGE": "The password to use for the Keystone to access DB",
|
||||
"PROMPT": "Enter the password for the Keystone DB access",
|
||||
|
@ -50,6 +35,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "keystone-admin-token",
|
||||
"USAGE": "The token to use for the Keystone service api",
|
||||
"PROMPT": "The token to use for the Keystone service api",
|
||||
|
@ -62,6 +48,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "keystone-admin-passwd",
|
||||
"USAGE": "The password to use for the Keystone admin user",
|
||||
"PROMPT": "Enter the password for the Keystone admin user",
|
||||
|
@ -74,6 +61,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "keystone-demo-passwd",
|
||||
"USAGE": "The password to use for the Keystone demo user",
|
||||
"PROMPT": "Enter the password for the Keystone demo user",
|
||||
|
@ -86,6 +74,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "keystone-token-format",
|
||||
"USAGE": "Kestone token format. Use either UUID or PKI",
|
||||
"PROMPT": "Enter the Keystone token format.",
|
||||
|
@ -99,15 +88,13 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "KEYSTONE",
|
||||
group = {"GROUP_NAME": "KEYSTONE",
|
||||
"DESCRIPTION": "Keystone Config parameters",
|
||||
"PRE_CONDITION": lambda x: 'yes',
|
||||
"PRE_CONDITION_MATCH": "yes",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, params)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
|
@ -118,13 +105,18 @@ def initSequences(controller):
|
|||
controller.addSequence("Installing OpenStack Keystone", [], [],
|
||||
keystonesteps)
|
||||
|
||||
def create_manifest(config):
|
||||
manifestfile = "%s_keystone.pp" % config['CONFIG_KEYSTONE_HOST']
|
||||
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_manifest(config, messages):
|
||||
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("keystone.pp")
|
||||
|
||||
config['FIREWALL_ALLOWED'] = "'ALL'"
|
||||
config['FIREWALL_SERVICE_NAME'] = "keystone"
|
||||
config['FIREWALL_SERVICE_ID'] = "keystone"
|
||||
config['FIREWALL_PORTS'] = "'5000', '35357'"
|
||||
config['FIREWALL_CHAIN'] = "INPUT"
|
||||
manifestdata += getManifestTemplate("firewall.pp")
|
||||
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures MySQL
|
||||
"""
|
||||
|
@ -9,24 +11,22 @@ from packstack.installer import validators
|
|||
from packstack.installer import utils
|
||||
from packstack.installer.utils import split_hosts
|
||||
|
||||
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OS-MySQL"
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "MySQL"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding MySQL OpenStack configuration")
|
||||
paramsList = [
|
||||
def initConfig(controller):
|
||||
params = [
|
||||
{"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",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_ssh],
|
||||
|
@ -37,6 +37,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "mysql-user",
|
||||
"USAGE": "Username for the MySQL admin user",
|
||||
"PROMPT": "Enter the username for the MySQL admin user",
|
||||
|
@ -49,6 +50,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "mysql-pw",
|
||||
"USAGE": "Password for the MySQL admin user",
|
||||
"PROMPT": "Enter the password for the MySQL admin user",
|
||||
|
@ -62,26 +64,26 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "MYSQL",
|
||||
group = {"GROUP_NAME": "MYSQL",
|
||||
"DESCRIPTION": "MySQL Config parameters",
|
||||
"PRE_CONDITION": lambda x: 'yes',
|
||||
"PRE_CONDITION_MATCH": "yes",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, params)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
mysqlsteps = [
|
||||
{'title': 'Adding MySQL manifest entries',
|
||||
'functions':[createmanifest]}
|
||||
'functions': [create_manifest]}
|
||||
]
|
||||
controller.addSequence("Installing MySQL", [], [], mysqlsteps)
|
||||
|
||||
|
||||
def createmanifest(config):
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_manifest(config, messages):
|
||||
if config['CONFIG_MYSQL_INSTALL'] == 'y':
|
||||
install = True
|
||||
suffix = 'install'
|
||||
|
@ -89,11 +91,7 @@ def createmanifest(config):
|
|||
install = False
|
||||
suffix = 'noinstall'
|
||||
|
||||
# In case we are not installing MySQL server, mysql* manifests have
|
||||
# to be run from Keystone host
|
||||
host = install and config['CONFIG_MYSQL_HOST'] \
|
||||
or config['CONFIG_KEYSTONE_HOST']
|
||||
manifestfile = "%s_mysql.pp" % host
|
||||
manifestfile = "%s_mysql.pp" % config['CONFIG_MYSQL_HOST']
|
||||
manifestdata = [getManifestTemplate('mysql_%s.pp' % suffix)]
|
||||
|
||||
def append_for(module, suffix):
|
||||
|
@ -104,28 +102,12 @@ def createmanifest(config):
|
|||
manifestdata.append(getManifestTemplate(template))
|
||||
|
||||
append_for("keystone", suffix)
|
||||
hosts = set()
|
||||
for mod in ['nova', 'cinder', 'glance', 'neutron', 'heat']:
|
||||
if config['CONFIG_%s_INSTALL' % mod.upper()] == 'y':
|
||||
append_for(mod, suffix)
|
||||
# Check wich modules are enabled so we can allow their
|
||||
# hosts on the firewall
|
||||
if mod != 'nova' and mod != 'neutron':
|
||||
hosts.add(config.get('CONFIG_%s_HOST' % mod.upper()).strip())
|
||||
elif mod == 'neutron':
|
||||
hosts.add(config.get('CONFIG_NEUTRON_SERVER_HOST').strip())
|
||||
elif config['CONFIG_NOVA_INSTALL'] != 'n':
|
||||
#In that remote case that we have lot's of nova hosts
|
||||
hosts.add(config.get('CONFIG_NOVA_API_HOST').strip())
|
||||
hosts.add(config.get('CONFIG_NOVA_CERT_HOST').strip())
|
||||
hosts.add(config.get('CONFIG_NOVA_VNCPROXY_HOST').strip())
|
||||
hosts.add(config.get('CONFIG_NOVA_CONDUCTOR_HOST').strip())
|
||||
hosts.add(config.get('CONFIG_NOVA_SCHED_HOST').strip())
|
||||
if config['CONFIG_NEUTRON_INSTALL'] != 'y':
|
||||
dbhosts = split_hosts(config['CONFIG_NOVA_NETWORK_HOSTS'])
|
||||
hosts |= dbhosts
|
||||
for host in config.get('CONFIG_NOVA_COMPUTE_HOSTS').split(','):
|
||||
hosts.add(host.strip())
|
||||
|
||||
hosts = set([config['CONFIG_CONTROLLER_HOST']])
|
||||
hosts |= split_hosts(config['CONFIG_COMPUTE_HOSTS'])
|
||||
|
||||
config['FIREWALL_SERVICE_NAME'] = "mysql"
|
||||
config['FIREWALL_PORTS'] = "'3306'"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures Nagios
|
||||
"""
|
||||
|
@ -10,36 +12,18 @@ from packstack.installer import basedefs, output_messages
|
|||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.common import filtered_hosts
|
||||
from packstack.modules.ospluginutils import gethostlist,\
|
||||
getManifestTemplate,\
|
||||
appendManifestFile
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "OS-Nagios"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding OpenStack Nagios configuration")
|
||||
paramsList = [
|
||||
{"CMD_OPTION" : "nagios-host",
|
||||
"USAGE" : "The IP address of the server on which to install the Nagios server",
|
||||
"PROMPT" : "Enter the IP address of the Nagios server",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_NAGIOS_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
def initConfig(controller):
|
||||
params = [
|
||||
{"CMD_OPTION": "nagios-passwd",
|
||||
"USAGE": "The password of the nagiosadmin user on the Nagios server",
|
||||
"PROMPT": "Enter the password for the nagiosadmin user",
|
||||
|
@ -53,29 +37,30 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "NAGIOS",
|
||||
group = {"GROUP_NAME": "NAGIOS",
|
||||
"DESCRIPTION": "Nagios Config parameters",
|
||||
"PRE_CONDITION": "CONFIG_NAGIOS_INSTALL",
|
||||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, params)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
conf = controller.CONF
|
||||
if conf['CONFIG_NAGIOS_INSTALL'] != 'y':
|
||||
if controller.CONF['CONFIG_NAGIOS_INSTALL'] != 'y':
|
||||
return
|
||||
|
||||
nagiossteps = [
|
||||
{'title': 'Adding Nagios server manifest entries', 'functions':[createmanifest]},
|
||||
{'title': 'Adding Nagios host manifest entries', 'functions':[createnrpemanifests]}
|
||||
{'title': 'Adding Nagios server manifest entries',
|
||||
'functions': [create_manifest]},
|
||||
{'title': 'Adding Nagios host manifest entries',
|
||||
'functions': [create_nrpe_manifests]}
|
||||
]
|
||||
controller.addSequence("Installing Nagios", [], [], nagiossteps)
|
||||
|
||||
|
||||
#------------------------- helper functions -------------------------
|
||||
|
||||
def _serviceentry(**kwargs):
|
||||
s = 'define service {\n'
|
||||
for key in sorted(kwargs.keys()):
|
||||
|
@ -83,6 +68,7 @@ def _serviceentry(**kwargs):
|
|||
s += "\t}\n"
|
||||
return s
|
||||
|
||||
|
||||
def _copy_script(**kwargs):
|
||||
# TODO : Replace all these shell templates with with python
|
||||
return ('file{"/usr/lib64/nagios/plugins/%(name)s":'
|
||||
|
@ -93,6 +79,7 @@ def _copy_script(**kwargs):
|
|||
'command_line => "/usr/lib64/nagios/plugins/%(name)s",}\n'
|
||||
% kwargs)
|
||||
|
||||
|
||||
def nagios_host(hostname, **kwargs):
|
||||
out = ("nagios_host { '%s': " % hostname)
|
||||
for key, value in kwargs.items():
|
||||
|
@ -100,61 +87,83 @@ def nagios_host(hostname, **kwargs):
|
|||
return "%s}\n" % out
|
||||
|
||||
|
||||
def createmanifest(config):
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_manifest(config, messages):
|
||||
manifest_entries = ''
|
||||
# I should be adding service entries with nagios_service but it appears to be broken
|
||||
# http://projects.puppetlabs.com/issues/3420
|
||||
# I should be adding service entries with nagios_service
|
||||
# but it appears to be broken http://projects.puppetlabs.com/issues/3420
|
||||
service_entries = ''
|
||||
for hostname in gethostlist(config):
|
||||
manifest_entries += nagios_host(hostname, address=hostname, use='linux-server')
|
||||
for hostname in filtered_hosts(config):
|
||||
manifest_entries += nagios_host(hostname, address=hostname,
|
||||
use='linux-server')
|
||||
|
||||
service_entries += _serviceentry(name='load5-%s'%hostname, service_description='5 minute load average',
|
||||
host_name=hostname, check_command="check_nrpe!load5", use="generic-service",
|
||||
normal_check_interval='5')
|
||||
service_entries += _serviceentry(
|
||||
name='load5-%s' % hostname,
|
||||
service_description='5 minute load average',
|
||||
host_name=hostname,
|
||||
check_command="check_nrpe!load5",
|
||||
use="generic-service",
|
||||
normal_check_interval='5'
|
||||
)
|
||||
|
||||
service_entries += _serviceentry(name='df_var-%s'%hostname,
|
||||
service_entries += _serviceentry(
|
||||
name='df_var-%s' % hostname,
|
||||
service_description='Percent disk space used on /var',
|
||||
host_name=hostname,
|
||||
check_command="check_nrpe!df_var", use="generic-service")
|
||||
check_command="check_nrpe!df_var",
|
||||
use="generic-service"
|
||||
)
|
||||
|
||||
manifest_entries += _copy_script(name="keystone-user-list")
|
||||
service_entries += _serviceentry(name='keystone-user-list',
|
||||
service_entries += _serviceentry(
|
||||
name='keystone-user-list',
|
||||
service_description='number of keystone users',
|
||||
host_name=controller.CONF['CONFIG_NAGIOS_HOST'],
|
||||
check_command="keystone-user-list", use="generic-service",
|
||||
normal_check_interval='5')
|
||||
host_name=config['CONFIG_CONTROLLER_HOST'],
|
||||
check_command="keystone-user-list",
|
||||
use="generic-service",
|
||||
normal_check_interval='5'
|
||||
)
|
||||
|
||||
if controller.CONF['CONFIG_GLANCE_INSTALL'] == 'y':
|
||||
if config['CONFIG_GLANCE_INSTALL'] == 'y':
|
||||
manifest_entries += _copy_script(name="glance-index")
|
||||
service_entries += _serviceentry(name='glance-index',
|
||||
service_entries += _serviceentry(
|
||||
name='glance-index',
|
||||
service_description='number of glance images',
|
||||
host_name=controller.CONF['CONFIG_NAGIOS_HOST'],
|
||||
host_name=config['CONFIG_CONTROLLER_HOST'],
|
||||
check_command="glance-index", use="generic-service",
|
||||
normal_check_interval='5')
|
||||
normal_check_interval='5'
|
||||
)
|
||||
|
||||
if controller.CONF['CONFIG_NOVA_INSTALL'] == 'y':
|
||||
if config['CONFIG_NOVA_INSTALL'] == 'y':
|
||||
manifest_entries += _copy_script(name="nova-list")
|
||||
service_entries += _serviceentry(name='nova-list',
|
||||
service_entries += _serviceentry(
|
||||
name='nova-list',
|
||||
service_description='number of nova vm instances',
|
||||
host_name=controller.CONF['CONFIG_NAGIOS_HOST'],
|
||||
host_name=config['CONFIG_CONTROLLER_HOST'],
|
||||
check_command="nova-list", use="generic-service",
|
||||
normal_check_interval='5')
|
||||
normal_check_interval='5'
|
||||
)
|
||||
|
||||
if controller.CONF['CONFIG_CINDER_INSTALL'] == 'y':
|
||||
if config['CONFIG_CINDER_INSTALL'] == 'y':
|
||||
manifest_entries += _copy_script(name="cinder-list")
|
||||
service_entries += _serviceentry(name='cinder-list',
|
||||
service_entries += _serviceentry(
|
||||
name='cinder-list',
|
||||
service_description='number of cinder volumes',
|
||||
host_name=controller.CONF['CONFIG_NAGIOS_HOST'],
|
||||
host_name=config['CONFIG_CONTROLLER_HOST'],
|
||||
check_command="cinder-list", use="generic-service",
|
||||
normal_check_interval='5')
|
||||
normal_check_interval='5'
|
||||
)
|
||||
|
||||
if controller.CONF['CONFIG_SWIFT_INSTALL'] == 'y':
|
||||
if config['CONFIG_SWIFT_INSTALL'] == 'y':
|
||||
manifest_entries += _copy_script(name="swift-list")
|
||||
service_entries += _serviceentry(name='swift-list',
|
||||
service_entries += _serviceentry(
|
||||
name='swift-list',
|
||||
service_description='number of swift containers',
|
||||
host_name=controller.CONF['CONFIG_NAGIOS_HOST'],
|
||||
host_name=config['CONFIG_CONTROLLER_HOST'],
|
||||
check_command="swift-list", use="generic-service",
|
||||
normal_check_interval='5')
|
||||
normal_check_interval='5'
|
||||
)
|
||||
|
||||
manifest_entries += ("file { '/etc/nagios/nagios_service.cfg': \n"
|
||||
"ensure => present, mode => 644,\n"
|
||||
|
@ -162,19 +171,20 @@ def createmanifest(config):
|
|||
"before => Service['nagios'],\n"
|
||||
"content => '%s'}" % service_entries)
|
||||
|
||||
controller.CONF['CONFIG_NAGIOS_MANIFEST_CONFIG'] = manifest_entries
|
||||
config['CONFIG_NAGIOS_MANIFEST_CONFIG'] = manifest_entries
|
||||
|
||||
manifestfile = "%s_nagios.pp" % controller.CONF['CONFIG_NAGIOS_HOST']
|
||||
manifestfile = "%s_nagios.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("nagios_server.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
def createnrpemanifests(config):
|
||||
for hostname in filtered_hosts(controller.CONF):
|
||||
controller.CONF['CONFIG_NRPE_HOST'] = hostname
|
||||
|
||||
def create_nrpe_manifests(config, messages):
|
||||
for hostname in filtered_hosts(config):
|
||||
config['CONFIG_NRPE_HOST'] = hostname
|
||||
manifestfile = "%s_nagios_nrpe.pp" % hostname
|
||||
manifestdata = getManifestTemplate("nagios_nrpe.pp")
|
||||
# Only the Nagios host is allowed to talk to nrpe
|
||||
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_NAGIOS_HOST']
|
||||
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST']
|
||||
config['FIREWALL_SERVICE_NAME'] = "nagios-nrpe"
|
||||
config['FIREWALL_SERVICE_ID'] = "nagios_nrpe"
|
||||
config['FIREWALL_PORTS'] = '5666'
|
||||
|
@ -182,7 +192,7 @@ def createnrpemanifests(config):
|
|||
manifestdata += getManifestTemplate("firewall.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
controller.MESSAGES.append("To use Nagios, browse to http://%s/nagios "
|
||||
"username : nagiosadmin, password : %s" %
|
||||
(controller.CONF['CONFIG_NAGIOS_HOST'],
|
||||
controller.CONF['CONFIG_NAGIOS_PW']))
|
||||
messages.append("To use Nagios, browse to "
|
||||
"http://%(CONFIG_CONTROLLER_HOST)s/nagios "
|
||||
"username: nagiosadmin, password: %(CONFIG_NAGIOS_PW)s"
|
||||
% config)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures neutron
|
||||
"""
|
||||
|
@ -12,38 +14,22 @@ from packstack.installer import validators
|
|||
from packstack.installer.utils import split_hosts
|
||||
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OS-NEUTRON"
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
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 = {
|
||||
"NEUTRON": [
|
||||
{"CMD_OPTION" : "neutron-server-host",
|
||||
"USAGE" : "The IP addresses of the server on which to install the Neutron server",
|
||||
"PROMPT" : "Enter the IP address of the Neutron server",
|
||||
"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",
|
||||
{"CMD_OPTION": "os-neutron-ks-password",
|
||||
"USAGE": ("The password to use for Neutron to authenticate "
|
||||
"with Keystone"),
|
||||
"PROMPT": "Enter the password for Neutron Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
|
@ -54,7 +40,8 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "neutron-db-password",
|
||||
|
||||
{"CMD_OPTION": "os-neutron-db-password",
|
||||
"USAGE": "The password to use for Neutron to access DB",
|
||||
"PROMPT": "Enter the password for Neutron DB access",
|
||||
"OPTION_LIST": [],
|
||||
|
@ -66,21 +53,14 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "neutron-l3-hosts",
|
||||
"USAGE" : "A comma separated list of IP addresses on which to install Neutron L3 agent",
|
||||
"PROMPT" : "Enter a comma separated list of IP addresses on which to install the Neutron L3 agent",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_multi_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"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",
|
||||
|
||||
{"CMD_OPTION": "os-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": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": "br-ex",
|
||||
|
@ -90,33 +70,11 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "neutron-dhcp-hosts",
|
||||
"USAGE" : "A comma separated list of IP addresses on which to install Neutron DHCP agent",
|
||||
"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",
|
||||
|
||||
{"CMD_OPTION": "os-neutron-l2-plugin",
|
||||
"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"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "openvswitch",
|
||||
|
@ -126,21 +84,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "neutron-metadata-hosts",
|
||||
"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" : [],
|
||||
"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",
|
||||
|
||||
{"CMD_OPTION": "os-neutron-metadata-pw",
|
||||
"USAGE": "Neutron metadata agent password",
|
||||
"PROMPT": "Enter Neutron metadata agent password",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
|
@ -150,11 +97,28 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"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": [
|
||||
{"CMD_OPTION" : "neutron-lb-tenant-network-type",
|
||||
"USAGE" : "The type of network to allocate for tenant networks (eg. vlan, local)",
|
||||
"PROMPT" : "Enter the type of network to allocate for tenant networks",
|
||||
{"CMD_OPTION": "os-neutron-lb-tenant-network-type",
|
||||
"USAGE": ("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"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "local",
|
||||
|
@ -164,9 +128,13 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": 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)",
|
||||
"PROMPT" : "Enter a comma separated list of VLAN ranges for the Neutron linuxbridge plugin",
|
||||
|
||||
{"CMD_OPTION": "os-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)"),
|
||||
"PROMPT": ("Enter a comma separated list of VLAN ranges for "
|
||||
"the Neutron linuxbridge plugin"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -177,10 +145,14 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"NEUTRON_LB_PLUGIN_AND_AGENT": [
|
||||
{"CMD_OPTION" : "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)",
|
||||
"PROMPT" : "Enter a comma separated list of interface mappings for the Neutron linuxbridge plugin",
|
||||
{"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)"),
|
||||
"PROMPT": ("Enter a comma separated list of interface mappings "
|
||||
"for the Neutron linuxbridge plugin"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -191,10 +163,13 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"NEUTRON_OVS_PLUGIN": [
|
||||
{"CMD_OPTION" : "neutron-ovs-tenant-network-type",
|
||||
"USAGE" : "Type of network to allocate for tenant networks (eg. vlan, local, gre, vxlan)",
|
||||
"PROMPT" : "Enter the type of network to allocate for tenant networks",
|
||||
{"CMD_OPTION": "os-neutron-ovs-tenant-network-type",
|
||||
"USAGE": ("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"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "local",
|
||||
|
@ -204,9 +179,13 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": 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)",
|
||||
"PROMPT" : "Enter a comma separated list of VLAN ranges for the Neutron openvswitch plugin",
|
||||
|
||||
{"CMD_OPTION": "os-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)"),
|
||||
"PROMPT": ("Enter a comma separated list of VLAN ranges for the "
|
||||
"Neutron openvswitch plugin"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -217,10 +196,14 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"NEUTRON_OVS_PLUGIN_AND_AGENT": [
|
||||
{"CMD_OPTION" : "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)",
|
||||
"PROMPT" : "Enter a comma separated list of bridge mappings for the Neutron openvswitch plugin",
|
||||
{"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)"),
|
||||
"PROMPT": ("Enter a comma separated list of bridge mappings for "
|
||||
"the Neutron openvswitch plugin"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -230,9 +213,13 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": 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.",
|
||||
"PROMPT" : "Enter a comma separated list of OVS bridge:interface pairs for the Neutron openvswitch plugin",
|
||||
|
||||
{"CMD_OPTION": "os-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."),
|
||||
"PROMPT": ("Enter a comma separated list of OVS bridge:interface "
|
||||
"pairs for the Neutron openvswitch plugin"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -243,10 +230,13 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"NEUTRON_OVS_PLUGIN_TUNNEL": [
|
||||
{"CMD_OPTION" : "neutron-ovs-tunnel-ranges",
|
||||
"USAGE" : "A comma separated list of tunnel ranges for the Neutron openvswitch plugin (eg. 1:1000)",
|
||||
"PROMPT" : "Enter a comma separated list of tunnel ranges for the Neutron openvswitch plugin",
|
||||
{"CMD_OPTION": "os-neutron-ovs-tunnel-ranges",
|
||||
"USAGE": ("A comma separated list of tunnel ranges for the "
|
||||
"Neutron openvswitch plugin (eg. 1:1000)"),
|
||||
"PROMPT": ("Enter a comma separated list of tunnel ranges for "
|
||||
"the Neutron openvswitch plugin"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -257,10 +247,15 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"NEUTRON_OVS_PLUGIN_AND_AGENT_TUNNEL": [
|
||||
{"CMD_OPTION" : "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) ",
|
||||
"PROMPT" : "Enter interface with IP to override the default tunnel local_ip",
|
||||
{"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)"),
|
||||
"PROMPT": ("Enter interface with IP to override the default "
|
||||
"tunnel local_ip"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -271,8 +266,9 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"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",
|
||||
"USAGE": "VXLAN UDP port",
|
||||
"PROMPT": "Enter VXLAN UDP port number",
|
||||
|
@ -286,14 +282,15 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"NEUTRON_ML2_PLUGIN": [
|
||||
{"CMD_OPTION" : "neutron-ml2-type-drivers",
|
||||
{"CMD_OPTION": "os-neutron-ml2-type-drivers",
|
||||
"CONF_NAME": "CONFIG_NEUTRON_ML2_TYPE_DRIVERS",
|
||||
"USAGE" : ("A comma separated list of network type "
|
||||
"driver entrypoints to be loaded from the "
|
||||
"USAGE": ("A comma separated list of network type driver "
|
||||
"entrypoints to be loaded from the "
|
||||
"neutron.ml2.type_drivers namespace."),
|
||||
"PROMPT" : ("Enter a comma separated list of network "
|
||||
"type driver entrypoints"),
|
||||
"PROMPT": ("Enter a comma separated list of network type driver "
|
||||
"entrypoints"),
|
||||
"OPTION_LIST": ["local", "flat", "vlan", "gre", "vxlan"],
|
||||
"VALIDATORS": [validators.validate_multi_options],
|
||||
"DEFAULT_VALUE": "local",
|
||||
|
@ -302,16 +299,15 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": 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",
|
||||
"USAGE" : ("A comma separated ordered list of "
|
||||
"network_types to allocate as tenant "
|
||||
"networks. The value 'local' is only useful "
|
||||
"for single-box testing but provides no "
|
||||
"USAGE": ("A comma separated ordered list of network_types to "
|
||||
"allocate as tenant networks. The value 'local' is "
|
||||
"only useful for single-box testing but provides no "
|
||||
"connectivity between hosts."),
|
||||
"PROMPT": ("Enter a comma separated ordered list of "
|
||||
"network_types to allocate as tenant "
|
||||
"networks"),
|
||||
"network_types to allocate as tenant networks"),
|
||||
"OPTION_LIST": ["local", "vlan", "gre", "vxlan"],
|
||||
"VALIDATORS": [validators.validate_multi_options],
|
||||
"DEFAULT_VALUE": "local",
|
||||
|
@ -320,17 +316,17 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "neutron-ml2-mechanism-drivers",
|
||||
|
||||
{"CMD_OPTION": "os-neutron-ml2-mechanism-drivers",
|
||||
"CONF_NAME": "CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS",
|
||||
"USAGE" : ("A comma separated ordered list of "
|
||||
"networking mechanism driver entrypoints "
|
||||
"to be loaded from the "
|
||||
"USAGE": ("A comma separated ordered list of networking "
|
||||
"mechanism driver entrypoints to be loaded from the "
|
||||
"neutron.ml2.mechanism_drivers namespace."),
|
||||
"PROMPT" : ("Enter a comma separated ordered list of "
|
||||
"networking mechanism driver entrypoints"),
|
||||
"OPTION_LIST" : ["logger", "test", "linuxbridge",
|
||||
"openvswitch", "hyperv", "ncs", "arista",
|
||||
"cisco_nexus", "l2population"],
|
||||
"PROMPT": ("Enter a comma separated ordered list of networking "
|
||||
"mechanism driver entrypoints"),
|
||||
"OPTION_LIST": ["logger", "test", "linuxbridge", "openvswitch",
|
||||
"hyperv", "ncs", "arista", "cisco_nexus",
|
||||
"l2population"],
|
||||
"VALIDATORS": [validators.validate_multi_options],
|
||||
"DEFAULT_VALUE": "openvswitch",
|
||||
"MASK_INPUT": False,
|
||||
|
@ -338,15 +334,15 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "neutron-ml2-flat-networks",
|
||||
|
||||
{"CMD_OPTION": "os-neutron-ml2-flat-networks",
|
||||
"CONF_NAME": "CONFIG_NEUTRON_ML2_FLAT_NETWORKS",
|
||||
"USAGE" : ("A comma separated list of physical_network"
|
||||
" names with which flat networks can be "
|
||||
"created. Use * to allow flat networks with "
|
||||
"arbitrary physical_network names."),
|
||||
"PROMPT" : ("Enter a comma separated list of "
|
||||
"physical_network names with which flat "
|
||||
"networks can be created"),
|
||||
"USAGE": ("A comma separated list of physical_network names "
|
||||
"with which flat networks can be created. Use * to "
|
||||
"allow flat networks with arbitrary physical_network "
|
||||
"names."),
|
||||
"PROMPT": ("Enter a comma separated list of physical_network "
|
||||
"names with which flat networks can be created"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "*",
|
||||
|
@ -355,17 +351,17 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "neutron-ml2-vlan-ranges",
|
||||
|
||||
{"CMD_OPTION": "os-neutron-ml2-vlan-ranges",
|
||||
"CONF_NAME": "CONFIG_NEUTRON_ML2_VLAN_RANGES",
|
||||
"USAGE" : ("A comma separated list of "
|
||||
"<physical_network>:<vlan_min>:<vlan_max> "
|
||||
"or <physical_network> specifying "
|
||||
"physical_network names usable for VLAN "
|
||||
"provider and tenant networks, as well as "
|
||||
"ranges of VLAN tags on each available for "
|
||||
"allocation to tenant networks."),
|
||||
"PROMPT" : ("Enter a comma separated list of "
|
||||
"physical_network names usable for VLAN"),
|
||||
"USAGE": ("A comma separated list of <physical_network>:"
|
||||
"<vlan_min>:<vlan_max> or <physical_network> "
|
||||
"specifying physical_network names usable for VLAN "
|
||||
"provider and tenant networks, as well as ranges of "
|
||||
"VLAN tags on each available for allocation to tenant "
|
||||
"networks."),
|
||||
"PROMPT": ("Enter a comma separated list of physical_network "
|
||||
"names usable for VLAN"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -374,17 +370,16 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": 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",
|
||||
"USAGE" : ("A comma separated list of <tun_min>:"
|
||||
"<tun_max> tuples enumerating ranges of GRE "
|
||||
"tunnel IDs that are available for tenant "
|
||||
"network allocation. Should be an array with"
|
||||
" tun_max +1 - tun_min > 1000000"),
|
||||
"PROMPT" : ("Enter a comma separated list of <tun_min>:"
|
||||
"<tun_max> tuples enumerating ranges of GRE "
|
||||
"tunnel IDs that are available for tenant "
|
||||
"network allocation"),
|
||||
"USAGE": ("A comma separated list of <tun_min>:<tun_max> tuples "
|
||||
"enumerating ranges of GRE tunnel IDs that are "
|
||||
"available for tenant network allocation. Should be "
|
||||
"an array with tun_max +1 - tun_min > 1000000"),
|
||||
"PROMPT": ("Enter a comma separated list of <tun_min>:<tun_max> "
|
||||
"tuples enumerating ranges of GRE tunnel IDs that "
|
||||
"are available for tenant network allocation"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -393,14 +388,14 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "neutron-ml2-vxlan-group",
|
||||
|
||||
{"CMD_OPTION": "os-neutron-ml2-vxlan-group",
|
||||
"CONF_NAME": "CONFIG_NEUTRON_ML2_VXLAN_GROUP",
|
||||
"USAGE" : ("Multicast group for VXLAN. If unset, "
|
||||
"disables VXLAN enable sending allocate "
|
||||
"broadcast traffic to this multicast group. "
|
||||
"When left unconfigured, will disable "
|
||||
"multicast VXLAN mode. Should be an "
|
||||
"Multicast IP (v4 or v6) address."),
|
||||
"USAGE": ("Multicast group for VXLAN. If unset, disables VXLAN "
|
||||
"enable sending allocate broadcast traffic to this "
|
||||
"multicast group. When left unconfigured, will disable "
|
||||
"multicast VXLAN mode. Should be an Multicast IP "
|
||||
"(v4 or v6) address."),
|
||||
"PROMPT": "Enter a multicast group for VXLAN",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
|
@ -410,17 +405,16 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "neutron-ml2-vni-ranges",
|
||||
|
||||
{"CMD_OPTION": "os-neutron-ml2-vni-ranges",
|
||||
"CONF_NAME": "CONFIG_NEUTRON_ML2_VNI_RANGES",
|
||||
"USAGE" : ("A comma separated list of <vni_min>:"
|
||||
"<vni_max> tuples enumerating ranges of "
|
||||
"VXLAN VNI IDs that are available for tenant"
|
||||
" network allocation. Min value is 0 and Max"
|
||||
" value is 16777215."),
|
||||
"PROMPT" : ("Enter a comma separated list of <vni_min>:"
|
||||
"<vni_max> tuples enumerating ranges of "
|
||||
"VXLAN VNI IDs that are available for tenant"
|
||||
" network allocation"),
|
||||
"USAGE": ("A comma separated list of <vni_min>:<vni_max> tuples "
|
||||
"enumerating ranges of VXLAN VNI IDs that are "
|
||||
"available for tenant network allocation. Min value "
|
||||
"is 0 and Max value is 16777215."),
|
||||
"PROMPT": ("Enter a comma separated list of <vni_min>:<vni_max> "
|
||||
"tuples enumerating ranges of VXLAN VNI IDs that are "
|
||||
"available for tenant network allocation"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -429,9 +423,12 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": 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",
|
||||
"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"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "openvswitch",
|
||||
|
@ -480,7 +477,8 @@ def initConfig(controllerObject):
|
|||
return use_openvswitch_plugin(config) or use_ml2_with_ovs(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):
|
||||
ovs_vxlan = (
|
||||
|
@ -493,7 +491,6 @@ def initConfig(controllerObject):
|
|||
)
|
||||
return ovs_vxlan or ml2_vxlan
|
||||
|
||||
|
||||
conf_groups = [
|
||||
{"GROUP_NAME": "NEUTRON",
|
||||
"DESCRIPTION": "Neutron config",
|
||||
|
@ -501,48 +498,56 @@ def initConfig(controllerObject):
|
|||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "NEUTRON_ML2_PLUGIN",
|
||||
"DESCRIPTION": "Neutron ML2 plugin config",
|
||||
"PRE_CONDITION": use_ml2_plugin,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "NEUTRON_LB_PLUGIN",
|
||||
"DESCRIPTION": "Neutron LB plugin config",
|
||||
"PRE_CONDITION": use_linuxbridge_plugin,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "NEUTRON_LB_PLUGIN_AND_AGENT",
|
||||
"DESCRIPTION": "Neutron LB agent config",
|
||||
"PRE_CONDITION": use_linuxbridge_agent,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "NEUTRON_OVS_PLUGIN",
|
||||
"DESCRIPTION": "Neutron OVS plugin config",
|
||||
"PRE_CONDITION": use_openvswitch_plugin,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "NEUTRON_OVS_PLUGIN_AND_AGENT",
|
||||
"DESCRIPTION": "Neutron OVS agent config",
|
||||
"PRE_CONDITION": use_openvswitch_agent,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "NEUTRON_OVS_PLUGIN_TUNNEL",
|
||||
"DESCRIPTION": "Neutron OVS plugin config for tunnels",
|
||||
"PRE_CONDITION": use_openvswitch_plugin_tunnel,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "NEUTRON_OVS_PLUGIN_AND_AGENT_TUNNEL",
|
||||
"DESCRIPTION": "Neutron OVS agent config for tunnels",
|
||||
"PRE_CONDITION": use_openvswitch_agent_tunnel,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "NEUTRON_OVS_PLUGIN_AND_AGENT_VXLAN",
|
||||
"DESCRIPTION": "Neutron OVS agent config for VXLAN",
|
||||
"PRE_CONDITION": use_openvswitch_vxlan,
|
||||
|
@ -550,18 +555,9 @@ def initConfig(controllerObject):
|
|||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
]
|
||||
|
||||
for group in conf_groups:
|
||||
paramList = conf_params[group["GROUP_NAME"]]
|
||||
controller.addGroup(group, paramList)
|
||||
|
||||
|
||||
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'
|
||||
params = conf_params[group["GROUP_NAME"]]
|
||||
controller.addGroup(group, params)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
|
@ -595,16 +591,13 @@ def initSequences(controller):
|
|||
config['CONFIG_NEUTRON_L2_DBNAME'] = plugin_db
|
||||
config['CONFIG_NEUTRON_CORE_PLUGIN'] = plugin_path
|
||||
|
||||
global api_hosts, l3_hosts, dhcp_hosts, lbaas_hosts, compute_hosts, meta_hosts, q_hosts
|
||||
api_hosts = split_hosts(config['CONFIG_NEUTRON_SERVER_HOST'])
|
||||
l3_hosts = split_hosts(config['CONFIG_NEUTRON_L3_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'])
|
||||
global api_hosts, network_hosts, compute_hosts, q_hosts
|
||||
api_hosts = split_hosts(config['CONFIG_CONTROLLER_HOST'])
|
||||
network_hosts = split_hosts(config['CONFIG_NETWORK_HOSTS'])
|
||||
compute_hosts = set()
|
||||
if config['CONFIG_NOVA_INSTALL'] == 'y':
|
||||
compute_hosts = split_hosts(config['CONFIG_NOVA_COMPUTE_HOSTS'])
|
||||
q_hosts = api_hosts | l3_hosts | dhcp_hosts | lbaas_hosts | compute_hosts | meta_hosts
|
||||
compute_hosts = split_hosts(config['CONFIG_COMPUTE_HOSTS'])
|
||||
q_hosts = api_hosts | network_hosts | compute_hosts
|
||||
|
||||
neutron_steps = [
|
||||
{'title': 'Adding Neutron API manifest entries',
|
||||
|
@ -626,11 +619,45 @@ def initSequences(controller):
|
|||
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
|
||||
|
||||
service_plugins = []
|
||||
if config['CONFIG_NEUTRON_LBAAS_HOSTS']:
|
||||
if config['CONFIG_LBAAS_INSTALL'] == 'y':
|
||||
service_plugins.append(
|
||||
'neutron.services.loadbalancer.plugin.LoadBalancerPlugin'
|
||||
)
|
||||
|
@ -639,7 +666,6 @@ def create_manifests(config):
|
|||
service_plugins.append(
|
||||
'neutron.services.l3_router.l3_router_plugin.L3RouterPlugin'
|
||||
)
|
||||
|
||||
config['SERVICE_PLUGINS'] = (str(service_plugins) if service_plugins
|
||||
else 'undef')
|
||||
|
||||
|
@ -651,15 +677,6 @@ def create_manifests(config):
|
|||
elif config['CONFIG_NEUTRON_L2_PLUGIN'] == 'ml2':
|
||||
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_PORTS'] = "'9696'"
|
||||
config['FIREWALL_CHAIN'] = "INPUT"
|
||||
|
@ -676,9 +693,10 @@ def create_manifests(config):
|
|||
manifest_data += getManifestTemplate("neutron_notifications.pp")
|
||||
|
||||
# Firewall Rules
|
||||
for f_host in allowed_hosts:
|
||||
for f_host in q_hosts:
|
||||
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")
|
||||
|
||||
appendManifestFile(manifest_file, manifest_data, 'neutron')
|
||||
|
@ -689,44 +707,39 @@ def create_manifests(config):
|
|||
appendManifestFile(manifest_file, manifest_data, 'neutron')
|
||||
|
||||
|
||||
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_neutron.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def find_mapping(haystack, needle):
|
||||
return needle in [x.split(':')[1].strip() for x in get_values(haystack)]
|
||||
|
||||
|
||||
def create_l3_manifests(config):
|
||||
global l3_hosts
|
||||
def create_l3_manifests(config, messages):
|
||||
global network_hosts
|
||||
|
||||
plugin = config['CONFIG_NEUTRON_L2_PLUGIN']
|
||||
if config['CONFIG_NEUTRON_L3_EXT_BRIDGE'] == 'provider':
|
||||
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_INTERFACE_DRIVER'] = get_if_driver(config)
|
||||
manifestdata = getManifestTemplate("neutron_l3.pp")
|
||||
manifestfile = "%s_neutron.pp" % (host,)
|
||||
appendManifestFile(manifestfile, manifestdata + '\n')
|
||||
if (config['CONFIG_NEUTRON_L2_PLUGIN'] == 'openvswitch' and
|
||||
config['CONFIG_NEUTRON_L3_EXT_BRIDGE'] and
|
||||
not find_mapping(config['CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS'],
|
||||
config['CONFIG_NEUTRON_L3_EXT_BRIDGE'])):
|
||||
config['CONFIG_NEUTRON_OVS_BRIDGE'] = config['CONFIG_NEUTRON_L3_EXT_BRIDGE']
|
||||
ext_bridge = config['CONFIG_NEUTRON_L3_EXT_BRIDGE']
|
||||
mapping = find_mapping(config['CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS'],
|
||||
ext_bridge) if ext_bridge else None
|
||||
if config['CONFIG_NEUTRON_L2_PLUGIN'] == 'openvswitch' and not mapping:
|
||||
config['CONFIG_NEUTRON_OVS_BRIDGE'] = ext_bridge
|
||||
manifestdata = getManifestTemplate('neutron_ovs_bridge.pp')
|
||||
appendManifestFile(manifestfile, manifestdata + '\n')
|
||||
|
||||
|
||||
def create_dhcp_manifests(config):
|
||||
global dhcp_hosts
|
||||
def create_dhcp_manifests(config, messages):
|
||||
global network_hosts
|
||||
|
||||
plugin = config['CONFIG_NEUTRON_L2_PLUGIN']
|
||||
|
||||
for host in dhcp_hosts:
|
||||
for host in network_hosts:
|
||||
config["CONFIG_NEUTRON_DHCP_HOST"] = host
|
||||
config['CONFIG_NEUTRON_DHCP_INTERFACE_DRIVER'] = get_if_driver(config)
|
||||
manifest_data = getManifestTemplate("neutron_dhcp.pp")
|
||||
|
@ -736,12 +749,14 @@ def create_dhcp_manifests(config):
|
|||
for f_host in q_hosts:
|
||||
config['FIREWALL_ALLOWED'] = "'%s'" % f_host
|
||||
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_CHAIN'] = "INPUT"
|
||||
manifest_data += getManifestTemplate("firewall.pp")
|
||||
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_CHAIN'] = "OUTPUT"
|
||||
manifest_data += getManifestTemplate("firewall.pp")
|
||||
|
@ -749,34 +764,21 @@ def create_dhcp_manifests(config):
|
|||
appendManifestFile(manifest_file, manifest_data, 'neutron')
|
||||
|
||||
|
||||
def create_lbaas_manifests(config, messages):
|
||||
global api_hosts
|
||||
|
||||
def create_lbaas_manifests(config):
|
||||
global lbaas_hosts
|
||||
for host in lbaas_hosts:
|
||||
controller.CONF['CONFIG_NEUTRON_LBAAS_INTERFACE_DRIVER'] = get_if_driver(config)
|
||||
if not config['CONFIG_LBAAS_INSTALL'] == 'y':
|
||||
return
|
||||
|
||||
for host in api_hosts:
|
||||
config['CONFIG_NEUTRON_LBAAS_INTERFACE_DRIVER'] = get_if_driver(config)
|
||||
manifestdata = getManifestTemplate("neutron_lbaas.pp")
|
||||
manifestfile = "%s_neutron.pp" % (host,)
|
||||
appendManifestFile(manifestfile, manifestdata + "\n")
|
||||
|
||||
|
||||
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]
|
||||
|
||||
def create_l2_agent_manifests(config):
|
||||
global api_hosts, compute_hosts, dhcp_host, l3_hosts
|
||||
def create_l2_agent_manifests(config, messages):
|
||||
global q_hosts
|
||||
|
||||
plugin = config['CONFIG_NEUTRON_L2_PLUGIN']
|
||||
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
|
||||
# comma-separated list of bridge mappings. Since the puppet module
|
||||
# expects this parameter to be an array, this parameter must be properly
|
||||
# formatted by packstack, then consumed by the puppet module.
|
||||
# For example, the input string 'A, B, C' should formatted as '['A','B','C']'.
|
||||
# expects this parameter to be an array, this parameter must be
|
||||
# properly formatted by packstack, then consumed by the puppet module.
|
||||
# For example, the input string 'A, B' should formatted as '['A','B']'.
|
||||
config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"] = str(bm_arr)
|
||||
elif agent == "linuxbridge":
|
||||
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
|
||||
# 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
|
||||
manifestfile = "%s_neutron.pp" % (host,)
|
||||
manifestdata = getManifestTemplate(template_name)
|
||||
appendManifestFile(manifestfile, manifestdata + "\n")
|
||||
if agent == "openvswitch" and ovs_type == 'vlan':
|
||||
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")
|
||||
appendManifestFile(manifestfile, manifestdata + "\n")
|
||||
# Additional configurations required for compute hosts
|
||||
|
@ -826,12 +830,12 @@ def create_l2_agent_manifests(config):
|
|||
appendManifestFile(manifestfile, manifestdata + '\n')
|
||||
|
||||
|
||||
def create_metadata_manifests(config):
|
||||
global meta_hosts
|
||||
def create_metadata_manifests(config, messages):
|
||||
global network_hosts
|
||||
if config.get('CONFIG_NOVA_INSTALL') == 'n':
|
||||
return
|
||||
for host in meta_hosts:
|
||||
controller.CONF['CONFIG_NEUTRON_METADATA_HOST'] = host
|
||||
for host in network_hosts:
|
||||
config['CONFIG_NEUTRON_METADATA_HOST'] = host
|
||||
manifestdata = getManifestTemplate('neutron_metadata.pp')
|
||||
manifestfile = "%s_neutron.pp" % (host,)
|
||||
appendManifestFile(manifestfile, manifestdata + "\n")
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures nova
|
||||
"""
|
||||
|
@ -12,19 +14,17 @@ from packstack.installer import basedefs, processors, utils, validators
|
|||
from packstack.installer.exceptions import ScriptRuntimeError
|
||||
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import NovaConfig, getManifestTemplate, appendManifestFile, manifestfiles
|
||||
from packstack.modules.ospluginutils import (NovaConfig, getManifestTemplate,
|
||||
appendManifestFile, manifestfiles)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
PLUGIN_NAME = "OS-NOVA"
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
PLUGIN_NAME = "OS-Nova"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
|
||||
def initConfig(controller):
|
||||
if platform.linux_distribution()[0] == "Fedora":
|
||||
primary_netif = "em1"
|
||||
secondary_netif = "em2"
|
||||
|
@ -34,66 +34,6 @@ def initConfig(controllerObject):
|
|||
|
||||
nova_params = {
|
||||
"NOVA": [
|
||||
{"CMD_OPTION" : "novaapi-host",
|
||||
"USAGE" : "The IP address of the server on which to install the Nova API service",
|
||||
"PROMPT" : "Enter the IP address of the Nova API service",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ip, validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_NOVA_API_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
{"CMD_OPTION" : "novacert-host",
|
||||
"USAGE" : "The IP address of the server on which to install the Nova Cert service",
|
||||
"PROMPT" : "Enter the IP address of the Nova Cert service",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_NOVA_CERT_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
{"CMD_OPTION" : "novavncproxy-hosts",
|
||||
"USAGE" : "The IP address of the server on which to install the Nova VNC proxy",
|
||||
"PROMPT" : "Enter the IP address of the Nova VNC proxy",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_NOVA_VNCPROXY_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
{"CMD_OPTION" : "novacompute-hosts",
|
||||
"USAGE" : "A comma separated list of IP addresses on which to install the Nova Compute services",
|
||||
"PROMPT" : "Enter a comma separated list of IP addresses on which to install the Nova Compute services",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_not_empty, validators.validate_multi_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_NOVA_COMPUTE_HOSTS",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
{"CMD_OPTION" : "novaconductor-host",
|
||||
"USAGE" : "The IP address of the server on which to install the Nova Conductor service",
|
||||
"PROMPT" : "Enter the IP address of the Nova Conductor service",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ip, validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_NOVA_CONDUCTOR_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
{"CMD_OPTION": "nova-db-passwd",
|
||||
"USAGE": "The password to use for the Nova to access DB",
|
||||
"PROMPT": "Enter the password for the Nova DB access",
|
||||
|
@ -106,8 +46,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "nova-ks-passwd",
|
||||
"USAGE" : "The password to use for the Nova to authenticate with Keystone",
|
||||
"USAGE": ("The password to use for the Nova to authenticate "
|
||||
"with Keystone"),
|
||||
"PROMPT": "Enter the password for the Nova Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
|
@ -118,23 +60,12 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "novasched-host",
|
||||
"USAGE" : "The IP address of the server on which to install the Nova Scheduler service",
|
||||
"PROMPT" : "Enter the IP address of the Nova Scheduler service",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_NOVA_SCHED_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
|
||||
{"CMD_OPTION": "novasched-cpu-allocation-ratio",
|
||||
"USAGE" : "The overcommitment ratio for virtual to physical CPUs. "
|
||||
"Set to 1.0 to disable CPU overcommitment",
|
||||
"PROMPT" : "Enter the CPU overcommitment ratio. "
|
||||
"Set to 1.0 to disable CPU overcommitment",
|
||||
"USAGE": ("The overcommitment ratio for virtual to physical CPUs."
|
||||
" Set to 1.0 to disable CPU overcommitment"),
|
||||
"PROMPT": "Enter the CPU overcommitment ratio. Set to 1.0 to "
|
||||
"disable CPU overcommitment",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_float],
|
||||
"DEFAULT_VALUE": 16.0,
|
||||
|
@ -144,11 +75,12 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "novasched-ram-allocation-ratio",
|
||||
"USAGE" : "The overcommitment ratio for virtual to physical RAM. "
|
||||
"Set to 1.0 to disable RAM overcommitment",
|
||||
"PROMPT" : "Enter the RAM overcommitment ratio. "
|
||||
"Set to 1.0 to disable RAM overcommitment",
|
||||
"USAGE": ("The overcommitment ratio for virtual to physical RAM. "
|
||||
"Set to 1.0 to disable RAM overcommitment"),
|
||||
"PROMPT": ("Enter the RAM overcommitment ratio. Set to 1.0 to "
|
||||
"disable RAM overcommitment"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_float],
|
||||
"DEFAULT_VALUE": 1.5,
|
||||
|
@ -159,10 +91,13 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"NOVA_NETWORK": [
|
||||
{"CMD_OPTION": "novacompute-privif",
|
||||
"USAGE" : "Private interface for Flat DHCP on the Nova compute servers",
|
||||
"PROMPT" : "Enter the Private interface for Flat DHCP on the Nova compute servers",
|
||||
"USAGE": ("Private interface for Flat DHCP on the Nova compute "
|
||||
"servers"),
|
||||
"PROMPT": ("Enter the Private interface for Flat DHCP on the Nova"
|
||||
" compute servers"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": secondary_netif,
|
||||
|
@ -172,18 +107,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "novanetwork-hosts",
|
||||
"USAGE" : "The list of IP addresses of the server on which to install the Nova Network service",
|
||||
"PROMPT" : "Enter list of IP addresses on which to install the Nova Network service",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_multi_ip, validators.validate_multi_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_NOVA_NETWORK_HOSTS",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
|
||||
{"CMD_OPTION": "novanetwork-manager",
|
||||
"USAGE": "Nova network manager",
|
||||
"PROMPT": "Enter the Nova network manager",
|
||||
|
@ -196,6 +120,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "novanetwork-pubif",
|
||||
"USAGE": "Public interface on the Nova network server",
|
||||
"PROMPT": "Enter the Public interface on the Nova network server",
|
||||
|
@ -208,9 +133,12 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "novanetwork-privif",
|
||||
"USAGE" : "Private interface for network manager on the Nova network server",
|
||||
"PROMPT" : "Enter the Private interface for network manager on the Nova network server",
|
||||
"USAGE": ("Private interface for network manager on the Nova "
|
||||
"network server"),
|
||||
"PROMPT": ("Enter the Private interface for network manager on "
|
||||
"the Nova network server"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": secondary_netif,
|
||||
|
@ -220,6 +148,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "novanetwork-fixed-range",
|
||||
"USAGE": "IP Range for network manager",
|
||||
"PROMPT": "Enter the IP Range for network manager",
|
||||
|
@ -233,6 +162,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "novanetwork-floating-range",
|
||||
"USAGE": "IP Range for Floating IP's",
|
||||
"PROMPT": "Enter the IP Range for Floating IP's",
|
||||
|
@ -246,8 +176,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "novanetwork-default-floating-pool",
|
||||
"USAGE" : "Name of the default floating pool to which the specified floating ranges are added to",
|
||||
"USAGE": ("Name of the default floating pool to which the "
|
||||
"specified floating ranges are added to"),
|
||||
"PROMPT": "What should the default floating pool be called?",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
|
@ -258,9 +190,11 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "novanetwork-auto-assign-floating-ip",
|
||||
"USAGE": "Automatically assign a floating IP to new instances",
|
||||
"PROMPT" : "Should new instances automatically have a floating IP assigned?",
|
||||
"PROMPT": ("Should new instances automatically have a floating "
|
||||
"IP assigned?"),
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "n",
|
||||
|
@ -271,6 +205,7 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"NOVA_NETWORK_VLAN": [
|
||||
{"CMD_OPTION": "novanetwork-vlan-start",
|
||||
"USAGE": "First VLAN for private networks",
|
||||
|
@ -284,6 +219,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "novanetwork-num-networks",
|
||||
"USAGE": "Number of networks to support",
|
||||
"PROMPT": "How many networks should be supported",
|
||||
|
@ -296,6 +232,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "novanetwork-network-size",
|
||||
"USAGE": "Number of addresses in each private subnet",
|
||||
"PROMPT": "How many addresses should be in each private subnet",
|
||||
|
@ -312,14 +249,14 @@ def initConfig(controllerObject):
|
|||
}
|
||||
|
||||
def use_nova_network(config):
|
||||
return config['CONFIG_NOVA_INSTALL'] == 'y' and \
|
||||
config['CONFIG_NEUTRON_INSTALL'] != 'y'
|
||||
return (config['CONFIG_NOVA_INSTALL'] == 'y' and
|
||||
config['CONFIG_NEUTRON_INSTALL'] != 'y')
|
||||
|
||||
def use_nova_network_vlan(config):
|
||||
manager = 'nova.network.manager.VlanManager'
|
||||
return config['CONFIG_NOVA_INSTALL'] == 'y' and \
|
||||
config['CONFIG_NEUTRON_INSTALL'] != 'y' and \
|
||||
config['CONFIG_NOVA_NETWORK_MANAGER'] == manager
|
||||
return (config['CONFIG_NOVA_INSTALL'] == 'y' and
|
||||
config['CONFIG_NEUTRON_INSTALL'] != 'y' and
|
||||
config['CONFIG_NOVA_NETWORK_MANAGER'] == manager)
|
||||
|
||||
nova_groups = [
|
||||
{"GROUP_NAME": "NOVA",
|
||||
|
@ -328,12 +265,14 @@ def initConfig(controllerObject):
|
|||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "NOVA_NETWORK",
|
||||
"DESCRIPTION": "Nova Network Options",
|
||||
"PRE_CONDITION": use_nova_network,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "NOVA_NETWORK_VLAN",
|
||||
"DESCRIPTION": "Nova Network VLAN Options",
|
||||
"PRE_CONDITION": use_nova_network_vlan,
|
||||
|
@ -341,79 +280,53 @@ def initConfig(controllerObject):
|
|||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
]
|
||||
|
||||
for group in nova_groups:
|
||||
paramList = nova_params[group["GROUP_NAME"]]
|
||||
controller.addGroup(group, paramList)
|
||||
params = nova_params[group["GROUP_NAME"]]
|
||||
controller.addGroup(group, params)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
if controller.CONF['CONFIG_NOVA_INSTALL'] != 'y':
|
||||
return
|
||||
|
||||
novaapisteps = [
|
||||
{'title': 'Adding Nova API manifest entries', 'functions':[createapimanifest]},
|
||||
{'title': 'Adding Nova Keystone manifest entries', 'functions':[createkeystonemanifest]},
|
||||
{'title': 'Adding Nova Cert manifest entries', 'functions':[createcertmanifest]},
|
||||
{'title': 'Adding Nova Conductor manifest entries', 'functions':[createconductormanifest]},
|
||||
{'title': 'Adding Nova API manifest entries',
|
||||
'functions': [create_api_manifest]},
|
||||
{'title': 'Adding Nova Keystone manifest entries',
|
||||
'functions': [create_keystone_manifest]},
|
||||
{'title': 'Adding Nova Cert manifest entries',
|
||||
'functions': [create_cert_manifest]},
|
||||
{'title': 'Adding Nova Conductor manifest entries',
|
||||
'functions': [create_conductor_manifest]},
|
||||
{'title': 'Creating ssh keys for Nova migration',
|
||||
'functions': [create_ssh_keys]},
|
||||
{'title': 'Gathering ssh host keys for Nova migration',
|
||||
'functions': [gather_host_keys]},
|
||||
{'title': 'Adding Nova Compute manifest entries', 'functions':[createcomputemanifest]},
|
||||
{'title': 'Adding Nova Scheduler manifest entries', 'functions':[createschedmanifest]},
|
||||
{'title': 'Adding Nova VNC Proxy manifest entries', 'functions':[createvncproxymanifest]},
|
||||
{'title': 'Adding Nova Common manifest entries', 'functions':[createcommonmanifest]},
|
||||
{'title': 'Adding Nova Compute manifest entries',
|
||||
'functions': [create_compute_manifest]},
|
||||
{'title': 'Adding Nova Scheduler manifest entries',
|
||||
'functions': [create_sched_manifest]},
|
||||
{'title': 'Adding Nova VNC Proxy manifest entries',
|
||||
'functions': [create_vncproxy_manifest]},
|
||||
{'title': 'Adding Nova Common manifest entries',
|
||||
'functions': [create_common_manifest]},
|
||||
]
|
||||
|
||||
if controller.CONF['CONFIG_NEUTRON_INSTALL'] == 'y':
|
||||
novaapisteps.append({'title': 'Adding Openstack Network-related Nova manifest entries', 'functions':[createneutronmanifest]})
|
||||
novaapisteps.append(
|
||||
{'title': 'Adding Openstack Network-related Nova manifest entries',
|
||||
'functions': [create_neutron_manifest]}
|
||||
)
|
||||
else:
|
||||
novaapisteps.append({'title': 'Adding Nova Network manifest entries', 'functions':[createnetworkmanifest]})
|
||||
|
||||
controller.addSequence("Installing OpenStack Nova API", [], [], novaapisteps)
|
||||
novaapisteps.append(
|
||||
{'title': 'Adding Nova Network manifest entries',
|
||||
'functions': [create_network_manifest]}
|
||||
)
|
||||
controller.addSequence("Installing OpenStack Nova API", [], [],
|
||||
novaapisteps)
|
||||
|
||||
|
||||
def createapimanifest(config):
|
||||
# Since this step is running first, let's create necesary variables here
|
||||
# and make them global
|
||||
global compute_hosts, network_hosts
|
||||
com_var = config.get("CONFIG_NOVA_COMPUTE_HOSTS", "")
|
||||
compute_hosts = set([i.strip() for i in com_var.split(",") if i.strip()])
|
||||
net_var = config.get("CONFIG_NOVA_NETWORK_HOSTS", "")
|
||||
network_hosts = set([i.strip() for i in net_var.split(",") if i.strip()])
|
||||
|
||||
# This is a hack around us needing to generate the neutron metadata
|
||||
# password, but the nova puppet plugin uses the existence of that
|
||||
# password to determine whether or not to configure neutron metadata
|
||||
# proxy support. So the nova_api.pp template needs unquoted 'undef'
|
||||
# to disable metadata support if neutron is not being installed.
|
||||
if controller.CONF['CONFIG_NEUTRON_INSTALL'] != 'y':
|
||||
controller.CONF['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = 'undef'
|
||||
else:
|
||||
controller.CONF['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = \
|
||||
"'%s'" % controller.CONF['CONFIG_NEUTRON_METADATA_PW']
|
||||
manifestfile = "%s_api_nova.pp"%controller.CONF['CONFIG_NOVA_API_HOST']
|
||||
manifestdata = getManifestTemplate("nova_api.pp")
|
||||
appendManifestFile(manifestfile, manifestdata, 'novaapi')
|
||||
|
||||
|
||||
def createkeystonemanifest(config):
|
||||
manifestfile = "%s_keystone.pp"%controller.CONF['CONFIG_KEYSTONE_HOST']
|
||||
manifestdata = getManifestTemplate("keystone_nova.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def createcertmanifest(config):
|
||||
manifestfile = "%s_nova.pp"%controller.CONF['CONFIG_NOVA_CERT_HOST']
|
||||
manifestdata = getManifestTemplate("nova_cert.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def createconductormanifest(config):
|
||||
manifestfile = "%s_nova.pp"%controller.CONF['CONFIG_NOVA_CONDUCTOR_HOST']
|
||||
manifestdata = getManifestTemplate("nova_conductor.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
#------------------------- helper functions -------------------------
|
||||
|
||||
def check_ifcfg(host, device):
|
||||
"""
|
||||
|
@ -447,7 +360,9 @@ def bring_up_ifcfg(host, device):
|
|||
raise ScriptRuntimeError(msg)
|
||||
|
||||
|
||||
def create_ssh_keys(config):
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_ssh_keys(config, messages):
|
||||
migration_key = os.path.join(basedefs.VAR_DIR, 'nova_migration_key')
|
||||
# Generate key
|
||||
local = utils.ScriptRunner()
|
||||
|
@ -463,7 +378,8 @@ def create_ssh_keys(config):
|
|||
config['NOVA_MIGRATION_KEY_PUBLIC'] = public.split()[1]
|
||||
config['NOVA_MIGRATION_KEY_SECRET'] = secret
|
||||
|
||||
def gather_host_keys(config):
|
||||
|
||||
def gather_host_keys(config, messages):
|
||||
global compute_hosts
|
||||
|
||||
for host in compute_hosts:
|
||||
|
@ -472,7 +388,50 @@ def gather_host_keys(config):
|
|||
retcode, hostkey = local.execute()
|
||||
config['HOST_KEYS_%s' % host] = hostkey
|
||||
|
||||
def createcomputemanifest(config):
|
||||
|
||||
def create_api_manifest(config, messages):
|
||||
# Since this step is running first, let's create necesary variables here
|
||||
# and make them global
|
||||
global compute_hosts, network_hosts
|
||||
com_var = config.get("CONFIG_COMPUTE_HOSTS", "")
|
||||
compute_hosts = set([i.strip() for i in com_var.split(",") if i.strip()])
|
||||
net_var = config.get("CONFIG_NETWORK_HOSTS", "")
|
||||
network_hosts = set([i.strip() for i in net_var.split(",") if i.strip()])
|
||||
|
||||
# This is a hack around us needing to generate the neutron metadata
|
||||
# password, but the nova puppet plugin uses the existence of that
|
||||
# password to determine whether or not to configure neutron metadata
|
||||
# proxy support. So the nova_api.pp template needs unquoted 'undef'
|
||||
# to disable metadata support if neutron is not being installed.
|
||||
if config['CONFIG_NEUTRON_INSTALL'] != 'y':
|
||||
config['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = 'undef'
|
||||
else:
|
||||
config['CONFIG_NEUTRON_METADATA_PW_UNQUOTED'] = \
|
||||
"'%s'" % config['CONFIG_NEUTRON_METADATA_PW']
|
||||
manifestfile = "%s_api_nova.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("nova_api.pp")
|
||||
appendManifestFile(manifestfile, manifestdata, 'novaapi')
|
||||
|
||||
|
||||
def create_keystone_manifest(config, messages):
|
||||
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("keystone_nova.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def create_cert_manifest(config, messages):
|
||||
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("nova_cert.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def create_conductor_manifest(config, messages):
|
||||
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("nova_conductor.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def create_compute_manifest(config, messages):
|
||||
global compute_hosts, network_hosts
|
||||
|
||||
ssh_hostkeys = ''
|
||||
|
@ -489,8 +448,9 @@ def createcomputemanifest(config):
|
|||
|
||||
_, host_key_type, host_key_data = hostkey.split()
|
||||
config['SSH_HOST_NAME'] = host_name
|
||||
config['SSH_HOST_ALIASES'] = ','.join('"%s"' % addr
|
||||
for addr in host_aliases + host_addrs)
|
||||
config['SSH_HOST_ALIASES'] = ','.join(
|
||||
'"%s"' % addr for addr in host_aliases + host_addrs
|
||||
)
|
||||
config['SSH_HOST_KEY'] = host_key_data
|
||||
config['SSH_HOST_KEY_TYPE'] = host_key_type
|
||||
ssh_hostkeys += getManifestTemplate("sshkey.pp")
|
||||
|
@ -515,23 +475,23 @@ def createcomputemanifest(config):
|
|||
nova_config_options = NovaConfig()
|
||||
if config['CONFIG_NEUTRON_INSTALL'] != 'y':
|
||||
if host not in network_hosts:
|
||||
nova_config_options.addOption("DEFAULT/flat_interface",
|
||||
config['CONFIG_NOVA_COMPUTE_PRIVIF'])
|
||||
nova_config_options.addOption(
|
||||
"DEFAULT/flat_interface",
|
||||
config['CONFIG_NOVA_COMPUTE_PRIVIF']
|
||||
)
|
||||
check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF'])
|
||||
try:
|
||||
bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF'])
|
||||
except ScriptRuntimeError as ex:
|
||||
# just warn user to do it by himself
|
||||
controller.MESSAGES.append(str(ex))
|
||||
messages.append(str(ex))
|
||||
|
||||
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
|
||||
manifestdata += getManifestTemplate(get_mq(config, "nova_ceilometer"))
|
||||
mq_template = get_mq(config, "nova_ceilometer")
|
||||
manifestdata += getManifestTemplate(mq_template)
|
||||
manifestdata += getManifestTemplate("nova_ceilometer.pp")
|
||||
|
||||
# According to the docs the only element that connects directly to nova compute
|
||||
# is nova scheduler
|
||||
# http://docs.openstack.org/developer/nova/nova.concepts.html#concept-system-architecture
|
||||
config['FIREWALL_ALLOWED'] = "'%s'" % (config['CONFIG_NOVA_SCHED_HOST'].strip())
|
||||
config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST']
|
||||
config['FIREWALL_SERVICE_NAME'] = "nova compute"
|
||||
config['FIREWALL_SERVICE_ID'] = "nova_compute"
|
||||
config['FIREWALL_PORTS'] = "'5900-5999'"
|
||||
|
@ -543,7 +503,7 @@ def createcomputemanifest(config):
|
|||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def createnetworkmanifest(config):
|
||||
def create_network_manifest(config, messages):
|
||||
global compute_hosts, network_hosts
|
||||
if config['CONFIG_NEUTRON_INSTALL'] == "y":
|
||||
return
|
||||
|
@ -554,7 +514,7 @@ def createnetworkmanifest(config):
|
|||
('CONFIG_NOVA_NETWORK_NUMBER', 1)]:
|
||||
config[key] = config.get(key, value)
|
||||
|
||||
api_host = config['CONFIG_NOVA_API_HOST']
|
||||
api_host = config['CONFIG_CONTROLLER_HOST']
|
||||
multihost = len(network_hosts) > 1
|
||||
config['CONFIG_NOVA_NETWORK_MULTIHOST'] = multihost and 'true' or 'false'
|
||||
for host in network_hosts:
|
||||
|
@ -564,7 +524,7 @@ def createnetworkmanifest(config):
|
|||
bring_up_ifcfg(host, config[i])
|
||||
except ScriptRuntimeError as ex:
|
||||
# just warn user to do it by himself
|
||||
controller.MESSAGES.append(str(ex))
|
||||
messages.append(str(ex))
|
||||
|
||||
key = 'CONFIG_NOVA_NETWORK_AUTOASSIGNFLOATINGIP'
|
||||
config[key] = config[key] == "y"
|
||||
|
@ -583,29 +543,24 @@ def createnetworkmanifest(config):
|
|||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def createschedmanifest(config):
|
||||
manifestfile = "%s_nova.pp"%controller.CONF['CONFIG_NOVA_SCHED_HOST']
|
||||
def create_sched_manifest(config, messages):
|
||||
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("nova_sched.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def createvncproxymanifest(config):
|
||||
manifestfile = "%s_nova.pp"%controller.CONF['CONFIG_NOVA_VNCPROXY_HOST']
|
||||
def create_vncproxy_manifest(config, messages):
|
||||
manifestfile = "%s_nova.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("nova_vncproxy.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def createcommonmanifest(config):
|
||||
def create_common_manifest(config, messages):
|
||||
global compute_hosts, network_hosts
|
||||
network_type = (config['CONFIG_NEUTRON_INSTALL'] == "y" and
|
||||
'neutron' or 'nova')
|
||||
network_multi = len(network_hosts) > 1
|
||||
dirty = [config.get('CONFIG_NOVA_CONDUCTOR_HOST'),
|
||||
config.get('CONFIG_NOVA_API_HOST'),
|
||||
config.get('CONFIG_NOVA_CERT_HOST'),
|
||||
config.get('CONFIG_NOVA_VNCPROXY_HOST'),
|
||||
config.get('CONFIG_NOVA_SCHED_HOST')]
|
||||
dbacces_hosts = set([i.strip() for i in dirty if i and i.strip()])
|
||||
dbacces_hosts = set([config.get('CONFIG_CONTROLLER_HOST')])
|
||||
dbacces_hosts |= network_hosts
|
||||
|
||||
for manifestfile, marker in manifestfiles.getFiles():
|
||||
|
@ -628,7 +583,7 @@ def createcommonmanifest(config):
|
|||
host in compute_hosts):
|
||||
metadata = host
|
||||
else:
|
||||
metadata = config['CONFIG_NOVA_API_HOST']
|
||||
metadata = config['CONFIG_CONTROLLER_HOST']
|
||||
config['CONFIG_NOVA_METADATA_HOST'] = metadata
|
||||
|
||||
data = getManifestTemplate(get_mq(config, "nova_common"))
|
||||
|
@ -636,11 +591,12 @@ def createcommonmanifest(config):
|
|||
appendManifestFile(os.path.split(manifestfile)[1], data)
|
||||
|
||||
|
||||
def createneutronmanifest(config):
|
||||
if controller.CONF['CONFIG_NEUTRON_INSTALL'] != "y":
|
||||
def create_neutron_manifest(config, messages):
|
||||
if config['CONFIG_NEUTRON_INSTALL'] != "y":
|
||||
return
|
||||
|
||||
controller.CONF['CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver'
|
||||
virt_driver = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver'
|
||||
config['CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = virt_driver
|
||||
|
||||
for manifestfile, marker in manifestfiles.getFiles():
|
||||
if manifestfile.endswith("_nova.pp"):
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures an OpenStack Client
|
||||
"""
|
||||
|
@ -9,44 +11,24 @@ from packstack.installer import validators
|
|||
from packstack.installer import basedefs, output_messages
|
||||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OS-CLIENT"
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "OS-Client"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding OpenStack Client configuration")
|
||||
paramsList = [
|
||||
{"CMD_OPTION" : "osclient-host",
|
||||
"USAGE" : "The IP address of the server on which to install the OpenStack client packages. An admin \"rc\" file will also be installed",
|
||||
"PROMPT" : "Enter the IP address of the client server",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_OSCLIENT_HOST",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "NOVACLIENT",
|
||||
def initConfig(controller):
|
||||
group = {"GROUP_NAME": "NOVACLIENT",
|
||||
"DESCRIPTION": "NOVACLIENT Config parameters",
|
||||
"PRE_CONDITION": "CONFIG_CLIENT_INSTALL",
|
||||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, [])
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
|
@ -54,13 +36,17 @@ def initSequences(controller):
|
|||
return
|
||||
|
||||
osclientsteps = [
|
||||
{'title': 'Adding OpenStack Client manifest entries', 'functions':[createmanifest]}
|
||||
{'title': 'Adding OpenStack Client manifest entries',
|
||||
'functions': [create_manifest]}
|
||||
]
|
||||
controller.addSequence("Installing OpenStack Client", [], [], osclientsteps)
|
||||
controller.addSequence("Installing OpenStack Client", [], [],
|
||||
osclientsteps)
|
||||
|
||||
|
||||
def createmanifest(config):
|
||||
client_host = config['CONFIG_OSCLIENT_HOST'].strip()
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_manifest(config, messages):
|
||||
client_host = config['CONFIG_CONTROLLER_HOST'].strip()
|
||||
manifestfile = "%s_osclient.pp" % client_host
|
||||
|
||||
server = utils.ScriptRunner(client_host)
|
||||
|
@ -83,9 +69,9 @@ def createmanifest(config):
|
|||
|
||||
msg = ("File %s/keystonerc_admin has been created on OpenStack client host"
|
||||
" %s. To use the command line tools you need to source the file.")
|
||||
controller.MESSAGES.append(msg % (root_home, client_host))
|
||||
messages.append(msg % (root_home, client_host))
|
||||
|
||||
if no_root_allinone:
|
||||
msg = ("Copy of keystonerc_admin file has been created for non-root "
|
||||
"user in %s.")
|
||||
controller.MESSAGES.append(msg % homedir)
|
||||
messages.append(msg % homedir)
|
||||
|
|
|
@ -1,50 +1,52 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures an OpenStack Client
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from packstack.installer import utils
|
||||
|
||||
from packstack.modules.common import filtered_hosts
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OS-POSTSCRIPT"
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Executing post run scripts")
|
||||
PLUGIN_NAME = "Postscript"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
|
||||
groupDict = {"GROUP_NAME" : "POSTSCRIPT",
|
||||
def initConfig(controller):
|
||||
group = {"GROUP_NAME": "POSTSCRIPT",
|
||||
"DESCRIPTION": "POSTSCRIPT Config parameters",
|
||||
"PRE_CONDITION": lambda x: 'yes',
|
||||
"PRE_CONDITION_MATCH": "yes",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, [])
|
||||
controller.addGroup(group, [])
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
osclientsteps = [
|
||||
{'title': 'Adding post install manifest entries', 'functions':[createmanifest]}
|
||||
postscript_steps = [
|
||||
{'title': 'Adding post install manifest entries',
|
||||
'functions': [create_manifest]}
|
||||
]
|
||||
controller.addSequence("Running post install scripts", [], [], osclientsteps)
|
||||
controller.addSequence("Running post install scripts", [], [],
|
||||
postscript_steps)
|
||||
|
||||
|
||||
def createmanifest(config):
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_manifest(config, messages):
|
||||
for hostname in filtered_hosts(config):
|
||||
manifestfile = "%s_postscript.pp" % hostname
|
||||
manifestdata = getManifestTemplate("postscript.pp")
|
||||
appendManifestFile(manifestfile, manifestdata, 'postscript')
|
||||
if config.get("CONFIG_PROVISION_ALL_IN_ONE_OVS_BRIDGE") != 'n':
|
||||
config['EXT_BRIDGE_VAR'] = config['CONFIG_NEUTRON_L3_EXT_BRIDGE'].replace('-','_')
|
||||
fmted = config['CONFIG_NEUTRON_L3_EXT_BRIDGE'].replace('-', '_')
|
||||
config['EXT_BRIDGE_VAR'] = fmted
|
||||
manifestdata = getManifestTemplate("persist_ovs_bridge.pp")
|
||||
appendManifestFile(manifestfile, manifestdata, 'postscript')
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Plugin responsible for setting OpenStack global options
|
||||
"""
|
||||
|
@ -16,34 +18,35 @@ from packstack.modules.ospluginutils import (getManifestTemplate,
|
|||
appendManifestFile)
|
||||
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OS-PRESCRIPT"
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
PLUGIN_NAME = "Prescript"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
|
||||
paramsList = [{"CMD_OPTION" : "ssh-public-key",
|
||||
"USAGE" : "Path to a Public key to install on servers. If a usable key has not been installed on the remote servers the user will be prompted for a password and this key will be installed so the password will not be required again",
|
||||
"PROMPT" : "Enter the path to your ssh Public key to install on servers",
|
||||
def initConfig(controller):
|
||||
default_ssh_key = os.path.join(os.environ["HOME"], ".ssh/*.pub")
|
||||
default_ssh_key = (glob.glob(default_ssh_key) + [""])[0]
|
||||
params = [
|
||||
{"CMD_OPTION": "ssh-public-key",
|
||||
"USAGE": ("Path to a Public key to install on servers. If a usable "
|
||||
"key has not been installed on the remote servers the user "
|
||||
"will be prompted for a password and this key will be "
|
||||
"installed so the password will not be required again"),
|
||||
"PROMPT": ("Enter the path to your ssh Public key to install "
|
||||
"on servers"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS" : [validators.validate_file,
|
||||
validators.validate_sshkey],
|
||||
"VALIDATORS": [validators.validate_file, validators.validate_sshkey],
|
||||
"PROCESSORS": [processors.process_ssh_key],
|
||||
"DEFAULT_VALUE" : (glob.glob(os.path.join(os.environ["HOME"], ".ssh/*.pub"))+[""])[0],
|
||||
"DEFAULT_VALUE": default_ssh_key,
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_SSH_KEY",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "os-mysql-install",
|
||||
|
||||
{"CMD_OPTION": "mysql-install",
|
||||
"USAGE": "Set to 'y' if you would like Packstack to install MySQL",
|
||||
"PROMPT": "Should Packstack install MySQL DB",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
|
@ -55,8 +58,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-glance-install",
|
||||
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Image Service (Glance)",
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install "
|
||||
"OpenStack Image Service (Glance)"),
|
||||
"PROMPT": "Should Packstack install OpenStack Image Service (Glance)",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -67,9 +72,12 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-cinder-install",
|
||||
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Block Storage (Cinder)",
|
||||
"PROMPT" : "Should Packstack install OpenStack Block Storage (Cinder) service",
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install "
|
||||
"OpenStack Block Storage (Cinder)"),
|
||||
"PROMPT": ("Should Packstack install OpenStack Block Storage "
|
||||
"(Cinder) service"),
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "y",
|
||||
|
@ -79,8 +87,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-nova-install",
|
||||
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Compute (Nova)",
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install "
|
||||
"OpenStack Compute (Nova)"),
|
||||
"PROMPT": "Should Packstack install OpenStack Compute (Nova) service",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -91,9 +101,13 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-neutron-install",
|
||||
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Networking (Neutron)",
|
||||
"PROMPT" : "Should Packstack install OpenStack Networking (Neutron) service",
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install "
|
||||
"OpenStack Networking (Neutron). Otherwise Nova Network "
|
||||
"will be used."),
|
||||
"PROMPT": ("Should Packstack install OpenStack Networking (Neutron) "
|
||||
"service"),
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "y",
|
||||
|
@ -103,8 +117,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-horizon-install",
|
||||
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Dashboard (Horizon)",
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install "
|
||||
"OpenStack Dashboard (Horizon)"),
|
||||
"PROMPT": "Should Packstack install OpenStack Dashboard (Horizon)",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -115,8 +131,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-swift-install",
|
||||
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Object Storage (Swift)",
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install "
|
||||
"OpenStack Object Storage (Swift)"),
|
||||
"PROMPT": "Should Packstack install OpenStack Object Storage (Swift)",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -127,8 +145,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-ceilometer-install",
|
||||
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Metering (Ceilometer)",
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install "
|
||||
"OpenStack Metering (Ceilometer)"),
|
||||
"PROMPT": "Should Packstack install OpenStack Metering (Ceilometer)",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -139,8 +159,10 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-heat-install",
|
||||
"USAGE" : "Set to 'y' if you would like Packstack to install OpenStack Orchestration (Heat)",
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install "
|
||||
"OpenStack Orchestration (Heat)"),
|
||||
"PROMPT": "Should Packstack install OpenStack Orchestration (Heat)",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -151,8 +173,11 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-client-install",
|
||||
"USAGE" : "Set to 'y' if you would like Packstack to install the OpenStack Client packages. An admin \"rc\" file will also be installed",
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install "
|
||||
"the OpenStack Client packages. An admin \"rc\" file will "
|
||||
"also be installed"),
|
||||
"PROMPT": "Should Packstack install OpenStack client tools",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -163,9 +188,13 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "ntp-servers",
|
||||
"USAGE" : "Comma separated list of NTP servers. Leave plain if Packstack should not install ntpd on instances.",
|
||||
"PROMPT" : "Enter a comma separated list of NTP server(s). Leave plain if Packstack should not install ntpd on instances.",
|
||||
"USAGE": ("Comma separated list of NTP servers. Leave plain if "
|
||||
"Packstack should not install ntpd on instances."),
|
||||
"PROMPT": ("Enter a comma separated list of NTP server(s). Leave "
|
||||
"plain if Packstack should not install ntpd "
|
||||
"on instances."),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": '',
|
||||
"MASK_INPUT": False,
|
||||
|
@ -174,9 +203,12 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "nagios-install",
|
||||
"USAGE" : "Set to 'y' if you would like Packstack to install Nagios to monitor OpenStack hosts",
|
||||
"PROMPT" : "Should Packstack install Nagios to monitor OpenStack hosts",
|
||||
"USAGE": ("Set to 'y' if you would like Packstack to install Nagios "
|
||||
"to monitor OpenStack hosts"),
|
||||
"PROMPT": ("Should Packstack install Nagios to monitor OpenStack "
|
||||
"hosts"),
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": 'y',
|
||||
|
@ -186,9 +218,15 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "exclude-servers",
|
||||
"USAGE" : "Comma separated list of servers to be excluded from installation in case you are running Packstack the second time with the same answer file and don't want Packstack to touch these servers. Leave plain if you don't need to exclude any server.",
|
||||
"PROMPT" : "Enter a comma separated list of server(s) to be excluded. Leave plain if you don't need to exclude any server.",
|
||||
"USAGE": ("Comma separated list of servers to be excluded from "
|
||||
"installation in case you are running Packstack the second "
|
||||
"time with the same answer file and don't want Packstack "
|
||||
"to touch these servers. Leave plain if you don't need to "
|
||||
"exclude any server."),
|
||||
"PROMPT": ("Enter a comma separated list of server(s) to be excluded."
|
||||
" Leave plain if you don't need to exclude any server."),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": '',
|
||||
"MASK_INPUT": False,
|
||||
|
@ -197,12 +235,11 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-debug-mode",
|
||||
"USAGE" : ("Set to 'y' if you want to run "
|
||||
"OpenStack services in debug mode. "
|
||||
"Otherwise set to 'n'."),
|
||||
"PROMPT" : ("Do you want to run OpenStack services"
|
||||
" in debug mode"),
|
||||
"USAGE": ("Set to 'y' if you want to run OpenStack services in debug "
|
||||
"mode. Otherwise set to 'n'."),
|
||||
"PROMPT": "Do you want to run OpenStack services in debug mode",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"DEFAULT_VALUE": "n",
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -212,12 +249,61 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CONF_NAME": "CONFIG_CONTROLLER_HOST",
|
||||
"CMD_OPTION": "os-controller-host",
|
||||
"USAGE": ("The IP address of the server on which to install OpenStack"
|
||||
" services specific to controller role such as API servers,"
|
||||
" Horizon, etc."),
|
||||
"PROMPT": "Enter the IP address of the controller host",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_ip,
|
||||
validators.validate_ssh],
|
||||
"DEFAULT_VALUE": utils.get_localhost_ip(),
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CONF_NAME": "CONFIG_COMPUTE_HOSTS",
|
||||
"CMD_OPTION": "os-compute-hosts",
|
||||
"USAGE": ("The list of IP addresses of the server on which to install"
|
||||
" the Nova compute service"),
|
||||
"PROMPT": ("Enter list of IP addresses on which to install compute "
|
||||
"service"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_multi_ip,
|
||||
validators.validate_multi_ssh],
|
||||
"DEFAULT_VALUE": utils.get_localhost_ip(),
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CONF_NAME": "CONFIG_NETWORK_HOSTS",
|
||||
"CMD_OPTION": "os-network-hosts",
|
||||
"USAGE": ("The list of IP addresses of the server on which "
|
||||
"to install the network service such as Nova "
|
||||
"network or Neutron"),
|
||||
"PROMPT": ("Enter list of IP addresses on which to install "
|
||||
"network service"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_multi_ip,
|
||||
validators.validate_multi_ssh],
|
||||
"DEFAULT_VALUE": utils.get_localhost_ip(),
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-vmware",
|
||||
"USAGE" : ("Set to 'y' if you want to use "
|
||||
"VMware vCenter as hypervisor and storage"
|
||||
"Otherwise set to 'n'."),
|
||||
"PROMPT" : ("Do you want to use VMware vCenter as"
|
||||
" hypervisor and datastore"),
|
||||
"USAGE": ("Set to 'y' if you want to use VMware vCenter as hypervisor"
|
||||
" and storage. Otherwise set to 'n'."),
|
||||
"PROMPT": ("Do you want to use VMware vCenter as hypervisor and "
|
||||
"datastore"),
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"DEFAULT_VALUE": "n",
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
|
@ -228,22 +314,23 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
]
|
||||
groupDict = { "GROUP_NAME" : "GLOBAL",
|
||||
group = {"GROUP_NAME": "GLOBAL",
|
||||
"DESCRIPTION": "Global Options",
|
||||
"PRE_CONDITION": lambda x: 'yes',
|
||||
"PRE_CONDITION_MATCH": "yes",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, params)
|
||||
|
||||
def use_vcenter(config):
|
||||
return (config['CONFIG_NOVA_INSTALL'] == 'y' and
|
||||
config['CONFIG_VMWARE_BACKEND'] == 'y')
|
||||
|
||||
paramsList = [
|
||||
params = [
|
||||
{"CMD_OPTION": "vcenter-host",
|
||||
"USAGE" : ("The IP address of the VMware vCenter server"),
|
||||
"PROMPT" : ("Enter the IP address of the VMware vCenter server to use with Nova"),
|
||||
"USAGE": "The IP address of the VMware vCenter server",
|
||||
"PROMPT": ("Enter the IP address of the VMware vCenter server to use "
|
||||
"with Nova"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_ip],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -253,46 +340,50 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "vcenter-username",
|
||||
"USAGE" : ("The username to authenticate to VMware vCenter server"),
|
||||
"PROMPT" : ("Enter the username to authenticate on VMware vCenter server"),
|
||||
"USAGE": "The username to authenticate to VMware vCenter server",
|
||||
"PROMPT": ("Enter the username to authenticate on VMware "
|
||||
"vCenter server"),
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME": "CONFIG_VCENTER_USER",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION" : False,},
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "vcenter-password",
|
||||
"USAGE" : ("The password to authenticate to VMware vCenter server"),
|
||||
"PROMPT" : ("Enter the password to authenticate on VMware vCenter server"),
|
||||
"USAGE": "The password to authenticate to VMware vCenter server",
|
||||
"PROMPT": ("Enter the password to authenticate on VMware "
|
||||
"vCenter server"),
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME": "CONFIG_VCENTER_PASSWORD",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION" : False,},
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "vcenter-cluster",
|
||||
"USAGE" : ("The name of the vCenter cluster"),
|
||||
"PROMPT" : ("Enter the name of the vCenter datastore"),
|
||||
"USAGE": "The name of the vCenter cluster",
|
||||
"PROMPT": "Enter the name of the vCenter datastore",
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME": "CONFIG_VCENTER_CLUSTER_NAME",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION" : False,},
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
||||
groupDict = {"GROUP_NAME" : "VMWARE",
|
||||
group = {"GROUP_NAME": "VMWARE",
|
||||
"DESCRIPTION": "vCenter Config Parameters",
|
||||
"PRE_CONDITION": use_vcenter,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
controller.addGroup(group, params)
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
|
||||
def initSequences(controller):
|
||||
prescript_steps = [
|
||||
|
@ -305,21 +396,21 @@ def initSequences(controller):
|
|||
]
|
||||
|
||||
if controller.CONF['CONFIG_NTP_SERVERS']:
|
||||
prescript_steps.append({
|
||||
'title': 'Installing time synchronization via NTP',
|
||||
'functions': [create_ntp_manifest],
|
||||
})
|
||||
prescript_steps.append(
|
||||
{'title': 'Installing time synchronization via NTP',
|
||||
'functions': [create_ntp_manifest]})
|
||||
else:
|
||||
controller.MESSAGES.append('Time synchronization installation '
|
||||
'was skipped. Please note that '
|
||||
'unsynchronized time on server '
|
||||
'instances might be problem for '
|
||||
'some OpenStack components.')
|
||||
controller.MESSAGES.append('Time synchronization installation was '
|
||||
'skipped. Please note that unsynchronized '
|
||||
'time on server instances might be problem '
|
||||
'for some OpenStack components.')
|
||||
controller.addSequence("Running pre install scripts", [], [],
|
||||
prescript_steps)
|
||||
|
||||
|
||||
def install_keys(config):
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def install_keys(config, messages):
|
||||
with open(config["CONFIG_SSH_KEY"]) as fp:
|
||||
sshkeydata = fp.read().strip()
|
||||
for hostname in filtered_hosts(config):
|
||||
|
@ -337,7 +428,7 @@ def install_keys(config):
|
|||
server.execute()
|
||||
|
||||
|
||||
def discover(config):
|
||||
def discover(config, messages):
|
||||
"""
|
||||
Discovers details about hosts.
|
||||
"""
|
||||
|
@ -382,7 +473,7 @@ def discover(config):
|
|||
config['HOST_DETAILS'] = details
|
||||
|
||||
|
||||
def create_manifest(config):
|
||||
def create_manifest(config, messages):
|
||||
key = 'CONFIG_DEBUG_MODE'
|
||||
config[key] = config[key] == 'y' and 'true' or 'false'
|
||||
|
||||
|
@ -392,7 +483,7 @@ def create_manifest(config):
|
|||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def create_ntp_manifest(config):
|
||||
def create_ntp_manifest(config, messages):
|
||||
srvlist = [i.strip()
|
||||
for i in config['CONFIG_NTP_SERVERS'].split(',')
|
||||
if i.strip()]
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures neutron
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
|
||||
from packstack.modules.common import is_all_in_one
|
||||
|
@ -11,20 +14,13 @@ from packstack.modules.ospluginutils import (appendManifestFile,
|
|||
getManifestTemplate)
|
||||
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OS-Provision"
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
|
||||
logging.debug("Provisioning OpenStack resources for demo usage and testing")
|
||||
def initConfig(controller):
|
||||
|
||||
def process_provision(param, process_args=None):
|
||||
return param if is_all_in_one(controller.CONF) else 'n'
|
||||
|
@ -35,10 +31,10 @@ def initConfig(controllerObject):
|
|||
"USAGE": ("Whether to provision for demo usage and testing. Note "
|
||||
"that provisioning is only supported for all-in-one "
|
||||
"installations."),
|
||||
"PROMPT" : "Would you like to provision for demo usage and testing?",
|
||||
"PROMPT": ("Would you like to provision for demo usage "
|
||||
"and testing"),
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"PROCESSORS" : [process_provision],
|
||||
"DEFAULT_VALUE": "y",
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
|
@ -46,14 +42,14 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "provision-tempest",
|
||||
"USAGE" : ("Whether to configure tempest for testing. Note "
|
||||
"that provisioning is only supported for all-in-one "
|
||||
"installations."),
|
||||
"PROMPT" : "Would you like to configure Tempest (OpenStack test suite)?",
|
||||
"USAGE": "Whether to configure tempest for testing",
|
||||
"PROMPT": ("Would you like to configure Tempest (OpenStack test "
|
||||
"suite). Note that provisioning is only supported for "
|
||||
"all-in-one installations."),
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"PROCESSORS" : [process_provision],
|
||||
"DEFAULT_VALUE": "n",
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
|
@ -62,10 +58,11 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"PROVISION_DEMO": [
|
||||
{"CMD_OPTION": "provision-demo-floatrange",
|
||||
"USAGE": "The CIDR network address for the floating IP subnet",
|
||||
"PROMPT" : "Enter the network address for the floating IP subnet:",
|
||||
"PROMPT": "Enter the network address for the floating IP subnet",
|
||||
"OPTION_LIST": False,
|
||||
"VALIDATORS": False,
|
||||
"DEFAULT_VALUE": "172.24.4.224/28",
|
||||
|
@ -76,6 +73,7 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"TEMPEST_GIT_REFS": [
|
||||
{"CMD_OPTION": "provision-tempest-repo-uri",
|
||||
"USAGE": "The uri of the tempest git repository to use",
|
||||
|
@ -89,9 +87,11 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "provision-tempest-repo-revision",
|
||||
"USAGE": "The revision of the tempest git repository to use",
|
||||
"PROMPT" : "What revision, branch, or tag of the Tempest git repository should be used?",
|
||||
"PROMPT": ("What revision, branch, or tag of the Tempest git "
|
||||
"repository should be used"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": "master",
|
||||
|
@ -102,10 +102,12 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
||||
"PROVISION_ALL_IN_ONE_OVS_BRIDGE": [
|
||||
{"CMD_OPTION": "provision-all-in-one-ovs-bridge",
|
||||
"USAGE" : "Whether to configure the ovs external bridge in an all-in-one deployment",
|
||||
"PROMPT" : "Would you like to configure the external ovs bridge?",
|
||||
"USAGE": ("Whether to configure the ovs external bridge in an "
|
||||
"all-in-one deployment"),
|
||||
"PROMPT": "Would you like to configure the external ovs bridge",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "n",
|
||||
|
@ -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):
|
||||
return (allow_provisioning(config) and
|
||||
(config.get('CONFIG_PROVISION_DEMO', 'n') == 'y' or
|
||||
config.get('CONFIG_PROVISION_TEMPEST', 'n') == 'y'))
|
||||
|
||||
def check_provisioning_tempest(config):
|
||||
return allow_provisioning(config) and \
|
||||
config.get('CONFIG_PROVISION_TEMPEST', 'n') == 'y'
|
||||
return (allow_provisioning(config) and
|
||||
config.get('CONFIG_PROVISION_TEMPEST', 'n') == 'y')
|
||||
|
||||
def allow_all_in_one_ovs_bridge(config):
|
||||
return allow_provisioning(config) and \
|
||||
config['CONFIG_NEUTRON_INSTALL'] == 'y' and \
|
||||
config['CONFIG_NEUTRON_L2_PLUGIN'] == 'openvswitch'
|
||||
return (allow_provisioning(config) and
|
||||
config['CONFIG_NEUTRON_INSTALL'] == 'y' and
|
||||
config['CONFIG_NEUTRON_L2_PLUGIN'] == 'openvswitch')
|
||||
|
||||
conf_groups = [
|
||||
{"GROUP_NAME": "PROVISION_INIT",
|
||||
|
@ -145,18 +141,21 @@ def initConfig(controllerObject):
|
|||
"PRE_CONDITION_MATCH": "yes",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "PROVISION_DEMO",
|
||||
"DESCRIPTION": "Provisioning demo config",
|
||||
"PRE_CONDITION" : check_provisioning_demo,
|
||||
"PRE_CONDITION": allow_provisioning,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "TEMPEST_GIT_REFS",
|
||||
"DESCRIPTION": "Optional tempest git uri and branch",
|
||||
"PRE_CONDITION": check_provisioning_tempest,
|
||||
"PRE_CONDITION_MATCH": True,
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True},
|
||||
|
||||
{"GROUP_NAME": "PROVISION_ALL_IN_ONE_OVS_BRIDGE",
|
||||
"DESCRIPTION": "Provisioning all-in-one ovs bridge config",
|
||||
"PRE_CONDITION": allow_all_in_one_ovs_bridge,
|
||||
|
@ -182,6 +181,30 @@ def initConfig(controllerObject):
|
|||
controller.CONF[param.CONF_NAME] = value
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
config = controller.CONF
|
||||
provisioning_required = (
|
||||
config['CONFIG_PROVISION_DEMO'] == 'y'
|
||||
or
|
||||
config['CONFIG_PROVISION_TEMPEST'] == 'y'
|
||||
)
|
||||
|
||||
if not provisioning_required or not allow_provisioning(config):
|
||||
return
|
||||
|
||||
marshall_conf_bool(config, 'CONFIG_PROVISION_TEMPEST')
|
||||
marshall_conf_bool(config, 'CONFIG_PROVISION_ALL_IN_ONE_OVS_BRIDGE')
|
||||
|
||||
provision_steps = [
|
||||
{'title': 'Adding Provisioning manifest entries',
|
||||
'functions': [create_manifest]}
|
||||
]
|
||||
controller.addSequence("Provisioning for Demo and Testing Usage",
|
||||
[], [], provision_steps)
|
||||
|
||||
|
||||
#------------------------- helper functions -------------------------
|
||||
|
||||
def marshall_conf_bool(conf, key):
|
||||
if conf[key] == 'y':
|
||||
conf[key] = 'true'
|
||||
|
@ -189,34 +212,19 @@ def marshall_conf_bool(conf, key):
|
|||
conf[key] = 'false'
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
provisioning_required = (
|
||||
controller.CONF['CONFIG_PROVISION_DEMO'] == 'y'
|
||||
or
|
||||
controller.CONF['CONFIG_PROVISION_TEMPEST'] == 'y'
|
||||
)
|
||||
if not provisioning_required:
|
||||
return
|
||||
marshall_conf_bool(controller.CONF, 'CONFIG_PROVISION_TEMPEST')
|
||||
marshall_conf_bool(controller.CONF,
|
||||
'CONFIG_PROVISION_ALL_IN_ONE_OVS_BRIDGE')
|
||||
provision_steps = [
|
||||
{
|
||||
'title': 'Adding Provisioning manifest entries',
|
||||
'functions': [create_manifest],
|
||||
}
|
||||
]
|
||||
controller.addSequence("Provisioning for Demo and Testing Usage",
|
||||
[], [], provision_steps)
|
||||
def allow_provisioning(config):
|
||||
# Provisioning is currently supported only for all-in-one (due
|
||||
# to a limitation with how the custom types for OpenStack
|
||||
# resources are implemented).
|
||||
return is_all_in_one(config)
|
||||
|
||||
|
||||
def create_manifest(config):
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_manifest(config, messages):
|
||||
# Using the neutron or nova api servers as the provisioning target
|
||||
# will suffice for the all-in-one case.
|
||||
if config['CONFIG_NEUTRON_INSTALL'] == "y":
|
||||
host = config['CONFIG_NEUTRON_SERVER_HOST']
|
||||
else:
|
||||
host = config['CONFIG_NOVA_API_HOST']
|
||||
if config['CONFIG_NEUTRON_INSTALL'] != "y":
|
||||
# The provisioning template requires the name of the external
|
||||
# bridge but the value will be missing if neutron isn't
|
||||
# configured to be installed.
|
||||
|
@ -228,6 +236,6 @@ def create_manifest(config):
|
|||
config['PROVISION_NEUTRON_AVAILABLE'] = config['CONFIG_NEUTRON_INSTALL']
|
||||
marshall_conf_bool(config, 'PROVISION_NEUTRON_AVAILABLE')
|
||||
|
||||
manifest_file = '%s_provision.pp' % host
|
||||
manifest_file = '%s_provision.pp' % config['CONFIG_CONTROLLER_HOST']
|
||||
manifest_data = getManifestTemplate("provision.pp")
|
||||
appendManifestFile(manifest_file, manifest_data)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"""
|
||||
Installs and configures puppet
|
||||
"""
|
||||
|
||||
import sys
|
||||
import logging
|
||||
import os
|
||||
|
@ -17,62 +18,117 @@ from packstack.modules.common import filtered_hosts
|
|||
from packstack.modules.ospluginutils import manifestfiles
|
||||
from packstack.modules.puppet import scan_logfile, validate_logfile
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OSPUPPET"
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "Puppet"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
PUPPET_DIR = os.environ.get('PACKSTACK_PUPPETDIR', '/usr/share/openstack-puppet/')
|
||||
PUPPET_DIR = os.environ.get('PACKSTACK_PUPPETDIR',
|
||||
'/usr/share/openstack-puppet/')
|
||||
MODULE_DIR = os.path.join(PUPPET_DIR, 'modules')
|
||||
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding OpenStack Puppet configuration")
|
||||
paramsList = [
|
||||
]
|
||||
|
||||
groupDict = {"GROUP_NAME" : "PUPPET",
|
||||
def initConfig(controller):
|
||||
group = {"GROUP_NAME": "PUPPET",
|
||||
"DESCRIPTION": "Puppet Config parameters",
|
||||
"PRE_CONDITION": lambda x: 'yes',
|
||||
"PRE_CONDITION_MATCH": "yes",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
controller.addGroup(group, [])
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
puppetpresteps = [
|
||||
{'title': 'Clean Up', 'functions':[runCleanup]},
|
||||
{'title': 'Clean Up', 'functions': [run_cleanup]},
|
||||
]
|
||||
controller.insertSequence("Clean Up", [], [], puppetpresteps, index=0)
|
||||
|
||||
puppetsteps = [
|
||||
{'title': 'Installing Dependencies',
|
||||
'functions': [installdeps]},
|
||||
'functions': [install_deps]},
|
||||
{'title': 'Copying Puppet modules and manifests',
|
||||
'functions': [copyPuppetModules]},
|
||||
'functions': [copy_puppet_modules]},
|
||||
{'title': 'Applying Puppet manifests',
|
||||
'functions': [applyPuppetManifest]},
|
||||
'functions': [apply_puppet_manifest]},
|
||||
{'title': 'Finalizing',
|
||||
'functions': [finalize]}
|
||||
]
|
||||
controller.addSequence("Puppet", [], [], puppetsteps)
|
||||
|
||||
|
||||
def runCleanup(config):
|
||||
#------------------------- helper functions -------------------------
|
||||
|
||||
def wait_for_puppet(currently_running, messages):
|
||||
log_len = 0
|
||||
twirl = ["-", "\\", "|", "/"]
|
||||
while currently_running:
|
||||
for hostname, finished_logfile in currently_running:
|
||||
log_file = os.path.splitext(os.path.basename(finished_logfile))[0]
|
||||
space_len = basedefs.SPACE_LEN - len(log_file)
|
||||
if len(log_file) > log_len:
|
||||
log_len = len(log_file)
|
||||
if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
|
||||
twirl = twirl[-1:] + twirl[:-1]
|
||||
sys.stdout.write(("\rTesting if puppet apply is finished: %s"
|
||||
% log_file).ljust(40 + log_len))
|
||||
sys.stdout.write("[ %s ]" % twirl[0])
|
||||
sys.stdout.flush()
|
||||
try:
|
||||
# Once a remote puppet run has finished, we retrieve the log
|
||||
# file and check it for errors
|
||||
local_server = utils.ScriptRunner()
|
||||
log = os.path.join(basedefs.PUPPET_MANIFEST_DIR,
|
||||
os.path.basename(finished_logfile))
|
||||
log = log.replace(".finished", ".log")
|
||||
local_server.append('scp -o StrictHostKeyChecking=no '
|
||||
'-o UserKnownHostsFile=/dev/null '
|
||||
'root@%s:%s %s'
|
||||
% (hostname, finished_logfile, log))
|
||||
# To not pollute logs we turn of logging of command execution
|
||||
local_server.execute(log=False)
|
||||
|
||||
# If we got to this point the puppet apply has finished
|
||||
currently_running.remove((hostname, finished_logfile))
|
||||
|
||||
# clean off the last "testing apply" msg
|
||||
if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
|
||||
sys.stdout.write(("\r").ljust(45 + log_len))
|
||||
|
||||
except ScriptRuntimeError:
|
||||
# the test raises an exception if the file doesn't exist yet
|
||||
# TO-DO: We need to start testing 'e' for unexpected exceptions
|
||||
time.sleep(3)
|
||||
continue
|
||||
|
||||
# check log file for relevant notices
|
||||
messages.extend(scan_logfile(log))
|
||||
|
||||
# check the log file for errors
|
||||
sys.stdout.write('\r')
|
||||
try:
|
||||
validate_logfile(log)
|
||||
state = utils.state_message('%s:' % log_file, 'DONE', 'green')
|
||||
sys.stdout.write('%s\n' % state)
|
||||
sys.stdout.flush()
|
||||
except PuppetError:
|
||||
state = utils.state_message('%s:' % log_file, 'ERROR', 'red')
|
||||
sys.stdout.write('%s\n' % state)
|
||||
sys.stdout.flush()
|
||||
raise
|
||||
|
||||
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def run_cleanup(config, messages):
|
||||
localserver = utils.ScriptRunner()
|
||||
localserver.append("rm -rf %s/*pp" % basedefs.PUPPET_MANIFEST_DIR)
|
||||
localserver.execute()
|
||||
|
||||
|
||||
def installdeps(config):
|
||||
def install_deps(config, messages):
|
||||
deps = ["puppet", "openssh-clients", "tar", "nc"]
|
||||
modules_pkg = 'openstack-puppet-modules'
|
||||
|
||||
|
@ -91,18 +147,19 @@ def installdeps(config):
|
|||
for hostname in filtered_hosts(config):
|
||||
server = utils.ScriptRunner(hostname)
|
||||
for package in deps:
|
||||
server.append("rpm -q --whatprovides %s || yum install -y %s" % (package, package))
|
||||
server.append("rpm -q --whatprovides %s || yum install -y %s"
|
||||
% (package, package))
|
||||
server.execute()
|
||||
|
||||
|
||||
def copyPuppetModules(config):
|
||||
def copy_puppet_modules(config, messages):
|
||||
os_modules = ' '.join(('apache', 'ceilometer', 'certmonger', 'cinder',
|
||||
'concat', 'firewall', 'glance', 'heat', 'horizon',
|
||||
'inifile', 'keystone', 'memcached', 'mongodb',
|
||||
'mysql', 'neutron', 'nova', 'nssdb', 'openstack',
|
||||
'packstack', 'qpid', 'rabbitmq', 'rsync', 'ssh', 'stdlib',
|
||||
'swift', 'sysctl', 'tempest', 'vcsrepo', 'vlan',
|
||||
'vswitch', 'xinetd'))
|
||||
'packstack', 'qpid', 'rabbitmq', 'rsync', 'ssh',
|
||||
'stdlib', 'swift', 'sysctl', 'tempest', 'vcsrepo',
|
||||
'vlan', 'vswitch', 'xinetd'))
|
||||
|
||||
# write puppet manifest to disk
|
||||
manifestfiles.writeManifests()
|
||||
|
@ -119,9 +176,11 @@ def copyPuppetModules(config):
|
|||
"root@%s tar -C %s -xpzf -" % (hostname, host_dir))
|
||||
|
||||
# copy resources
|
||||
for path, localname in controller.resources.get(hostname, []):
|
||||
resources = config.get('RESOURCES', {})
|
||||
for path, localname in resources.get(hostname, []):
|
||||
server.append("scp -o StrictHostKeyChecking=no "
|
||||
"-o UserKnownHostsFile=/dev/null %s root@%s:%s/resources/%s" %
|
||||
"-o UserKnownHostsFile=/dev/null "
|
||||
"%s root@%s:%s/resources/%s" %
|
||||
(path, hostname, host_dir, localname))
|
||||
|
||||
# copy Puppet modules required by Packstack
|
||||
|
@ -130,65 +189,12 @@ def copyPuppetModules(config):
|
|||
"ssh -o StrictHostKeyChecking=no "
|
||||
"-o UserKnownHostsFile=/dev/null "
|
||||
"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()
|
||||
|
||||
|
||||
def waitforpuppet(currently_running):
|
||||
global controller
|
||||
log_len = 0
|
||||
twirl = ["-","\\","|","/"]
|
||||
while currently_running:
|
||||
for hostname, finished_logfile in currently_running:
|
||||
log_file = os.path.splitext(os.path.basename(finished_logfile))[0]
|
||||
if len(log_file) > log_len:
|
||||
log_len = len(log_file)
|
||||
if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
|
||||
twirl = twirl[-1:] + twirl[:-1]
|
||||
sys.stdout.write(("\rTesting if puppet apply is finished: %s" % log_file).ljust(40 + log_len))
|
||||
sys.stdout.write("[ %s ]" % twirl[0])
|
||||
sys.stdout.flush()
|
||||
try:
|
||||
# Once a remote puppet run has finished, we retrieve the log
|
||||
# file and check it for errors
|
||||
local_server = utils.ScriptRunner()
|
||||
log = os.path.join(basedefs.PUPPET_MANIFEST_DIR,
|
||||
os.path.basename(finished_logfile).replace(".finished", ".log"))
|
||||
local_server.append('scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@%s:%s %s' % (hostname, finished_logfile, log))
|
||||
# To not pollute logs we turn of logging of command execution
|
||||
local_server.execute(log=False)
|
||||
|
||||
# If we got to this point the puppet apply has finished
|
||||
currently_running.remove((hostname, finished_logfile))
|
||||
|
||||
# clean off the last "testing apply" msg
|
||||
if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
|
||||
sys.stdout.write(('\r').ljust(45 + log_len))
|
||||
|
||||
except ScriptRuntimeError:
|
||||
# the test raises an exception if the file doesn't exist yet
|
||||
# TO-DO: We need to start testing 'e' for unexpected exceptions
|
||||
time.sleep(3)
|
||||
continue
|
||||
|
||||
# check log file for relevant notices
|
||||
controller.MESSAGES.extend(scan_logfile(log))
|
||||
|
||||
# check the log file for errors
|
||||
sys.stdout.write('\r')
|
||||
try:
|
||||
validate_logfile(log)
|
||||
state = utils.state_message('%s:' % log_file, 'DONE', 'green')
|
||||
sys.stdout.write('%s\n' % state)
|
||||
sys.stdout.flush()
|
||||
except PuppetError:
|
||||
state = utils.state_message('%s:' % log_file, 'ERROR', 'red')
|
||||
sys.stdout.write('%s\n' % state)
|
||||
sys.stdout.flush()
|
||||
raise
|
||||
|
||||
|
||||
def applyPuppetManifest(config):
|
||||
def apply_puppet_manifest(config, messages):
|
||||
if config.get("DRY_RUN"):
|
||||
return
|
||||
currently_running = []
|
||||
|
@ -201,8 +207,8 @@ def applyPuppetManifest(config):
|
|||
for manifest, marker in manifestfiles.getFiles():
|
||||
# if the marker has changed then we don't want to proceed until
|
||||
# all of the previous puppet runs have finished
|
||||
if lastmarker != None and lastmarker != marker:
|
||||
waitforpuppet(currently_running)
|
||||
if lastmarker is not None and lastmarker != marker:
|
||||
wait_for_puppet(currently_running, messages)
|
||||
lastmarker = marker
|
||||
|
||||
for hostname in filtered_hosts(config):
|
||||
|
@ -220,22 +226,24 @@ def applyPuppetManifest(config):
|
|||
running_logfile = "%s.running" % man_path
|
||||
finished_logfile = "%s.finished" % man_path
|
||||
currently_running.append((hostname, finished_logfile))
|
||||
# The apache puppet module doesn't work if we set FACTERLIB
|
||||
# https://github.com/puppetlabs/puppetlabs-apache/pull/138
|
||||
if not (manifest.endswith('_horizon.pp') or manifest.endswith('_nagios.pp')):
|
||||
server.append("export FACTERLIB=$FACTERLIB:%s/facts" % host_dir)
|
||||
|
||||
server.append("touch %s" % running_logfile)
|
||||
server.append("chmod 600 %s" % running_logfile)
|
||||
server.append("export PACKSTACK_VAR_DIR=%s" % host_dir)
|
||||
command = "( flock %s/ps.lock puppet apply %s --modulepath %s/modules %s > %s 2>&1 < /dev/null ; mv %s %s ) > /dev/null 2>&1 < /dev/null &" % (host_dir, loglevel, host_dir, man_path, running_logfile, running_logfile, finished_logfile)
|
||||
server.append(command)
|
||||
cmd = ("( flock %s/ps.lock "
|
||||
"puppet apply %s --modulepath %s/modules %s > %s "
|
||||
"2>&1 < /dev/null ; "
|
||||
"mv %s %s ) > /dev/null 2>&1 < /dev/null &"
|
||||
% (host_dir, loglevel, host_dir, man_path, running_logfile,
|
||||
running_logfile, finished_logfile))
|
||||
server.append(cmd)
|
||||
server.execute(log=logcmd)
|
||||
|
||||
# wait for outstanding puppet runs befor exiting
|
||||
waitforpuppet(currently_running)
|
||||
wait_for_puppet(currently_running, messages)
|
||||
|
||||
|
||||
def finalize(config):
|
||||
def finalize(config, messages):
|
||||
for hostname in filtered_hosts(config):
|
||||
server = utils.ScriptRunner(hostname)
|
||||
server.append("installed=$(rpm -q kernel --last | head -n1 | "
|
||||
|
@ -245,5 +253,5 @@ def finalize(config):
|
|||
try:
|
||||
rc, out = server.execute()
|
||||
except ScriptRuntimeError:
|
||||
controller.MESSAGES.append('Because of the kernel update the host '
|
||||
'%s requires reboot.' % hostname)
|
||||
messages.append('Because of the kernel update the host %s '
|
||||
'requires reboot.' % hostname)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
prepare server
|
||||
"""
|
||||
|
@ -15,19 +17,14 @@ from packstack.installer import validators
|
|||
|
||||
from packstack.modules.common import filtered_hosts, is_all_in_one
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "OS-SERVERPREPARE"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding SERVERPREPARE KEY configuration")
|
||||
def initConfig(controller):
|
||||
conf_params = {
|
||||
"SERVERPREPARE": [
|
||||
{"CMD_OPTION": "use-epel",
|
||||
|
@ -44,8 +41,10 @@ def initConfig(controllerObject):
|
|||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "additional-repo",
|
||||
"USAGE" : "A comma separated list of URLs to any additional yum repositories to install",
|
||||
"PROMPT" : "Enter a comma separated list of URLs to any additional yum repositories to install",
|
||||
"USAGE": ("A comma separated list of URLs to any additional yum "
|
||||
"repositories to install"),
|
||||
"PROMPT": ("Enter a comma separated list of URLs to any "
|
||||
"additional yum repositories to install"),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": False,
|
||||
|
@ -53,12 +52,14 @@ def initConfig(controllerObject):
|
|||
"CONF_NAME": "CONFIG_REPO",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION" : False }],
|
||||
"CONDITION": False}
|
||||
],
|
||||
|
||||
"RHEL": [
|
||||
{"CMD_OPTION": "rh-username",
|
||||
"USAGE" : "To subscribe each server with Red Hat subscription manager, include this with CONFIG_RH_PW",
|
||||
"PROMPT" : "To subscribe each server to Red Hat enter a username here",
|
||||
"USAGE": ("To subscribe each server with Red Hat subscription "
|
||||
"manager, include this with CONFIG_RH_PW"),
|
||||
"PROMPT": "To subscribe each server to Red Hat enter a username ",
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": False,
|
||||
|
@ -69,8 +70,10 @@ def initConfig(controllerObject):
|
|||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "rh-password",
|
||||
"USAGE" : "To subscribe each server with Red Hat subscription manager, include this with CONFIG_RH_USER",
|
||||
"PROMPT" : "To subscribe each server to Red Hat enter your password here",
|
||||
"USAGE": ("To subscribe each server with Red Hat subscription "
|
||||
"manager, include this with CONFIG_RH_USER"),
|
||||
"PROMPT": ("To subscribe each server to Red Hat enter your "
|
||||
"password"),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": True,
|
||||
|
@ -80,26 +83,13 @@ def initConfig(controllerObject):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION" : "rh-beta-repo",
|
||||
"USAGE" : "To subscribe each server to Red Hat Enterprise Linux 6 Server Beta channel (only needed for Preview versions of RHOS) enter \"y\"",
|
||||
"PROMPT" : "To subscribe each server to Red Hat Enterprise Linux 6 Server Beta channel (only needed for Preview versions of RHOS) enter \"y\"",
|
||||
"OPTION_LIST" : ["y", "n"],
|
||||
"VALIDATORS" : [validators.validate_options],
|
||||
"DEFAULT_VALUE" : "n",
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_RH_BETA_REPO",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
|
||||
{"CMD_OPTION": "rhn-satellite-server",
|
||||
"USAGE" : ("To subscribe each server with RHN Satellite,"
|
||||
"fill Satellite's URL here. Note that either "
|
||||
"satellite's username/password or activation "
|
||||
"key has to be provided"),
|
||||
"PROMPT" : ("To subscribe each server with RHN Satellite "
|
||||
"enter RHN Satellite server URL"),
|
||||
"USAGE": ("To subscribe each server with RHN Satellite,fill "
|
||||
"Satellite's URL here. Note that either satellite's "
|
||||
"username/password or activation key has "
|
||||
"to be provided"),
|
||||
"PROMPT": ("To subscribe each server with RHN Satellite enter "
|
||||
"RHN Satellite server URL"),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": False,
|
||||
|
@ -107,13 +97,14 @@ def initConfig(controllerObject):
|
|||
"CONF_NAME": "CONFIG_SATELLITE_URL",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION" : False }],
|
||||
"CONDITION": False}
|
||||
],
|
||||
|
||||
"SATELLITE": [
|
||||
{"CMD_OPTION": "rhn-satellite-username",
|
||||
"USAGE": "Username to access RHN Satellite",
|
||||
"PROMPT" : ("Enter RHN Satellite username or leave plain "
|
||||
"if you will use activation key instead"),
|
||||
"PROMPT": ("Enter RHN Satellite username or leave plain if you "
|
||||
"will use activation key instead"),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": False,
|
||||
|
@ -125,8 +116,8 @@ def initConfig(controllerObject):
|
|||
|
||||
{"CMD_OPTION": "rhn-satellite-password",
|
||||
"USAGE": "Password to access RHN Satellite",
|
||||
"PROMPT" : ("Enter RHN Satellite password or leave plain "
|
||||
"if you will use activation key instead"),
|
||||
"PROMPT": ("Enter RHN Satellite password or leave plain if you "
|
||||
"will use activation key instead"),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": True,
|
||||
|
@ -138,8 +129,8 @@ def initConfig(controllerObject):
|
|||
|
||||
{"CMD_OPTION": "rhn-satellite-activation-key",
|
||||
"USAGE": "Activation key for subscription to RHN Satellite",
|
||||
"PROMPT" : ("Enter RHN Satellite activation key or leave plain "
|
||||
"if you used username/password instead"),
|
||||
"PROMPT": ("Enter RHN Satellite activation key or leave plain if "
|
||||
"you used username/password instead"),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": True,
|
||||
|
@ -162,12 +153,12 @@ def initConfig(controllerObject):
|
|||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "rhn-satellite-profile",
|
||||
"USAGE" : ("If required specify the profile name that should "
|
||||
"be used as an identifier for the system in RHN "
|
||||
"Satellite"),
|
||||
"PROMPT" : ("If required specify the profile name that should "
|
||||
"be used as an identifier for the system in RHN "
|
||||
"Satellite"),
|
||||
"USAGE": ("If required specify the profile name that should be "
|
||||
"used as an identifier for the system "
|
||||
"in RHN Satellite"),
|
||||
"PROMPT": ("If required specify the profile name that should be "
|
||||
"used as an identifier for the system "
|
||||
"in RHN Satellite"),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": True,
|
||||
|
@ -178,9 +169,10 @@ def initConfig(controllerObject):
|
|||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "rhn-satellite-flags",
|
||||
"USAGE" : ("Comma separated list of flags passed to rhnreg_ks. Valid "
|
||||
"flags are: novirtinfo, norhnsd, nopackages"),
|
||||
"PROMPT" : "Enter comma separated list of flags passed to rhnreg_ks",
|
||||
"USAGE": ("Comma separated list of flags passed to rhnreg_ks. "
|
||||
"Valid flags are: novirtinfo, norhnsd, nopackages"),
|
||||
"PROMPT": ("Enter comma separated list of flags passed "
|
||||
"to rhnreg_ks"),
|
||||
"OPTION_LIST": ['novirtinfo', 'norhnsd', 'nopackages'],
|
||||
"VALIDATORS": [validators.validate_multi_options],
|
||||
"DEFAULT_VALUE": "",
|
||||
|
@ -201,12 +193,15 @@ def initConfig(controllerObject):
|
|||
"CONF_NAME": "CONFIG_SATELLITE_PROXY",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION" : False }],
|
||||
"CONDITION": False}
|
||||
],
|
||||
|
||||
"SATELLITE_PROXY": [
|
||||
{"CMD_OPTION": "rhn-satellite-proxy-username",
|
||||
"USAGE" : "Specify a username to use with an authenticated HTTP proxy",
|
||||
"PROMPT" : "Specify a username to use with an authenticated HTTP proxy",
|
||||
"USAGE": ("Specify a username to use with an authenticated "
|
||||
"HTTP proxy"),
|
||||
"PROMPT": ("Specify a username to use with an authenticated "
|
||||
"HTTP proxy"),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": True,
|
||||
|
@ -217,8 +212,10 @@ def initConfig(controllerObject):
|
|||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "rhn-satellite-proxy-password",
|
||||
"USAGE" : "Specify a password to use with an authenticated HTTP proxy.",
|
||||
"PROMPT" : "Specify a password to use with an authenticated HTTP proxy.",
|
||||
"USAGE": ("Specify a password to use with an authenticated "
|
||||
"HTTP proxy."),
|
||||
"PROMPT": ("Specify a password to use with an authenticated "
|
||||
"HTTP proxy."),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": True,
|
||||
|
@ -226,7 +223,9 @@ def initConfig(controllerObject):
|
|||
"CONF_NAME": "CONFIG_SATELLITE_PROXY_PW",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION" : False }]}
|
||||
"CONDITION": False}
|
||||
]
|
||||
}
|
||||
|
||||
def filled_satellite(config):
|
||||
return bool(config.get('CONFIG_SATELLITE_URL'))
|
||||
|
@ -243,8 +242,8 @@ def initConfig(controllerObject):
|
|||
"POST_CONDITION_MATCH": True},
|
||||
]
|
||||
|
||||
if ((is_all_in_one(controller.CONF) and is_rhel()) or
|
||||
not is_all_in_one(controller.CONF)):
|
||||
config = controller.CONF
|
||||
if (is_all_in_one(config) and is_rhel()) or not is_all_in_one(config):
|
||||
conf_groups.append({"GROUP_NAME": "RHEL",
|
||||
"DESCRIPTION": "RHEL config",
|
||||
"PRE_CONDITION": lambda x: 'yes',
|
||||
|
@ -267,10 +266,19 @@ def initConfig(controllerObject):
|
|||
"POST_CONDITION_MATCH": True})
|
||||
|
||||
for group in conf_groups:
|
||||
paramList = conf_params[group["GROUP_NAME"]]
|
||||
controller.addGroup(group, paramList)
|
||||
params = conf_params[group["GROUP_NAME"]]
|
||||
controller.addGroup(group, params)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
preparesteps = [
|
||||
{'title': 'Preparing servers', 'functions': [server_prep]}
|
||||
]
|
||||
controller.addSequence("Preparing servers", [], [], preparesteps)
|
||||
|
||||
|
||||
#------------------------- helper functions -------------------------
|
||||
|
||||
def is_rhel():
|
||||
return 'Red Hat Enterprise Linux' in platform.linux_distribution()[0]
|
||||
|
||||
|
@ -290,9 +298,8 @@ def run_rhn_reg(host, server_url, username=None, password=None,
|
|||
server = utils.ScriptRunner(host)
|
||||
|
||||
# check satellite server url
|
||||
server_url = server_url.rstrip('/').endswith('/XMLRPC') \
|
||||
and server_url \
|
||||
or '%s/XMLRPC' % server_url
|
||||
server_url = (server_url.rstrip('/').endswith('/XMLRPC')
|
||||
and server_url or '%s/XMLRPC' % server_url)
|
||||
cmd.extend(['--serverUrl', server_url])
|
||||
|
||||
if activation_key:
|
||||
|
@ -339,7 +346,7 @@ def run_rhn_reg(host, server_url, username=None, password=None,
|
|||
server.execute(mask_list=mask)
|
||||
|
||||
|
||||
def run_rhsm_reg(host, username, password, beta):
|
||||
def run_rhsm_reg(host, username, password):
|
||||
"""
|
||||
Registers given host to Red Hat Repositories via subscription manager.
|
||||
"""
|
||||
|
@ -357,12 +364,12 @@ def run_rhsm_reg(host, username, password, beta):
|
|||
"grep -e 'Red Hat OpenStack' -m 1 -A 2 | grep 'Pool Id' | "
|
||||
"awk '{print $3}')")
|
||||
server.append(cmd % pool)
|
||||
server.append("subscription-manager repos --enable rhel-6-server-optional-rpms")
|
||||
server.append("subscription-manager repos "
|
||||
"--enable rhel-6-server-optional-rpms")
|
||||
|
||||
server.append("yum clean all")
|
||||
server.append("rpm -q --whatprovides yum-utils || yum install -y yum-utils")
|
||||
if beta:
|
||||
server.append("yum-config-manager --enable rhel-6-server-beta-rpms")
|
||||
server.append("rpm -q --whatprovides yum-utils || "
|
||||
"yum install -y yum-utils")
|
||||
server.append("yum clean metadata")
|
||||
server.execute(mask_list=[password])
|
||||
|
||||
|
@ -409,7 +416,8 @@ def manage_epel(host, config):
|
|||
server.append('yum-config-manager --%(cmd)s epel' % locals())
|
||||
rc, out = server.execute()
|
||||
|
||||
# yum-config-manager returns 0 always, but returns current setup if succeeds
|
||||
# yum-config-manager returns 0 always, but returns current setup
|
||||
# if succeeds
|
||||
match = re.search('enabled\s*\=\s*%(enabled)s' % locals(), out)
|
||||
if match:
|
||||
return
|
||||
|
@ -428,7 +436,6 @@ def manage_epel(host, config):
|
|||
logger.warn(msg % host)
|
||||
|
||||
|
||||
|
||||
def manage_rdo(host, config):
|
||||
"""
|
||||
Installs and enables RDO repo on host in case it is installed locally.
|
||||
|
@ -457,7 +464,8 @@ def manage_rdo(host, config):
|
|||
reponame = 'openstack-%s' % version
|
||||
server.clear()
|
||||
server.append('yum-config-manager --enable %(reponame)s' % locals())
|
||||
# yum-config-manager returns 0 always, but returns current setup if succeeds
|
||||
# yum-config-manager returns 0 always, but returns current setup
|
||||
# if succeeds
|
||||
rc, out = server.execute()
|
||||
match = re.search('enabled\s*=\s*(1|True)', out)
|
||||
if not match:
|
||||
|
@ -467,14 +475,9 @@ def manage_rdo(host, config):
|
|||
raise exceptions.ScriptRuntimeError(msg)
|
||||
|
||||
|
||||
def initSequences(controller):
|
||||
preparesteps = [
|
||||
{'title': 'Preparing servers', 'functions':[serverprep]}
|
||||
]
|
||||
controller.addSequence("Preparing servers", [], [], preparesteps)
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
|
||||
def serverprep(config):
|
||||
def server_prep(config, messages):
|
||||
rh_username = None
|
||||
sat_url = None
|
||||
if is_rhel():
|
||||
|
@ -489,7 +492,8 @@ def serverprep(config):
|
|||
sat_flags = [i.strip() for i in flag_list if i.strip()]
|
||||
sat_proxy_user = config.get("CONFIG_SATELLITE_PROXY_USER", '')
|
||||
sat_proxy_pass = config.get("CONFIG_SATELLITE_PROXY_PW", '')
|
||||
sat_args = {'username': config["CONFIG_SATELLITE_USER"].strip(),
|
||||
sat_args = {
|
||||
'username': config["CONFIG_SATELLITE_USER"].strip(),
|
||||
'password': config["CONFIG_SATELLITE_PW"].strip(),
|
||||
'cacert': config["CONFIG_SATELLITE_CACERT"].strip(),
|
||||
'activation_key': config["CONFIG_SATELLITE_AKEY"].strip(),
|
||||
|
@ -497,13 +501,13 @@ def serverprep(config):
|
|||
'proxy_host': config["CONFIG_SATELLITE_PROXY"].strip(),
|
||||
'proxy_user': sat_proxy_user.strip(),
|
||||
'proxy_pass': sat_proxy_pass.strip(),
|
||||
'flags': sat_flags}
|
||||
'flags': sat_flags
|
||||
}
|
||||
|
||||
for hostname in filtered_hosts(config):
|
||||
# Subscribe to Red Hat Repositories if configured
|
||||
if rh_username:
|
||||
run_rhsm_reg(hostname, rh_username, rh_password,
|
||||
config["CONFIG_RH_BETA_REPO"] == 'y')
|
||||
run_rhsm_reg(hostname, rh_username, rh_password)
|
||||
|
||||
# Subscribe to RHN Satellite if configured
|
||||
if sat_url and hostname not in sat_registered:
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Installs and configures an OpenStack Swift
|
||||
"""
|
||||
|
@ -13,36 +15,21 @@ from packstack.installer import basedefs
|
|||
from packstack.installer import utils
|
||||
from packstack.installer.utils import split_hosts
|
||||
|
||||
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile, manifestfiles
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile, manifestfiles)
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
# Plugin name
|
||||
PLUGIN_NAME = "OS-SWIFT"
|
||||
#------------------ oVirt installer initialization ------------------
|
||||
|
||||
PLUGIN_NAME = "OS-Swift"
|
||||
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
logging.debug("Adding OpenStack Swift configuration")
|
||||
paramsList = [
|
||||
{"CMD_OPTION" : "os-swift-proxy",
|
||||
"USAGE" : "The IP address on which to install the Swift proxy service (currently only single proxy is supported)",
|
||||
"PROMPT" : "Enter the IP address of the Swift proxy service",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validators.validate_multi_ip, validators.validate_multi_ssh],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_SWIFT_PROXY_HOSTS",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
def initConfig(controller):
|
||||
params = [
|
||||
{"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",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
|
@ -53,21 +40,31 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
{"CMD_OPTION" : "os-swift-storage",
|
||||
"USAGE" : "A comma separated list of IP addresses on which to install the Swift Storage services, each entry should take the format <ipaddress>[/dev], for example 127.0.0.1/vdb will install /dev/vdb on 127.0.0.1 as a swift storage device(packstack does not create the filesystem, you must do this first), if /dev is omitted Packstack will create a loopback device for a test setup",
|
||||
"PROMPT" : "Enter the Swift Storage servers e.g. host/dev,host/dev",
|
||||
|
||||
{"CMD_OPTION": "os-swift-storages",
|
||||
"USAGE": ("A comma separated list of devices which to use as Swift "
|
||||
"Storage device. Each entry should take the format "
|
||||
"/path/to/dev, for example /dev/vdb will install /dev/vdb "
|
||||
"as Swift storage device (packstack does not create "
|
||||
"the filesystem, you must do this first). If value is "
|
||||
"omitted Packstack will create a loopback device for test "
|
||||
"setup"),
|
||||
"PROMPT": "Enter the Swift Storage devices e.g. /path/to/dev",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS" : [validators.validate_not_empty, validate_storage],
|
||||
"DEFAULT_VALUE" : utils.get_localhost_ip(),
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": '',
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_SWIFT_STORAGE_HOSTS",
|
||||
"CONF_NAME": "CONFIG_SWIFT_STORAGES",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-swift-storage-zones",
|
||||
"USAGE" : "Number of swift storage zones, this number MUST be no bigger than the number of storage devices configured",
|
||||
"PROMPT" : "Enter the number of swift storage zones, MUST be no bigger than the number of storage devices configured",
|
||||
"USAGE": ("Number of swift storage zones, this number MUST be "
|
||||
"no bigger than the number of storage devices configured"),
|
||||
"PROMPT": ("Enter the number of swift storage zones, MUST be no "
|
||||
"bigger than the number of storage devices configured"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_integer],
|
||||
"DEFAULT_VALUE": "1",
|
||||
|
@ -77,9 +74,12 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-swift-storage-replicas",
|
||||
"USAGE" : "Number of swift storage replicas, this number MUST be no bigger than the number of storage zones configured",
|
||||
"PROMPT" : "Enter the number of swift storage replicas, MUST be no bigger than the number of storage zones configured",
|
||||
"USAGE": ("Number of swift storage replicas, this number MUST be "
|
||||
"no bigger than the number of storage zones configured"),
|
||||
"PROMPT": ("Enter the number of swift storage replicas, MUST be no "
|
||||
"bigger than the number of storage zones configured"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_integer],
|
||||
"DEFAULT_VALUE": "1",
|
||||
|
@ -89,6 +89,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-swift-storage-fstype",
|
||||
"USAGE": "FileSystem type for storage nodes",
|
||||
"PROMPT": "Enter FileSystem type for storage nodes",
|
||||
|
@ -101,6 +102,7 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-swift-hash",
|
||||
"USAGE": "Shared secret for Swift",
|
||||
"PROMPT": "Enter hash for Swift shared secret",
|
||||
|
@ -113,9 +115,11 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": True,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-swift-storage-size",
|
||||
"USAGE": "Size of the swift loopback file storage device",
|
||||
"PROMPT" : "Enter the size of the storage device (eg. 2G, 2000M, 2000000K)",
|
||||
"PROMPT": ("Enter the size of the storage device (eg. 2G, 2000M, "
|
||||
"2000000K)"),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validate_storage_size],
|
||||
"DEFAULT_VALUE": "2G",
|
||||
|
@ -125,24 +129,36 @@ def initConfig(controllerObject):
|
|||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
]
|
||||
|
||||
groupDict = { "GROUP_NAME" : "OSSWIFT",
|
||||
group = {"GROUP_NAME": "OSSWIFT",
|
||||
"DESCRIPTION": "OpenStack Swift Config parameters",
|
||||
"PRE_CONDITION": "CONFIG_SWIFT_INSTALL",
|
||||
"PRE_CONDITION_MATCH": "y",
|
||||
"POST_CONDITION": False,
|
||||
"POST_CONDITION_MATCH": True}
|
||||
controller.addGroup(group, params)
|
||||
|
||||
|
||||
controller.addGroup(groupDict, paramsList)
|
||||
def initSequences(controller):
|
||||
if controller.CONF['CONFIG_SWIFT_INSTALL'] != 'y':
|
||||
return
|
||||
|
||||
steps = [
|
||||
{'title': 'Adding Swift Keystone manifest entries',
|
||||
'functions': [create_keystone_manifest]},
|
||||
{'title': 'Adding Swift builder manifest entries',
|
||||
'functions': [create_builder_manifest]},
|
||||
{'title': 'Adding Swift proxy manifest entries',
|
||||
'functions': [create_proxy_manifest]},
|
||||
{'title': 'Adding Swift storage manifest entries',
|
||||
'functions': [create_storage_manifest]},
|
||||
{'title': 'Adding Swift common manifest entries',
|
||||
'functions': [create_common_manifest]},
|
||||
]
|
||||
controller.addSequence("Installing OpenStack Swift", [], [], steps)
|
||||
|
||||
|
||||
def validate_storage(param, options=None):
|
||||
for host in param.split(','):
|
||||
host = host.split('/', 1)[0]
|
||||
validators.validate_ip(host.strip(), options)
|
||||
#------------------------- helper functions -------------------------
|
||||
|
||||
def validate_storage_size(param, options=None):
|
||||
match = re.match(r'\d+G|\d+M|\d+K', param, re.IGNORECASE)
|
||||
|
@ -150,78 +166,28 @@ def validate_storage_size(param, options=None):
|
|||
msg = 'Storage size not have a valid value (eg. 1G, 1000M, 1000000K)'
|
||||
raise ParamValidationError(msg)
|
||||
|
||||
def initSequences(controller):
|
||||
if controller.CONF['CONFIG_SWIFT_INSTALL'] != 'y':
|
||||
return
|
||||
|
||||
steps = [
|
||||
{'title': 'Adding Swift Keystone manifest entries', 'functions':[createkeystonemanifest]},
|
||||
{'title': 'Adding Swift builder manifest entries', 'functions':[createbuildermanifest]},
|
||||
{'title': 'Adding Swift proxy manifest entries', 'functions':[createproxymanifest]},
|
||||
{'title': 'Adding Swift storage manifest entries', 'functions':[createstoragemanifest]},
|
||||
{'title': 'Adding Swift common manifest entries', 'functions':[createcommonmanifest]},
|
||||
]
|
||||
|
||||
controller.addSequence("Installing OpenStack Swift", [], [], steps)
|
||||
|
||||
|
||||
def createkeystonemanifest(config):
|
||||
manifestfile = "%s_keystone.pp"%controller.CONF['CONFIG_KEYSTONE_HOST']
|
||||
controller.CONF['CONFIG_SWIFT_PROXY'] = controller.CONF['CONFIG_SWIFT_PROXY_HOSTS'].split(',')[0]
|
||||
manifestdata = getManifestTemplate("keystone_swift.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
devices = []
|
||||
def parse_devices(config_swift_storage_hosts):
|
||||
def parse_devices(config):
|
||||
"""
|
||||
Returns dict containing information about Swift storage devices.
|
||||
"""
|
||||
devices = []
|
||||
device_number = 0
|
||||
num_zones = int(controller.CONF["CONFIG_SWIFT_STORAGE_ZONES"])
|
||||
for host in config_swift_storage_hosts.split(","):
|
||||
host = host.strip()
|
||||
num_zones = int(config["CONFIG_SWIFT_STORAGE_ZONES"])
|
||||
for device in config["CONFIG_SWIFT_STORAGES"].split(","):
|
||||
device = device.strip()
|
||||
if not device:
|
||||
continue
|
||||
device_number += 1
|
||||
device = None
|
||||
if '/' in host:
|
||||
host, device = map(lambda x: x.strip(), host.split('/', 1))
|
||||
zone = str((device_number % num_zones) + 1)
|
||||
devices.append({'host': host, 'device': device, 'zone': zone,
|
||||
devices.append({'device': device, 'zone': zone,
|
||||
'device_name': 'device%s' % device_number})
|
||||
if not devices:
|
||||
devices.append({'device': None, 'zone': 1,
|
||||
'device_name': 'swiftloopback'})
|
||||
return devices
|
||||
|
||||
|
||||
# The ring file should be built and distributed befor the storage services
|
||||
# come up. Specifically the replicator crashes if the ring isn't present
|
||||
def createbuildermanifest(config):
|
||||
# TODO : put this on the proxy server, will need to change this later
|
||||
controller.CONF['CONFIG_SWIFT_BUILDER_HOST'] = controller.CONF['CONFIG_SWIFT_PROXY_HOSTS'].split(',')[0]
|
||||
manifestfile = "%s_ring_swift.pp"%controller.CONF['CONFIG_SWIFT_BUILDER_HOST']
|
||||
manifestdata = getManifestTemplate("swift_builder.pp")
|
||||
|
||||
# Add each device to the ring
|
||||
devicename = 0
|
||||
for device in parse_devices(controller.CONF["CONFIG_SWIFT_STORAGE_HOSTS"]):
|
||||
host = device['host']
|
||||
devicename = device['device_name']
|
||||
zone = device['zone']
|
||||
|
||||
manifestdata = manifestdata + '\n@@ring_object_device { "%s:6000/%s":\n zone => %s,\n weight => 10, }'%(host, devicename, zone)
|
||||
manifestdata = manifestdata + '\n@@ring_container_device { "%s:6001/%s":\n zone => %s,\n weight => 10, }'%(host, devicename, zone)
|
||||
manifestdata = manifestdata + '\n@@ring_account_device { "%s:6002/%s":\n zone => %s,\n weight => 10, }'%(host, devicename, zone)
|
||||
|
||||
appendManifestFile(manifestfile, manifestdata, 'swiftbuilder')
|
||||
|
||||
|
||||
def createproxymanifest(config):
|
||||
manifestfile = "%s_swift.pp"%controller.CONF['CONFIG_SWIFT_PROXY_HOSTS']
|
||||
manifestdata = getManifestTemplate("swift_proxy.pp")
|
||||
# If the proxy server is also a storage server then swift::ringsync will be included for the storage server
|
||||
if controller.CONF['CONFIG_SWIFT_PROXY_HOSTS'] not in [h['host'] for h in devices]:
|
||||
manifestdata += 'swift::ringsync{["account","container","object"]:\n ring_server => "%s"\n}'%controller.CONF['CONFIG_SWIFT_BUILDER_HOST']
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def check_device(host, device):
|
||||
"""
|
||||
Raises ScriptRuntimeError if given device is not mounted on given
|
||||
|
@ -230,62 +196,102 @@ def check_device(host, device):
|
|||
server = utils.ScriptRunner(host)
|
||||
|
||||
# the device MUST exist
|
||||
cmd = 'ls -l /dev/%s'
|
||||
cmd = 'ls -l %s'
|
||||
server.append(cmd % device)
|
||||
|
||||
# if it is not mounted then we can use it
|
||||
cmd = 'grep "/dev/%s " /proc/self/mounts || exit 0'
|
||||
cmd = 'grep "%s " /proc/self/mounts || exit 0'
|
||||
server.append(cmd % device)
|
||||
|
||||
# if it is mounted then the mount point has to be in /srv/node
|
||||
cmd = 'grep "/dev/%s /srv/node" /proc/self/mounts && exit 0'
|
||||
cmd = 'grep "%s /srv/node" /proc/self/mounts && exit 0'
|
||||
server.append(cmd % device)
|
||||
|
||||
# if we got here without exiting then we can't use this device
|
||||
server.append('exit 1')
|
||||
server.execute()
|
||||
return False
|
||||
|
||||
def get_storage_size(size):
|
||||
|
||||
def get_storage_size(config):
|
||||
ranges = {'G': 1048576, 'M': 1024, 'K': 1}
|
||||
size.strip()
|
||||
size = config['CONFIG_SWIFT_STORAGE_SIZE'].strip()
|
||||
for measure in ['G', 'M', 'K']:
|
||||
if re.match('\d+' + measure, size, re.IGNORECASE):
|
||||
intsize = int(size.rstrip(measure)) * ranges[measure]
|
||||
return intsize
|
||||
|
||||
def createstoragemanifest(config):
|
||||
|
||||
# this need to happen once per storage host
|
||||
for host in set([device['host'] for device in devices]):
|
||||
controller.CONF["CONFIG_SWIFT_STORAGE_CURRENT"] = host
|
||||
manifestfile = "%s_swift.pp"%host
|
||||
manifestdata = getManifestTemplate("swift_storage.pp")
|
||||
#-------------------------- step functions --------------------------
|
||||
|
||||
def create_keystone_manifest(config, messages):
|
||||
# parse devices in first step
|
||||
global devices
|
||||
devices = parse_devices(config)
|
||||
manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("keystone_swift.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def create_builder_manifest(config, messages):
|
||||
global devices
|
||||
# The ring file should be built and distributed before the storage services
|
||||
# come up. Specifically the replicator crashes if the ring isn't present
|
||||
|
||||
def device_def(dev_type, host, dev_port, devicename, zone):
|
||||
fmt = ('\n@@%s { "%s:%s/%s":\n'
|
||||
' zone => %s,\n'
|
||||
' weight => 10, }\n')
|
||||
return fmt % (dev_type, host, dev_port, devicename, zone)
|
||||
|
||||
manifestfile = "%s_ring_swift.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("swift_builder.pp")
|
||||
|
||||
# Add each device to the ring
|
||||
devicename = 0
|
||||
for device in devices:
|
||||
host = config['CONFIG_CONTROLLER_HOST']
|
||||
devicename = device['device_name']
|
||||
zone = device['zone']
|
||||
for dev_type, dev_port in [('ring_object_device', 6000),
|
||||
('ring_container_device', 6001),
|
||||
('ring_account_device', 6002)]:
|
||||
manifestdata += device_def(dev_type, host, dev_port, devicename,
|
||||
zone)
|
||||
appendManifestFile(manifestfile, manifestdata, 'swiftbuilder')
|
||||
|
||||
|
||||
def create_proxy_manifest(config, messages):
|
||||
manifestfile = "%s_swift.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("swift_proxy.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def create_storage_manifest(config, messages):
|
||||
global devices
|
||||
|
||||
manifestfile = "%s_swift.pp" % config['CONFIG_CONTROLLER_HOST']
|
||||
manifestdata = getManifestTemplate("swift_storage.pp")
|
||||
|
||||
# this need to happen once per storage device
|
||||
for device in devices:
|
||||
host = device['host']
|
||||
host = config['CONFIG_CONTROLLER_HOST']
|
||||
devicename = device['device_name']
|
||||
device = device['device']
|
||||
fstype = config["CONFIG_SWIFT_STORAGE_FSTYPE"]
|
||||
if device:
|
||||
check_device(host, device)
|
||||
|
||||
manifestfile = "%s_swift.pp"%host
|
||||
if device:
|
||||
manifestdata = "\n" + 'swift::storage::%s{"%s":\n device => "/dev/%s",\n}'% (controller.CONF["CONFIG_SWIFT_STORAGE_FSTYPE"], devicename, device)
|
||||
manifestdata += ('\nswift::storage::%s { "%s":\n'
|
||||
' device => "%s",\n}\n'
|
||||
% (fstype, devicename, device))
|
||||
else:
|
||||
config['SWIFT_STORAGE_SEEK'] = get_storage_size(config['CONFIG_SWIFT_STORAGE_SIZE'])
|
||||
controller.CONF["SWIFT_STORAGE_DEVICES"] = "'%s'"%devicename
|
||||
manifestdata = "\n" + getManifestTemplate("swift_loopback.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
# create loopback device if none was specified
|
||||
config['CONFIG_SWIFT_STORAGE_SEEK'] = get_storage_size(config)
|
||||
manifestdata += "\n" + getManifestTemplate("swift_loopback.pp")
|
||||
|
||||
# set allowed hosts for firewall
|
||||
swift_hosts = get_swift_hosts(config)
|
||||
hosts = swift_hosts.copy()
|
||||
manifestdata = ""
|
||||
hosts = set([config['CONFIG_CONTROLLER_HOST']])
|
||||
if config['CONFIG_NOVA_INSTALL'] == 'y':
|
||||
hosts |= split_hosts(config['CONFIG_NOVA_COMPUTE_HOSTS'])
|
||||
hosts |= split_hosts(config['CONFIG_COMPUTE_HOSTS'])
|
||||
|
||||
config['FIREWALL_SERVICE_NAME'] = "swift storage and rsync"
|
||||
config['FIREWALL_PORTS'] = "'6000', '6001', '6002', '873'"
|
||||
|
@ -296,22 +302,11 @@ def createstoragemanifest(config):
|
|||
config['FIREWALL_SERVICE_ID'] = "swift_storage_and_rsync_%s" % host
|
||||
manifestdata += getManifestTemplate("firewall.pp")
|
||||
|
||||
for host in swift_hosts:
|
||||
manifestfile = "%s_swift.pp" % host
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
|
||||
def createcommonmanifest(config):
|
||||
def create_common_manifest(config, messages):
|
||||
for manifestfile, marker in manifestfiles.getFiles():
|
||||
if manifestfile.endswith("_swift.pp"):
|
||||
data = getManifestTemplate("swift_common.pp")
|
||||
appendManifestFile(os.path.split(manifestfile)[1], data)
|
||||
|
||||
|
||||
def get_swift_hosts(config):
|
||||
"""Get a set of all the Swift hosts"""
|
||||
hosts = split_hosts(config['CONFIG_SWIFT_STORAGE_HOSTS'])
|
||||
# remove "/device" from the storage host names
|
||||
hosts = set(host.split('/', 1)[0] for host in hosts)
|
||||
hosts |= split_hosts(config['CONFIG_SWIFT_PROXY_HOSTS'])
|
||||
return hosts
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$amqp = '%(CONFIG_AMQP_SERVER)s'
|
||||
$amqp = '%(CONFIG_AMQP_BACKEND)s'
|
||||
case $amqp {
|
||||
'qpid': {
|
||||
enable_qpid {"qpid":
|
||||
|
|
|
@ -6,7 +6,7 @@ class { 'ceilometer::collector':
|
|||
}
|
||||
|
||||
class { 'ceilometer::agent::auth':
|
||||
auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
|
||||
auth_url => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
|
||||
auth_password => '%(CONFIG_CEILOMETER_KS_PW)s',
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,6 @@ class { 'ceilometer::alarm::evaluator':
|
|||
}
|
||||
|
||||
class { 'ceilometer::api':
|
||||
keystone_host => '%(CONFIG_KEYSTONE_HOST)s',
|
||||
keystone_host => '%(CONFIG_CONTROLLER_HOST)s',
|
||||
keystone_password => '%(CONFIG_CEILOMETER_KS_PW)s',
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
cinder_config {
|
||||
"DEFAULT/glance_host": value => "%(CONFIG_GLANCE_HOST)s";
|
||||
"DEFAULT/glance_host": value => "%(CONFIG_CONTROLLER_HOST)s";
|
||||
}
|
||||
|
||||
package {'python-keystone':
|
||||
|
@ -10,7 +10,7 @@ class {'cinder::api':
|
|||
keystone_password => '%(CONFIG_CINDER_KS_PW)s',
|
||||
keystone_tenant => "services",
|
||||
keystone_user => "cinder",
|
||||
keystone_auth_host => "%(CONFIG_KEYSTONE_HOST)s",
|
||||
keystone_auth_host => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
}
|
||||
|
||||
class {'cinder::scheduler':
|
||||
|
@ -20,5 +20,5 @@ class {'cinder::volume':
|
|||
}
|
||||
|
||||
class {'cinder::volume::iscsi':
|
||||
iscsi_ip_address => '%(CONFIG_CINDER_HOST)s'
|
||||
iscsi_ip_address => '%(CONFIG_CONTROLLER_HOST)s'
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ class {'cinder::backup':
|
|||
}
|
||||
|
||||
class {'cinder::backup::swift':
|
||||
backup_swift_url => 'http://%(CONFIG_SWIFT_PROXY)s:8080/v1/AUTH_'
|
||||
backup_swift_url => 'http://%(CONFIG_CONTROLLER_HOST)s:8080/v1/AUTH_'
|
||||
}
|
||||
|
||||
Class['cinder::api'] ~> Service['cinder-backup']
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
class {"glance::api":
|
||||
auth_host => "%(CONFIG_KEYSTONE_HOST)s",
|
||||
auth_host => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
keystone_tenant => "services",
|
||||
keystone_user => "glance",
|
||||
keystone_password => "%(CONFIG_GLANCE_KS_PW)s",
|
||||
|
@ -13,7 +13,7 @@ class {"glance::api":
|
|||
class { 'glance::backend::file': }
|
||||
|
||||
class {"glance::registry":
|
||||
auth_host => "%(CONFIG_KEYSTONE_HOST)s",
|
||||
auth_host => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
keystone_tenant => "services",
|
||||
keystone_user => "glance",
|
||||
keystone_password => "%(CONFIG_GLANCE_KS_PW)s",
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
|
||||
class { 'heat::api':
|
||||
}
|
||||
|
||||
class { 'heat::engine':
|
||||
heat_metadata_server_url => 'http://%(CONFIG_HEAT_METADATA_HOST)s:8000',
|
||||
heat_waitcondition_server_url => 'http://%(CONFIG_HEAT_METADATA_HOST)s:8000/v1/waitcondition',
|
||||
heat_watch_server_url => 'http://%(CONFIG_HEAT_WATCH_HOST)s:8003',
|
||||
heat_metadata_server_url => 'http://%(CONFIG_CONTROLLER_HOST)s:8000',
|
||||
heat_waitcondition_server_url => 'http://%(CONFIG_CONTROLLER_HOST)s:8000/v1/waitcondition',
|
||||
heat_watch_server_url => 'http://%(CONFIG_CONTROLLER_HOST)s:8003',
|
||||
auth_encryption_key => '%(CONFIG_HEAT_AUTH_ENC_KEY)s',
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
|
||||
class { 'heat::api_cfn':
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
|
||||
class { 'heat::api_cloudwatch':
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class { 'heat':
|
||||
keystone_host => '%(CONFIG_KEYSTONE_HOST)s',
|
||||
keystone_host => '%(CONFIG_CONTROLLER_HOST)s',
|
||||
keystone_password => '%(CONFIG_HEAT_KS_PW)s',
|
||||
auth_uri => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
|
||||
auth_uri => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
|
||||
rpc_backend => 'heat.openstack.common.rpc.impl_qpid',
|
||||
qpid_hostname => '%(CONFIG_AMQP_HOST)s',
|
||||
qpid_username => '%(CONFIG_AMQP_AUTH_USER)s',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class { 'heat':
|
||||
keystone_host => '%(CONFIG_KEYSTONE_HOST)s',
|
||||
keystone_host => '%(CONFIG_CONTROLLER_HOST)s',
|
||||
keystone_password => '%(CONFIG_HEAT_KS_PW)s',
|
||||
auth_uri => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
|
||||
auth_uri => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
|
||||
rpc_backend => 'heat.openstack.common.rpc.impl_kombu',
|
||||
rabbit_host => '%(CONFIG_AMQP_HOST)s',
|
||||
rabbit_userid => '%(CONFIG_AMQP_AUTH_USER)s',
|
||||
|
|
|
@ -9,9 +9,9 @@ package {$horizon_packages:
|
|||
|
||||
class {'horizon':
|
||||
secret_key => '%(CONFIG_HORIZON_SECRET_KEY)s',
|
||||
keystone_host => '%(CONFIG_KEYSTONE_HOST)s',
|
||||
keystone_host => '%(CONFIG_CONTROLLER_HOST)s',
|
||||
keystone_default_role => '_member_',
|
||||
fqdn => ['%(CONFIG_HORIZON_HOST)s', "$::fqdn", 'localhost'],
|
||||
fqdn => ['%(CONFIG_CONTROLLER_HOST)s', "$::fqdn", 'localhost'],
|
||||
can_set_mount_point => 'False',
|
||||
help_url =>'http://docs.openstack.org',
|
||||
django_debug => %(CONFIG_DEBUG_MODE)s ? {true => 'True', false => 'False'},
|
||||
|
|
|
@ -14,9 +14,9 @@ class {"keystone::roles::admin":
|
|||
}
|
||||
|
||||
class {"keystone::endpoint":
|
||||
public_address => "%(CONFIG_KEYSTONE_HOST)s",
|
||||
admin_address => "%(CONFIG_KEYSTONE_HOST)s",
|
||||
internal_address => "%(CONFIG_KEYSTONE_HOST)s",
|
||||
public_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
}
|
||||
|
||||
# Run token flush every minute (without output so we won't spam admins)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
class { 'ceilometer::keystone::auth':
|
||||
password => '%(CONFIG_CEILOMETER_KS_PW)s',
|
||||
public_address => "%(CONFIG_CEILOMETER_HOST)s",
|
||||
admin_address => "%(CONFIG_CEILOMETER_HOST)s",
|
||||
internal_address => "%(CONFIG_CEILOMETER_HOST)s",
|
||||
public_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
class {"cinder::keystone::auth":
|
||||
password => "%(CONFIG_CINDER_KS_PW)s",
|
||||
public_address => "%(CONFIG_CINDER_HOST)s",
|
||||
admin_address => "%(CONFIG_CINDER_HOST)s",
|
||||
internal_address => "%(CONFIG_CINDER_HOST)s",
|
||||
public_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
}
|
||||
|
||||
keystone_service { "${cinder::keystone::auth::auth_name}_v2":
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
class {"glance::keystone::auth":
|
||||
password => "%(CONFIG_GLANCE_KS_PW)s",
|
||||
public_address => "%(CONFIG_GLANCE_HOST)s",
|
||||
admin_address => "%(CONFIG_GLANCE_HOST)s",
|
||||
internal_address => "%(CONFIG_GLANCE_HOST)s",
|
||||
public_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
# heat::keystone::auth
|
||||
class {"heat::keystone::auth":
|
||||
password => "%(CONFIG_HEAT_KS_PW)s",
|
||||
public_address => "%(CONFIG_HEAT_HOST)s",
|
||||
admin_address => "%(CONFIG_HEAT_HOST)s",
|
||||
internal_address => "%(CONFIG_HEAT_HOST)s",
|
||||
public_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
}
|
||||
|
||||
if '%(CONFIG_HEAT_CFN_INSTALL)s' == 'y' {
|
||||
# heat::keystone::cfn
|
||||
class {"heat::keystone::auth_cfn":
|
||||
password => "%(CONFIG_HEAT_KS_PW)s",
|
||||
public_address => "%(CONFIG_HEAT_HOST)s",
|
||||
admin_address => "%(CONFIG_HEAT_HOST)s",
|
||||
internal_address => "%(CONFIG_HEAT_HOST)s",
|
||||
public_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
class {"neutron::keystone::auth":
|
||||
password => "%(CONFIG_NEUTRON_KS_PW)s",
|
||||
public_address => "%(CONFIG_NEUTRON_SERVER_HOST)s",
|
||||
admin_address => "%(CONFIG_NEUTRON_SERVER_HOST)s",
|
||||
internal_address => "%(CONFIG_NEUTRON_SERVER_HOST)s",
|
||||
public_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
class {"nova::keystone::auth":
|
||||
password => "%(CONFIG_NOVA_KS_PW)s",
|
||||
public_address => "%(CONFIG_NOVA_API_HOST)s",
|
||||
admin_address => "%(CONFIG_NOVA_API_HOST)s",
|
||||
internal_address => "%(CONFIG_NOVA_API_HOST)s",
|
||||
public_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
admin_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
internal_address => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
cinder => true,
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class { 'swift::keystone::auth':
|
||||
public_address => '%(CONFIG_SWIFT_PROXY)s',
|
||||
public_address => '%(CONFIG_CONTROLLER_HOST)s',
|
||||
password => '%(CONFIG_SWIFT_KS_PW)s',
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class nagios_configs(){
|
|||
file_line{'allowed_hosts':
|
||||
path => '/etc/nagios/nrpe.cfg',
|
||||
match => 'allowed_hosts=',
|
||||
line => 'allowed_hosts=%(CONFIG_NAGIOS_HOST)s',
|
||||
line => 'allowed_hosts=%(CONFIG_CONTROLLER_HOST)s',
|
||||
}
|
||||
|
||||
# 5 minute load average
|
||||
|
@ -41,5 +41,3 @@ service{'nrpe':
|
|||
enable => true,
|
||||
hasstatus => true,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class nagios_configs(){
|
|||
content => "export OS_USERNAME=admin
|
||||
export OS_TENANT_NAME=admin
|
||||
export OS_PASSWORD=%(CONFIG_KEYSTONE_ADMIN_PW)s
|
||||
export OS_AUTH_URL=http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0/ ",}
|
||||
export OS_AUTH_URL=http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0/ ",}
|
||||
|
||||
%(CONFIG_NAGIOS_MANIFEST_CONFIG)s
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ class { 'neutron::server':
|
|||
sql_connection => $neutron_sql_connection,
|
||||
connection => $neutron_sql_connection,
|
||||
auth_password => $neutron_user_password,
|
||||
auth_host => '%(CONFIG_KEYSTONE_HOST)s',
|
||||
auth_host => '%(CONFIG_CONTROLLER_HOST)s',
|
||||
enabled => true,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class {'neutron::agents::metadata':
|
||||
auth_password => '%(CONFIG_NEUTRON_KS_PW)s',
|
||||
auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
|
||||
auth_url => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
|
||||
shared_secret => '%(CONFIG_NEUTRON_METADATA_PW)s',
|
||||
metadata_ip => '%(CONFIG_NOVA_API_HOST)s',
|
||||
metadata_ip => '%(CONFIG_CONTROLLER_HOST)s',
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ class { 'neutron::server::notifications':
|
|||
nova_admin_username => 'nova',
|
||||
nova_admin_password => '%(CONFIG_NOVA_KS_PW)s',
|
||||
nova_admin_tenant_name => 'services',
|
||||
nova_url => 'http://%(CONFIG_NOVA_API_HOST)s:8774/v2',
|
||||
nova_admin_auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
|
||||
nova_url => 'http://%(CONFIG_CONTROLLER_HOST)s:8774/v2',
|
||||
nova_admin_auth_url => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require 'keystone::python'
|
||||
class {"nova::api":
|
||||
enabled => true,
|
||||
auth_host => "%(CONFIG_KEYSTONE_HOST)s",
|
||||
auth_host => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
admin_password => "%(CONFIG_NOVA_KS_PW)s",
|
||||
neutron_metadata_proxy_shared_secret => %(CONFIG_NEUTRON_METADATA_PW_UNQUOTED)s
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
class { 'ceilometer::agent::auth':
|
||||
auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0',
|
||||
auth_url => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0',
|
||||
auth_password => '%(CONFIG_CEILOMETER_KS_PW)s',
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,5 @@ Firewall <| |> -> Class['nova']
|
|||
|
||||
nova_config{
|
||||
"DEFAULT/sql_connection": value => "%(CONFIG_NOVA_SQL_CONN)s";
|
||||
"DEFAULT/metadata_host": value => "%(CONFIG_NOVA_METADATA_HOST)s";
|
||||
"DEFAULT/metadata_host": value => "%(CONFIG_CONTROLLER_HOST)s";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
class { "nova":
|
||||
glance_api_servers => "%(CONFIG_GLANCE_HOST)s:9292",
|
||||
glance_api_servers => "%(CONFIG_CONTROLLER_HOST)s:9292",
|
||||
qpid_hostname => "%(CONFIG_AMQP_HOST)s",
|
||||
qpid_username => '%(CONFIG_AMQP_AUTH_USER)s',
|
||||
qpid_password => '%(CONFIG_AMQP_AUTH_PASSWORD)s',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
class { "nova":
|
||||
glance_api_servers => "%(CONFIG_GLANCE_HOST)s:9292",
|
||||
glance_api_servers => "%(CONFIG_CONTROLLER_HOST)s:9292",
|
||||
rabbit_host => "%(CONFIG_AMQP_HOST)s",
|
||||
rabbit_port => '%(CONFIG_AMQP_CLIENTS_PORT)s',
|
||||
rabbit_userid => '%(CONFIG_AMQP_AUTH_USER)s',
|
||||
|
|
|
@ -26,7 +26,7 @@ nova_config{
|
|||
|
||||
class {"nova::compute":
|
||||
enabled => true,
|
||||
vncproxy_host => "%(CONFIG_NOVA_VNCPROXY_HOST)s",
|
||||
vncproxy_host => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
vncserver_proxyclient_address => "%(CONFIG_NOVA_COMPUTE_HOST)s",
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
class {"nova::network::neutron":
|
||||
neutron_admin_password => "%(CONFIG_NEUTRON_KS_PW)s",
|
||||
neutron_auth_strategy => "keystone",
|
||||
neutron_url => "http://%(CONFIG_NEUTRON_SERVER_HOST)s:9696",
|
||||
neutron_url => "http://%(CONFIG_CONTROLLER_HOST)s:9696",
|
||||
neutron_admin_tenant_name => "services",
|
||||
neutron_admin_auth_url => "http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0",
|
||||
neutron_admin_auth_url => "http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0",
|
||||
}
|
||||
|
||||
class {"nova::compute::neutron":
|
||||
|
|
|
@ -8,7 +8,7 @@ package { $clientlibs: }
|
|||
$rcadmin_content = "export OS_USERNAME=admin
|
||||
export OS_TENANT_NAME=admin
|
||||
export OS_PASSWORD=%(CONFIG_KEYSTONE_ADMIN_PW)s
|
||||
export OS_AUTH_URL=http://%(CONFIG_KEYSTONE_HOST)s:5000/v2.0/
|
||||
export OS_AUTH_URL=http://%(CONFIG_CONTROLLER_HOST)s:5000/v2.0/
|
||||
export PS1='[\\u@\\h \\W(keystone_admin)]\\$ '
|
||||
"
|
||||
|
||||
|
@ -25,7 +25,7 @@ if '%(CONFIG_PROVISION_DEMO)s' == 'y' {
|
|||
content => "export OS_USERNAME=demo
|
||||
export OS_TENANT_NAME=demo
|
||||
export OS_PASSWORD=%(CONFIG_KEYSTONE_DEMO_PW)s
|
||||
export OS_AUTH_URL=http://%(CONFIG_KEYSTONE_HOST)s:5000/v2.0/
|
||||
export OS_AUTH_URL=http://%(CONFIG_CONTROLLER_HOST)s:5000/v2.0/
|
||||
export PS1='[\\u@\\h \\W(keystone_demo)]\\$ '
|
||||
",
|
||||
}
|
||||
|
|
|
@ -8,11 +8,7 @@ class { 'swift::ringbuilder':
|
|||
|
||||
# sets up an rsync db that can be used to sync the ring DB
|
||||
class { 'swift::ringserver':
|
||||
local_net_ip => "%(CONFIG_SWIFT_BUILDER_HOST)s",
|
||||
}
|
||||
|
||||
@@swift::ringsync { ['account', 'object', 'container']:
|
||||
ring_server => $swift_local_net_ip
|
||||
local_net_ip => "%(CONFIG_CONTROLLER_HOST)s",
|
||||
}
|
||||
|
||||
if ($::selinux != "false"){
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
swift::storage::loopback { [%(SWIFT_STORAGE_DEVICES)s]:
|
||||
swift::storage::loopback { 'swift_loopback':
|
||||
base_dir => '/srv/loopback-device',
|
||||
mnt_base_dir => '/srv/node',
|
||||
require => Class['swift'],
|
||||
fstype => '%(CONFIG_SWIFT_STORAGE_FSTYPE)s',
|
||||
seek => '%(SWIFT_STORAGE_SEEK)s',
|
||||
seek => '%(CONFIG_SWIFT_STORAGE_SEEK)s',
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ class { 'memcached':
|
|||
}
|
||||
|
||||
class { 'swift::proxy':
|
||||
proxy_local_net_ip => '%(CONFIG_SWIFT_PROXY)s',
|
||||
proxy_local_net_ip => '%(CONFIG_CONTROLLER_HOST)s',
|
||||
pipeline => [
|
||||
'bulk',
|
||||
'catch_errors',
|
||||
|
@ -62,7 +62,7 @@ class { 'swift::proxy::authtoken':
|
|||
admin_tenant_name => 'services',
|
||||
admin_password => '%(CONFIG_SWIFT_KS_PW)s',
|
||||
# assume that the controller host is the swift api server
|
||||
auth_host => '%(CONFIG_KEYSTONE_HOST)s',
|
||||
auth_host => '%(CONFIG_CONTROLLER_HOST)s',
|
||||
}
|
||||
|
||||
firewall { '001 swift proxy incoming':
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
# install all swift storage servers together
|
||||
class { 'swift::storage::all':
|
||||
storage_local_net_ip => '%(CONFIG_SWIFT_STORAGE_CURRENT)s',
|
||||
storage_local_net_ip => '%(CONFIG_CONTROLLER_HOST)s',
|
||||
allow_versions => true,
|
||||
require => Class['swift'],
|
||||
}
|
||||
|
@ -16,9 +16,7 @@ if(!defined(File['/srv/node'])) {
|
|||
}
|
||||
|
||||
swift::ringsync{ ["account", "container", "object"]:
|
||||
ring_server => '%(CONFIG_SWIFT_BUILDER_HOST)s',
|
||||
ring_server => '%(CONFIG_CONTROLLER_HOST)s',
|
||||
before => Class['swift::storage::all'],
|
||||
require => Class['swift'],
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class StepTestCase(PackstackTestCaseMixin, TestCase):
|
|||
"""
|
||||
Test packstack.instaler.core.sequences.Step run.
|
||||
"""
|
||||
def func(config):
|
||||
def func(config, messages):
|
||||
if 'test' not in config:
|
||||
raise AssertionError('Missing config value.')
|
||||
|
||||
|
@ -59,11 +59,11 @@ class SequenceTestCase(PackstackTestCaseMixin, TestCase):
|
|||
self._stdout = sys.stdout
|
||||
sys.stdout = StringIO.StringIO()
|
||||
|
||||
self.steps = [{'name': '1', 'function': lambda x: True,
|
||||
self.steps = [{'name': '1', 'function': lambda x, y: True,
|
||||
'title': 'Step 1'},
|
||||
{'name': '2', 'function': lambda x: True,
|
||||
{'name': '2', 'function': lambda x, y: True,
|
||||
'title': 'Step 2'},
|
||||
{'name': '3', 'function': lambda x: True,
|
||||
{'name': '3', 'function': lambda x, y: True,
|
||||
'title': 'Step 3'}]
|
||||
|
||||
self.seq = Sequence('test', self.steps, condition='test',
|
||||
|
|
3
tox.ini
3
tox.ini
|
@ -18,8 +18,7 @@ downloadcache = ~/cache/pip
|
|||
[testenv:pep8]
|
||||
deps=pep8==1.2
|
||||
commands = pep8 --exclude=*.pyc --repeat --show-source \
|
||||
packstack/modules tests setup.py packstack/installer/utils \
|
||||
packstack/installer/processors.py
|
||||
packstack/modules packstack/plugins tests setup.py
|
||||
|
||||
|
||||
[testenv:cover]
|
||||
|
|
Loading…
Reference in New Issue