Refactor provisioning
- Unite demo user and tempest user provisioning - Unite glance provisioning - Unite network provisioning - Run provisioning on correct nodes - network and users on controller - glance on storage nodes Change-Id: Ief9d9c224d0f94557f42d64d62e1e9d314db9ad6
This commit is contained in:
parent
75bcfd3031
commit
676b1f6440
|
@ -983,6 +983,9 @@ Provisioning tempest config
|
|||
**CONFIG_PROVISION_TEMPEST_REPO_REVISION**
|
||||
Revision (branch) of the Integration Test Suite git repository.
|
||||
|
||||
**CONFIG_TEMPEST_HOST**
|
||||
Host to deploy Tempest on. On multinode installs defaults to first host in CONFIG_NETWORK_HOSTS.
|
||||
|
||||
Provisioning all-in-one ovs bridge config
|
||||
-----------------------------------------
|
||||
|
||||
|
|
|
@ -139,6 +139,18 @@ def initConfig(controller):
|
|||
],
|
||||
|
||||
"PROVISION_TEMPEST": [
|
||||
{"CMD_OPTION": "tempest-host",
|
||||
"PROMPT": "Enter the host where to deploy Tempest",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_ssh],
|
||||
"DEFAULT_VALUE": utils.get_localhost_ip(),
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME": "CONFIG_TEMPEST_HOST",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "provision-tempest-user",
|
||||
"PROMPT": ("Enter the name of the Tempest Provisioning user "
|
||||
"(if blank, Tempest will be configured in a "
|
||||
|
@ -284,94 +296,53 @@ def initSequences(controller):
|
|||
config['CONFIG_PROVISION_TEMPEST'] != "y"):
|
||||
return
|
||||
|
||||
provision_steps = []
|
||||
|
||||
if config['CONFIG_PROVISION_DEMO'] == "y":
|
||||
provision_steps.append(
|
||||
{'title': 'Adding Provisioning Demo manifest entries',
|
||||
'functions': [create_demo_manifest]}
|
||||
)
|
||||
|
||||
if config['CONFIG_PROVISION_TEMPEST'] == "y":
|
||||
provision_steps.append(
|
||||
{'title': 'Adding Provisioning Tempest manifest entries',
|
||||
'functions': [create_tempest_manifest]}
|
||||
)
|
||||
|
||||
provision_steps = [
|
||||
{'title': 'Adding Provisioning manifest entries',
|
||||
'functions': [create_provision_manifest]},
|
||||
{'title': 'Adding Provisioning Glance manifest entries',
|
||||
'functions': [create_storage_manifest]},
|
||||
]
|
||||
if (config['CONFIG_PROVISION_TEMPEST'] == "y" or
|
||||
config['CONFIG_PROVISION_DEMO'] == "y"):
|
||||
provision_steps.append(
|
||||
{'title': 'Adding Provisioning Demo bridge manifest entries',
|
||||
'functions': [create_bridge_manifest]}
|
||||
)
|
||||
provision_steps.append(
|
||||
{'title': 'Adding Provisioning Glance manifest entries',
|
||||
'functions': [create_storage_manifest]},
|
||||
)
|
||||
|
||||
marshall_conf_bool(config, 'CONFIG_PROVISION_TEMPEST')
|
||||
marshall_conf_bool(config, 'CONFIG_PROVISION_OVS_BRIDGE')
|
||||
if config['CONFIG_PROVISION_TEMPEST'] == "y":
|
||||
provision_steps.append(
|
||||
{'title': 'Adding Provisioning Tempest manifest entries',
|
||||
'functions': [create_tempest_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
|
||||
else:
|
||||
conf[key] = False
|
||||
|
||||
|
||||
def using_neutron(config):
|
||||
# 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":
|
||||
# The provisioning template requires the name of the external
|
||||
# bridge but the value will be missing if neutron isn't
|
||||
# configured to be installed.
|
||||
config['CONFIG_NEUTRON_L3_EXT_BRIDGE'] = 'br-ex'
|
||||
|
||||
# Set template-specific parameter to configure whether neutron is
|
||||
# available. The value needs to be true/false rather than the y/n.
|
||||
# provided by CONFIG_NEUTRON_INSTALL.
|
||||
config['PROVISION_NEUTRON_AVAILABLE'] = config['CONFIG_NEUTRON_INSTALL']
|
||||
marshall_conf_bool(config, 'PROVISION_NEUTRON_AVAILABLE')
|
||||
|
||||
|
||||
# -------------------------- step functions --------------------------
|
||||
|
||||
def create_demo_manifest(config, messages):
|
||||
using_neutron(config)
|
||||
manifest_file = '%s_provision_demo.pp' % config['CONFIG_CONTROLLER_HOST']
|
||||
manifest_data = getManifestTemplate("provision_demo")
|
||||
appendManifestFile(manifest_file, manifest_data)
|
||||
def create_provision_manifest(config, messages):
|
||||
manifest_file = '%s_provision.pp' % config['CONFIG_CONTROLLER_HOST']
|
||||
manifest_data = getManifestTemplate("provision")
|
||||
appendManifestFile(manifest_file, manifest_data, 'provision')
|
||||
|
||||
|
||||
def create_bridge_manifest(config, messages):
|
||||
for host in utils.split_hosts(config['CONFIG_NETWORK_HOSTS']):
|
||||
manifest_file = '{}_provision_bridge.pp'.format(host)
|
||||
manifest_data = getManifestTemplate("provision_bridge")
|
||||
appendManifestFile(manifest_file, manifest_data, 'provision')
|
||||
|
||||
|
||||
def create_storage_manifest(config, messages):
|
||||
if config['CONFIG_GLANCE_INSTALL'] == 'y':
|
||||
if config['CONFIG_PROVISION_TEMPEST']:
|
||||
template = "provision_tempest_glance"
|
||||
else:
|
||||
template = "provision_demo_glance"
|
||||
template = "provision_glance"
|
||||
manifest_file = '%s_provision_glance' % config['CONFIG_STORAGE_HOST']
|
||||
manifest_data = getManifestTemplate(template)
|
||||
appendManifestFile(manifest_file, manifest_data)
|
||||
|
||||
|
||||
def create_bridge_manifest(config, messages):
|
||||
using_neutron(config)
|
||||
for host in utils.split_hosts(config['CONFIG_NETWORK_HOSTS']):
|
||||
manifest_file = '{}_provision_demo_bridge.pp'.format(host)
|
||||
manifest_data = getManifestTemplate("provision_demo_bridge")
|
||||
appendManifestFile(manifest_file, manifest_data, 'demo_bridge')
|
||||
appendManifestFile(manifest_file, manifest_data, 'provision')
|
||||
|
||||
|
||||
def create_tempest_manifest(config, messages):
|
||||
using_neutron(config)
|
||||
manifest_file = ('%s_provision_tempest.pp' %
|
||||
config['CONFIG_CONTROLLER_HOST'])
|
||||
config['CONFIG_TEMPEST_HOST'])
|
||||
manifest_data = getManifestTemplate("provision_tempest")
|
||||
appendManifestFile(manifest_file, manifest_data)
|
||||
appendManifestFile(manifest_file, manifest_data, 'tempest')
|
||||
|
|
|
@ -1,37 +1,48 @@
|
|||
## Keystone
|
||||
# non admin user
|
||||
$username = 'demo'
|
||||
$password = hiera('CONFIG_KEYSTONE_DEMO_PW')
|
||||
$tenant_name = 'demo'
|
||||
# admin user
|
||||
$admin_username = hiera('CONFIG_KEYSTONE_ADMIN_USERNAME')
|
||||
$admin_password = hiera('CONFIG_KEYSTONE_ADMIN_PW')
|
||||
$admin_tenant_name = 'admin'
|
||||
$provision_demo = str2bool(hiera('CONFIG_PROVISION_DEMO'))
|
||||
$provision_tempest = str2bool(hiera('CONFIG_PROVISION_TEMPEST'))
|
||||
$provision_neutron = str2bool(hiera('CONFIG_NEUTRON_INSTALL'))
|
||||
$heat_available = str2bool(hiera('CONFIG_HEAT_INSTALL'))
|
||||
|
||||
if $provision_demo {
|
||||
$username = 'demo'
|
||||
$password = hiera('CONFIG_KEYSTONE_DEMO_PW')
|
||||
$tenant_name = 'demo'
|
||||
$floating_range = hiera('CONFIG_PROVISION_DEMO_FLOATRANGE')
|
||||
} elsif $provision_tempest {
|
||||
$username = hiera('CONFIG_PROVISION_TEMPEST_USER')
|
||||
$password = hiera('CONFIG_PROVISION_TEMPEST_USER_PW')
|
||||
$tenant_name = 'tempest'
|
||||
$floating_range = hiera('CONFIG_PROVISION_TEMPEST_FLOATRANGE')
|
||||
if (empty($tempest_user) or empty($tempest_password)) {
|
||||
fail("Both CONFIG_PROVISION_TEMPEST_USER and
|
||||
CONFIG_PROVISION_TEMPEST_USER_PW need to be configured.")
|
||||
}
|
||||
}
|
||||
|
||||
if $provision_demo or $provision_tempest {
|
||||
$admin_tenant_name = 'admin'
|
||||
|
||||
## Neutron
|
||||
$public_network_name = 'public'
|
||||
$public_subnet_name = 'public_subnet'
|
||||
$floating_range = hiera('CONFIG_PROVISION_DEMO_FLOATRANGE')
|
||||
$private_network_name = 'private'
|
||||
$private_subnet_name = 'private_subnet'
|
||||
$fixed_range = '10.0.0.0/24'
|
||||
$router_name = 'router1'
|
||||
$provision_neutron_avail = hiera('PROVISION_NEUTRON_AVAILABLE')
|
||||
|
||||
## Users
|
||||
$public_network_name = 'public'
|
||||
$public_subnet_name = 'public_subnet'
|
||||
$private_network_name = 'private'
|
||||
$private_subnet_name = 'private_subnet'
|
||||
$fixed_range = '10.0.0.0/24'
|
||||
$router_name = 'router1'
|
||||
|
||||
keystone_tenant { $tenant_name:
|
||||
ensure => present,
|
||||
enabled => true,
|
||||
description => 'default tenant',
|
||||
}
|
||||
|
||||
keystone_user { $username:
|
||||
ensure => present,
|
||||
enabled => true,
|
||||
password => $password,
|
||||
}
|
||||
|
||||
if hiera('CONFIG_HEAT_INSTALL') == 'y' {
|
||||
if $heat_available {
|
||||
keystone_user_role { "${username}@${tenant_name}":
|
||||
ensure => present,
|
||||
roles => ['_member_', 'heat_stack_owner'],
|
||||
|
@ -44,7 +55,7 @@
|
|||
}
|
||||
|
||||
## Neutron
|
||||
if $provision_neutron_avail {
|
||||
if $provision_neutron {
|
||||
$neutron_deps = [Neutron_network[$public_network_name]]
|
||||
|
||||
neutron_network { $public_network_name:
|
||||
|
@ -82,3 +93,4 @@
|
|||
ensure => present,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,14 @@
|
|||
$provision_neutron_br = str2bool(hiera('CONFIG_NEUTRON_INSTALL'))
|
||||
$setup_ovs_bridge = str2bool(hiera('CONFIG_PROVISION_OVS_BRIDGE'))
|
||||
$public_bridge_name = hiera('CONFIG_NEUTRON_L3_EXT_BRIDGE', 'br-ex')
|
||||
$provision_tempest_br = str2bool(hiera('CONFIG_PROVISION_TEMPEST'))
|
||||
$provision_demo_br = str2bool(hiera('CONFIG_PROVISION_DEMO'))
|
||||
|
||||
$setup_ovs_bridge = hiera('CONFIG_PROVISION_OVS_BRIDGE')
|
||||
$provision_neutron_avail = hiera('PROVISION_NEUTRON_AVAILABLE')
|
||||
$public_bridge_name = hiera('CONFIG_NEUTRON_L3_EXT_BRIDGE')
|
||||
if $provision_demo_br {
|
||||
$floating_range_br = hiera('CONFIG_PROVISION_DEMO_FLOATRANGE')
|
||||
} elsif $provision_tempest_br {
|
||||
$floating_range_br = hiera('CONFIG_PROVISION_TEMPEST_FLOATRANGE')
|
||||
}
|
||||
|
||||
neutron_config {
|
||||
'keystone_authtoken/identity_uri': value => hiera('CONFIG_KEYSTONE_ADMIN_URL');
|
||||
|
@ -11,7 +18,7 @@ neutron_config {
|
|||
'keystone_authtoken/admin_password': value => hiera('CONFIG_NEUTRON_KS_PW');
|
||||
}
|
||||
|
||||
if $provision_neutron_avail and $setup_ovs_bridge {
|
||||
if $provision_neutron_br and $setup_ovs_bridge {
|
||||
Neutron_config<||> -> Neutron_l3_ovs_bridge['demo_bridge']
|
||||
neutron_l3_ovs_bridge { 'demo_bridge':
|
||||
name => $public_bridge_name,
|
||||
|
@ -22,7 +29,7 @@ if $provision_neutron_avail and $setup_ovs_bridge {
|
|||
firewall { '000 nat':
|
||||
chain => 'POSTROUTING',
|
||||
jump => 'MASQUERADE',
|
||||
source => hiera('CONFIG_PROVISION_DEMO_FLOATRANGE'),
|
||||
source => $floating_range_br,
|
||||
outiface => $::gateway_device,
|
||||
table => 'nat',
|
||||
proto => 'all',
|
|
@ -1,15 +0,0 @@
|
|||
|
||||
## Images
|
||||
## Glance
|
||||
$image_name = hiera('CONFIG_PROVISION_IMAGE_NAME')
|
||||
$image_source = hiera('CONFIG_PROVISION_IMAGE_URL')
|
||||
$image_ssh_user = hiera('CONFIG_PROVISION_IMAGE_SSH_USER')
|
||||
$image_format = hiera('CONFIG_PROVISION_IMAGE_FORMAT')
|
||||
|
||||
glance_image { $image_name:
|
||||
ensure => present,
|
||||
is_public => 'yes',
|
||||
container_format => 'bare',
|
||||
disk_format => $image_format,
|
||||
source => $image_source,
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
$image_name = hiera('CONFIG_PROVISION_IMAGE_NAME')
|
||||
$image_source = hiera('CONFIG_PROVISION_IMAGE_URL')
|
||||
$image_format = hiera('CONFIG_PROVISION_IMAGE_FORMAT')
|
||||
|
||||
glance_image { $image_name:
|
||||
ensure => present,
|
||||
is_public => 'yes',
|
||||
container_format => 'bare',
|
||||
disk_format => $image_format,
|
||||
source => $image_source,
|
||||
}
|
||||
|
||||
if str2bool(hiera('CONFIG_PROVISION_TEMPEST')) {
|
||||
$image_name_alt = "${image_name}_alt"
|
||||
glance_image { $image_name_alt:
|
||||
ensure => present,
|
||||
is_public => 'yes',
|
||||
container_format => 'bare',
|
||||
disk_format => $image_format,
|
||||
source => $image_source,
|
||||
}
|
||||
}
|
|
@ -57,32 +57,6 @@ if $provision_tempest_user != '' {
|
|||
$nova_available = true
|
||||
$swift_available = undef
|
||||
|
||||
## Users
|
||||
|
||||
keystone_tenant { $tenant_name:
|
||||
ensure => present,
|
||||
enabled => true,
|
||||
description => 'default tenant',
|
||||
}
|
||||
|
||||
keystone_user { $username:
|
||||
ensure => present,
|
||||
enabled => true,
|
||||
password => $password,
|
||||
}
|
||||
|
||||
if hiera('CONFIG_HEAT_INSTALL') == 'y' {
|
||||
keystone_user_role { "${username}@${tenant_name}":
|
||||
ensure => present,
|
||||
roles => ['_member_', 'heat_stack_owner'],
|
||||
}
|
||||
} else {
|
||||
keystone_user_role { "${username}@${tenant_name}":
|
||||
ensure => present,
|
||||
roles => ['_member_'],
|
||||
}
|
||||
}
|
||||
|
||||
# Support creation of a second glance image
|
||||
# distinct from the first, for tempest. It
|
||||
# doesn't need to be a different image, just
|
||||
|
@ -107,57 +81,9 @@ if $provision_tempest_user != '' {
|
|||
$image_name_alt_real = $image_name
|
||||
}
|
||||
|
||||
## Neutron
|
||||
|
||||
if $neutron_available {
|
||||
$neutron_deps = [Neutron_network[$public_network_name]]
|
||||
|
||||
neutron_network { $public_network_name:
|
||||
ensure => present,
|
||||
router_external => true,
|
||||
tenant_name => $admin_tenant_name,
|
||||
}
|
||||
|
||||
neutron_subnet { $public_subnet_name:
|
||||
ensure => 'present',
|
||||
cidr => $floating_range,
|
||||
enable_dhcp => false,
|
||||
network_name => $public_network_name,
|
||||
tenant_name => $admin_tenant_name,
|
||||
}
|
||||
|
||||
neutron_network { $private_network_name:
|
||||
ensure => present,
|
||||
tenant_name => $tenant_name,
|
||||
}
|
||||
|
||||
neutron_subnet { $private_subnet_name:
|
||||
ensure => present,
|
||||
cidr => $fixed_range,
|
||||
network_name => $private_network_name,
|
||||
tenant_name => $tenant_name,
|
||||
}
|
||||
|
||||
# Tenant-owned router - assumes network namespace isolation
|
||||
neutron_router { $router_name:
|
||||
ensure => present,
|
||||
tenant_name => $tenant_name,
|
||||
gateway_network_name => $public_network_name,
|
||||
# A neutron_router resource must explicitly declare a dependency on
|
||||
# the first subnet of the gateway network.
|
||||
require => Neutron_subnet[$public_subnet_name],
|
||||
}
|
||||
|
||||
neutron_router_interface { "${router_name}:${private_subnet_name}":
|
||||
ensure => present,
|
||||
}
|
||||
}
|
||||
|
||||
## Tempest
|
||||
|
||||
if $configure_tempest {
|
||||
$tempest_requires = concat([Keystone_user[$username]], $neutron_deps)
|
||||
|
||||
class { '::tempest':
|
||||
tempest_repo_uri => $tempest_repo_uri,
|
||||
tempest_clone_path => $tempest_clone_path,
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
## Glance
|
||||
$image_name = hiera('CONFIG_PROVISION_IMAGE_NAME')
|
||||
$image_source = hiera('CONFIG_PROVISION_IMAGE_URL')
|
||||
$image_ssh_user = hiera('CONFIG_PROVISION_IMAGE_SSH_USER')
|
||||
$image_format = hiera('CONFIG_PROVISION_IMAGE_FORMAT')
|
||||
|
||||
## Tempest
|
||||
|
||||
$image_name_alt = false
|
||||
$image_source_alt = false
|
||||
$image_ssh_user_alt = false
|
||||
## Images
|
||||
|
||||
glance_image { $image_name:
|
||||
ensure => present,
|
||||
is_public => 'yes',
|
||||
container_format => 'bare',
|
||||
disk_format => $image_format,
|
||||
source => $image_source,
|
||||
}
|
||||
|
||||
# Support creation of a second glance image
|
||||
# distinct from the first, for tempest. It
|
||||
# doesn't need to be a different image, just
|
||||
# have a different name and ref in glance.
|
||||
if $image_name_alt {
|
||||
$image_name_alt_real = $image_name_alt
|
||||
if ! $image_source_alt {
|
||||
# Use the same source by default
|
||||
$image_source_alt_real = $image_source
|
||||
} else {
|
||||
$image_source_alt_real = $image_source_alt
|
||||
}
|
||||
|
||||
if ! $image_ssh_user_alt {
|
||||
# Use the same user by default
|
||||
$image_alt_ssh_user_real = $image_ssh_user
|
||||
} else {
|
||||
$image_alt_ssh_user_real = $image_ssh_user_alt
|
||||
}
|
||||
|
||||
glance_image { $image_name_alt:
|
||||
ensure => present,
|
||||
is_public => 'yes',
|
||||
container_format => 'bare',
|
||||
disk_format => 'qcow2',
|
||||
source => $image_source_alt_real,
|
||||
}
|
||||
} else {
|
||||
$image_name_alt_real = $image_name
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue