Merge "Add support for Packstack to manage a default set of flavors"
This commit is contained in:
@@ -725,6 +725,9 @@ Nova Options
|
||||
**CONFIG_NOVA_KS_PW**
|
||||
Password to use for the Compute service to authenticate with the Identity service.
|
||||
|
||||
**CONFIG_NOVA_MANAGE_FLAVORS**
|
||||
Whether or not Packstack should manage a default initial set of Nova flavors. Defaults to 'y'.
|
||||
|
||||
**CONFIG_NOVA_SCHED_CPU_ALLOC_RATIO**
|
||||
Overcommitment ratio for virtual to physical CPUs. Specify 1.0 to disable CPU overcommitment.
|
||||
|
||||
|
@@ -95,6 +95,20 @@ def initConfig(controller):
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "nova-manage-flavors",
|
||||
"PROMPT": (
|
||||
"Should Packstack manage default Nova flavors"
|
||||
),
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_options],
|
||||
"DEFAULT_VALUE": "y",
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_NOVA_MANAGE_FLAVORS",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "novasched-cpu-allocation-ratio",
|
||||
"PROMPT": "Enter the CPU overcommitment ratio. Set to 1.0 to "
|
||||
"disable CPU overcommitment",
|
||||
|
@@ -13,13 +13,16 @@ if $config_use_neutron == 'y' {
|
||||
$default_floating_pool = 'nova'
|
||||
}
|
||||
|
||||
$auth_uri = hiera('CONFIG_KEYSTONE_PUBLIC_URL')
|
||||
$admin_password = hiera('CONFIG_NOVA_KS_PW')
|
||||
|
||||
class { '::nova::api':
|
||||
api_bind_address => $bind_host,
|
||||
metadata_listen => $bind_host,
|
||||
enabled => true,
|
||||
auth_uri => hiera('CONFIG_KEYSTONE_PUBLIC_URL'),
|
||||
auth_uri => $auth_uri,
|
||||
identity_uri => hiera('CONFIG_KEYSTONE_ADMIN_URL'),
|
||||
admin_password => hiera('CONFIG_NOVA_KS_PW'),
|
||||
admin_password => $admin_password,
|
||||
neutron_metadata_proxy_shared_secret => hiera('CONFIG_NEUTRON_METADATA_PW_UNQUOTED', undef),
|
||||
default_floating_pool => $default_floating_pool,
|
||||
pci_alias => hiera('CONFIG_NOVA_PCI_ALIAS'),
|
||||
@@ -37,3 +40,45 @@ if $db_purge {
|
||||
destination => '/dev/null',
|
||||
}
|
||||
}
|
||||
|
||||
# TODO: Refactor flavor provisioning when https://review.openstack.org/#/c/305463/ lands
|
||||
$manage_flavors = str2bool(hiera('CONFIG_NOVA_MANAGE_FLAVORS'))
|
||||
|
||||
if $manage_flavors {
|
||||
$os_auth_options = "--os-username nova --os-password ${admin_password} --os-tenant-name services --os-auth-url ${auth_uri}"
|
||||
Exec {
|
||||
path => '/usr/bin:/bin:/usr/sbin:/sbin'
|
||||
}
|
||||
|
||||
# Manage a default set of flavors
|
||||
exec { 'manage_m1.tiny_nova_flavor':
|
||||
provider => shell,
|
||||
command => "openstack ${os_auth_options} flavor create --id 1 --ram 512 --disk 1 --vcpus 1 m1.tiny",
|
||||
unless => "openstack ${os_auth_options} flavor list | grep m1.tiny",
|
||||
require => Class['::nova::api'],
|
||||
}
|
||||
exec { 'manage_m1.small_nova_flavor':
|
||||
provider => shell,
|
||||
command => "openstack ${os_auth_options} flavor create --id 2 --ram 2048 --disk 20 --vcpus 1 m1.small",
|
||||
unless => "openstack ${os_auth_options} flavor list | grep m1.small",
|
||||
require => Class['::nova::api'],
|
||||
}
|
||||
exec { 'manage_m1.medium_nova_flavor':
|
||||
provider => shell,
|
||||
command => "openstack ${os_auth_options} flavor create --id 3 --ram 4096 --disk 40 --vcpus 2 m1.medium",
|
||||
unless => "openstack ${os_auth_options} flavor list | grep m1.medium",
|
||||
require => Class['::nova::api'],
|
||||
}
|
||||
exec { 'manage_m1.large_nova_flavor':
|
||||
provider => shell,
|
||||
command => "openstack ${os_auth_options} flavor create --id 4 --ram 8192 --disk 80 --vcpus 4 m1.large",
|
||||
unless => "openstack ${os_auth_options} flavor list | grep m1.large",
|
||||
require => Class['::nova::api'],
|
||||
}
|
||||
exec { 'manage_m1.xlarge_nova_flavor':
|
||||
provider => shell,
|
||||
command => "openstack ${os_auth_options} flavor create --id 5 --ram 16384 --disk 160 --vcpus 8 m1.xlarge",
|
||||
unless => "openstack ${os_auth_options} flavor list | grep m1.xlarge",
|
||||
require => Class['::nova::api'],
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user