Merge "Consolidate module constants."

This commit is contained in:
Jenkins 2015-10-21 06:54:54 +00:00 committed by Gerrit Code Review
commit 7cbd5d13a9
5 changed files with 106 additions and 89 deletions

View File

@ -0,0 +1,85 @@
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
WEBROOT = '/dashboard/'
SERVICE_LIST = {
'ceilometer': {'password_field': 'OVERCLOUD_CEILOMETER_PASSWORD'},
'cinder': {'password_field': 'OVERCLOUD_CINDER_PASSWORD'},
'cinderv2': {'password_field': 'OVERCLOUD_CINDER_PASSWORD'},
'glance': {'password_field': 'OVERCLOUD_GLANCE_PASSWORD'},
'heat': {'password_field': 'OVERCLOUD_HEAT_PASSWORD'},
'neutron': {'password_field': 'OVERCLOUD_NEUTRON_PASSWORD'},
'nova': {'password_field': 'OVERCLOUD_NOVA_PASSWORD'},
'novav3': {'password_field': 'OVERCLOUD_NOVA_PASSWORD'},
'swift': {'password_field': 'OVERCLOUD_SWIFT_PASSWORD'},
'horizon': {
'port': '80',
'path': WEBROOT,
'admin_path': '%sadmin' % WEBROOT},
}
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
OVERCLOUD_YAML_NAME = "overcloud-without-mergepy.yaml"
RESOURCE_REGISTRY_NAME = "overcloud-resource-registry-puppet.yaml"
RHEL_REGISTRATION_EXTRACONFIG_NAME = (
"extraconfig/post_deploy/rhel-registration/")
PARAMETERS = {
'AdminPassword': None,
'AdminToken': None,
'CeilometerPassword': None,
'CeilometerMeteringSecret': None,
'CinderPassword': None,
'CinderISCSIHelper': 'lioadm',
'CloudName': 'overcloud',
'ExtraConfig': '{}',
'GlancePassword': None,
'HeatPassword': None,
'HeatStackDomainAdminPassword': None,
'NeutronControlPlaneID': None,
'NeutronDnsmasqOptions': 'dhcp-option-force=26,1400',
'NeutronPassword': None,
'NeutronPublicInterface': 'nic1',
'NeutronFlatNetworks': 'datacentre',
'HypervisorNeutronPhysicalBridge': 'br-ex',
'NeutronBridgeMappings': 'datacentre:br-ex',
'HypervisorNeutronPublicInterface': 'nic1',
'NovaPassword': None,
'SwiftHashSuffix': None,
'SwiftPassword': None,
'SnmpdReadonlyUserPassword': None,
'NtpServer': '',
'controllerImage': 'overcloud-full',
'NovaImage': 'overcloud-full',
'BlockStorageImage': 'overcloud-full',
'SwiftStorageImage': 'overcloud-full',
'CephStorageImage': 'overcloud-full',
'OvercloudControlFlavor': 'baremetal',
'OvercloudComputeFlavor': 'baremetal',
'OvercloudBlockStorageFlavor': 'baremetal',
'OvercloudSwiftStorageFlavor': 'baremetal',
'OvercloudCephStorageFlavor': 'baremetal',
'NeutronNetworkVLANRanges': 'datacentre:1:1000',
}
NEW_STACK_PARAMETERS = {
'NovaComputeLibvirtType': 'kvm',
'NeutronTunnelIdRanges': ['1:1000'],
'NeutronVniRanges': ['1:1000'],
'NeutronEnableTunnelling': 'True',
'NeutronNetworkType': 'gre',
'NeutronTunnelTypes': 'gre',
}

View File

@ -31,25 +31,6 @@ from heatclient.exc import HTTPNotFound
from tripleoclient import exceptions
WEBROOT = '/dashboard/'
SERVICE_LIST = {
'ceilometer': {'password_field': 'OVERCLOUD_CEILOMETER_PASSWORD'},
'cinder': {'password_field': 'OVERCLOUD_CINDER_PASSWORD'},
'cinderv2': {'password_field': 'OVERCLOUD_CINDER_PASSWORD'},
'glance': {'password_field': 'OVERCLOUD_GLANCE_PASSWORD'},
'heat': {'password_field': 'OVERCLOUD_HEAT_PASSWORD'},
'neutron': {'password_field': 'OVERCLOUD_NEUTRON_PASSWORD'},
'nova': {'password_field': 'OVERCLOUD_NOVA_PASSWORD'},
'novav3': {'password_field': 'OVERCLOUD_NOVA_PASSWORD'},
'swift': {'password_field': 'OVERCLOUD_SWIFT_PASSWORD'},
'horizon': {
'port': '80',
'path': WEBROOT,
'admin_path': '%sadmin' % WEBROOT},
}
_MIN_PASSWORD_SIZE = 25

View File

@ -36,62 +36,10 @@ from os_cloud_config.utils import clients
from six.moves import configparser
from tripleo_common import update
from tripleoclient import constants
from tripleoclient import exceptions
from tripleoclient import utils
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
OVERCLOUD_YAML_NAME = "overcloud-without-mergepy.yaml"
RESOURCE_REGISTRY_NAME = "overcloud-resource-registry-puppet.yaml"
RHEL_REGISTRATION_EXTRACONFIG_NAME = (
"extraconfig/pre_deploy/rhel-registration/")
PARAMETERS = {
'AdminPassword': None,
'AdminToken': None,
'CeilometerPassword': None,
'CeilometerMeteringSecret': None,
'CinderPassword': None,
'CinderISCSIHelper': 'lioadm',
'CloudName': 'overcloud',
'ExtraConfig': '{}',
'GlancePassword': None,
'HeatPassword': None,
'HeatStackDomainAdminPassword': None,
'NeutronControlPlaneID': None,
'NeutronDnsmasqOptions': 'dhcp-option-force=26,1400',
'NeutronPassword': None,
'NeutronPublicInterface': 'nic1',
'NeutronFlatNetworks': 'datacentre',
'HypervisorNeutronPhysicalBridge': 'br-ex',
'NeutronBridgeMappings': 'datacentre:br-ex',
'HypervisorNeutronPublicInterface': 'nic1',
'NovaPassword': None,
'SwiftHashSuffix': None,
'SwiftPassword': None,
'SnmpdReadonlyUserPassword': None,
'NtpServer': '',
'controllerImage': 'overcloud-full',
'NovaImage': 'overcloud-full',
'BlockStorageImage': 'overcloud-full',
'SwiftStorageImage': 'overcloud-full',
'CephStorageImage': 'overcloud-full',
'OvercloudControlFlavor': 'baremetal',
'OvercloudComputeFlavor': 'baremetal',
'OvercloudBlockStorageFlavor': 'baremetal',
'OvercloudSwiftStorageFlavor': 'baremetal',
'OvercloudCephStorageFlavor': 'baremetal',
'NeutronNetworkVLANRanges': 'datacentre:1:1000',
}
NEW_STACK_PARAMETERS = {
'NovaComputeLibvirtType': 'kvm',
'NeutronTunnelIdRanges': ['1:1000'],
'NeutronVniRanges': ['1:1000'],
'NeutronEnableTunnelling': 'True',
'NeutronNetworkType': 'gre',
'NeutronTunnelTypes': 'gre',
}
class DeployOvercloud(command.Command):
"""Deploy Overcloud"""
@ -133,9 +81,9 @@ class DeployOvercloud(command.Command):
undercloud_ceilometer_snmpd_password)
def _update_paramaters(self, args, network_client, stack):
parameters = PARAMETERS.copy()
parameters = constants.PARAMETERS.copy()
if stack is None:
parameters.update(NEW_STACK_PARAMETERS)
parameters.update(constants.NEW_STACK_PARAMETERS)
self.log.debug("Generating overcloud passwords")
self.set_overcloud_passwords(parameters, args)
@ -227,14 +175,17 @@ class DeployOvercloud(command.Command):
return parameters
def _create_registration_env(self, args):
tht_root = args.templates
environment = os.path.join(tht_root,
RHEL_REGISTRATION_EXTRACONFIG_NAME,
'environment-rhel-registration.yaml')
registry = os.path.join(tht_root, RHEL_REGISTRATION_EXTRACONFIG_NAME,
'rhel-registration-resource-registry.yaml')
environment = os.path.join(
tht_root,
constants.RHEL_REGISTRATION_EXTRACONFIG_NAME,
'environment-rhel-registration.yaml')
registry = os.path.join(
tht_root,
constants.RHEL_REGISTRATION_EXTRACONFIG_NAME,
'rhel-registration-resource-registry.yaml')
user_env = ("parameter_defaults:\n"
" rhel_reg_method: \"%(method)s\"\n"
" rhel_reg_org: \"%(org)s\"\n"
@ -363,8 +314,8 @@ class DeployOvercloud(command.Command):
# default resource registry file should be passed only
# when creating a new stack, otherwise it might overwrite
# resource_registries in existing stack
resource_registry_path = os.path.join(tht_root,
RESOURCE_REGISTRY_NAME)
resource_registry_path = os.path.join(
tht_root, constants.RESOURCE_REGISTRY_NAME)
environments.extend([resource_registry_path, env_path])
environments.extend(self._create_parameters_env(parameters))
@ -374,7 +325,7 @@ class DeployOvercloud(command.Command):
if parsed_args.environment_files:
environments.extend(parsed_args.environment_files)
overcloud_yaml = os.path.join(tht_root, OVERCLOUD_YAML_NAME)
overcloud_yaml = os.path.join(tht_root, constants.OVERCLOUD_YAML_NAME)
self._heat_deploy(stack, parsed_args.stack, overcloud_yaml, parameters,
environments, parsed_args.timeout)
@ -474,7 +425,7 @@ class DeployOvercloud(command.Command):
data.pop('ssl_port', None)
services = {}
for service, data in six.iteritems(utils.SERVICE_LIST):
for service, data in six.iteritems(constants.SERVICE_LIST):
service_data = data.copy()
service_data.pop('password_field', None)
password_field = data.get('password_field')
@ -778,7 +729,7 @@ class DeployOvercloud(command.Command):
add_help=False
)
parser.add_argument(
'--templates', nargs='?', const=TRIPLEO_HEAT_TEMPLATES,
'--templates', nargs='?', const=constants.TRIPLEO_HEAT_TEMPLATES,
help=_("The directory containing the Heat templates to deploy"),
required=True
)

View File

@ -19,7 +19,7 @@ from cliff import command
from openstackclient.common import utils
from tripleo_common import scale
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
from tripleoclient import constants
class DeleteNode(command.Command):
@ -36,7 +36,7 @@ class DeleteNode(command.Command):
'(default=Env: OVERCLOUD_STACK_NAME)',
default=utils.env('OVERCLOUD_STACK_NAME'))
parser.add_argument(
'--templates', nargs='?', const=TRIPLEO_HEAT_TEMPLATES,
'--templates', nargs='?', const=constants.TRIPLEO_HEAT_TEMPLATES,
help="The directory containing the Heat templates to deploy"
)
parser.add_argument(

View File

@ -20,7 +20,7 @@ from openstackclient.common import utils
from openstackclient.i18n import _
from tripleo_common import update
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
from tripleoclient import constants
class UpdateOvercloud(command.Command):
@ -36,7 +36,7 @@ class UpdateOvercloud(command.Command):
'(default=Env: OVERCLOUD_STACK_NAME)'),
default=utils.env('OVERCLOUD_STACK_NAME'))
parser.add_argument(
'--templates', nargs='?', const=TRIPLEO_HEAT_TEMPLATES,
'--templates', nargs='?', const=constants.TRIPLEO_HEAT_TEMPLATES,
help=_("The directory containing the Heat templates to deploy"),
required=True
)