From 1e95338230adccef6b660a5f56a3e863037e3b85 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Thu, 26 Jul 2012 10:30:10 -0700 Subject: [PATCH] temporary commit. This commit contains changes and notes related to the initial code review between joe topjian and myself. It is not intended to be merged, but it part of an ongoing collaboration for a refactor of this module. --- manifests/all.pp | 41 ++++++++++---------- manifests/auth_file.pp | 10 ++--- manifests/controller.pp | 5 +++ manifests/db/mysql.pp | 72 +++++++++++++++++++----------------- manifests/glance.pp | 42 ++++++--------------- manifests/horizon.pp | 2 +- manifests/keystone.pp | 8 ++++ manifests/nova/compute.pp | 71 ++++++++++------------------------- manifests/nova/controller.pp | 5 +-- manifests/test_file.pp | 2 +- 10 files changed, 113 insertions(+), 145 deletions(-) diff --git a/manifests/all.pp b/manifests/all.pp index b430cd5..d4002f6 100644 --- a/manifests/all.pp +++ b/manifests/all.pp @@ -30,6 +30,25 @@ # # class openstack::all ( + # Network Required + $public_address, + # MySQL Required + $mysql_root_password, + # Rabbit Required + $rabbit_password, + # Keystone Required + $keystone_db_password, + $keystone_admin_token, + $admin_email, + $admin_password, + # Nova Required + $nova_db_password, + $nova_user_password, + # Glance Required + $glance_db_password, + $glance_user_password, + # Horizon Required + $secret_key, # Network $public_interface = 'eth0', $private_interface = 'eth1', @@ -70,26 +89,7 @@ class openstack::all ( $vnc_enabled = true, # General $enabled = true, - $verbose = false, - # Network Required - $public_address, - # MySQL Required - $mysql_root_password, - # Rabbit Required - $rabbit_password, - # Keystone Required - $keystone_db_password, - $keystone_admin_token, - $admin_email, - $admin_password, - # Nova Required - $nova_db_password, - $nova_user_password, - # Glance Required - $glance_db_password, - $glance_user_password, - # Horizon Required - $secret_key, + $verbose = false ) inherits openstack::params { # set up mysql server @@ -112,6 +112,7 @@ class openstack::all ( } } } + ####### KEYSTONE ########### class { 'openstack::keystone': verbose => $verbose, diff --git a/manifests/auth_file.pp b/manifests/auth_file.pp index e0256d5..bd1bf7d 100644 --- a/manifests/auth_file.pp +++ b/manifests/auth_file.pp @@ -4,11 +4,11 @@ # against a keystone server. # class openstack::auth_file( - $admin_password = $::openstack::params::admin_password, - $public_address = $::openstack::params::public_address, - $keystone_admin_token = $::openstack::params::keystone_admin_token, - $admin_tenant = $::openstack::params::keystone_admin_tenant, - $admin_user = 'admin' + $admin_password, + $controller_node = '127.0.0.1', + $keystone_admin_token = 'keystone_admin_token', + $admin_user = 'admin', + $admin_tenant = 'openstack' ) { file { '/root/openrc': content => diff --git a/manifests/controller.pp b/manifests/controller.pp index 91d0127..0fc6726 100644 --- a/manifests/controller.pp +++ b/manifests/controller.pp @@ -84,6 +84,11 @@ class openstack::controller ( $secret_key ) inherits openstack::params { + + ## NOTE Class['glance::db::mysql'] -> Class['glance::registry'] + ## this dependency needs to exist (I forgot exactly why?) + # the db migration needs to happen after the dbs are created + # Configure admin_address and internal address if needed. if (admin_address == undef) { $real_admin_address = $public_address diff --git a/manifests/db/mysql.pp b/manifests/db/mysql.pp index 967c5b3..d57fe03 100644 --- a/manifests/db/mysql.pp +++ b/manifests/db/mysql.pp @@ -20,6 +20,12 @@ class openstack::db::mysql ( + # Required MySQL + # passwords + $mysql_root_password, + $keystone_db_password, + $glance_db_password, + $nova_db_password # MySQL $mysql_bind_address = '0.0.0.0', $mysql_account_security = true, @@ -32,50 +38,48 @@ class openstack::db::mysql ( # Nova $nova_db_user = 'nova', $nova_db_dbname = 'nova', - # Required MySQL - $allowed_hosts, - # Passwords - $mysql_root_password, - $keystone_db_password, - $glance_db_password, - $nova_db_password + $allowed_hosts = false, + $enabled = true ) { # Install and configure MySQL Server - class { 'mysql::server': - config_hash => { + class { 'mysql::server': + config_hash => { 'root_password' => $mysql_root_password, 'bind_address' => $mysql_bind_address, } + enabled => $enabled, } - # If enabled, secure the mysql installation - # This removes default users and guest access - if $mysql_account_security { - class { 'mysql::server::account_security': } - } + if $enabled { + # If enabled, secure the mysql installation + # This removes default users and guest access + if $mysql_account_security { + class { 'mysql::server::account_security': } + } - # Create the Keystone db - class { 'keystone::db::mysql': - user => $keystone_db_user, - password => $keystone_db_password, - dbname => $keystone_db_dbname, - allowed_hosts => $allowed_hosts, - } + # Create the Keystone db + class { 'keystone::db::mysql': + user => $keystone_db_user, + password => $keystone_db_password, + dbname => $keystone_db_dbname, + allowed_hosts => $allowed_hosts, + } - # Create the Glance db - class { 'glance::db::mysql': - user => $glance_db_user, - password => $glance_db_password, - dbname => $glance_db_dbname, - allowed_hosts => $allowed_hosts, - } + # Create the Glance db + class { 'glance::db::mysql': + user => $glance_db_user, + password => $glance_db_password, + dbname => $glance_db_dbname, + allowed_hosts => $allowed_hosts, + } - # Create the Nova db - class { 'nova::db::mysql': - user => $nova_db_user, - password => $nova_db_password, - dbname => $nova_db_dbname, - allowed_hosts => $allowed_hosts, + # Create the Nova db + class { 'nova::db::mysql': + user => $nova_db_user, + password => $nova_db_password, + dbname => $nova_db_dbname, + allowed_hosts => $allowed_hosts, + } } } diff --git a/manifests/glance.pp b/manifests/glance.pp index 8513778..69c04e6 100644 --- a/manifests/glance.pp +++ b/manifests/glance.pp @@ -17,35 +17,20 @@ # class { 'openstack::glance': # glance_user_password => 'changeme', # db_password => 'changeme', -# public_address => '192.168.1.1', # db_host => '127.0.0.1', # } class openstack::glance ( - $db_type = 'mysql', - $glance_db_user = 'glance', - $glance_db_dbname = 'glance', - $admin_address = undef, - $internal_address = undef, - $verbose = false, + $keystone_host, $db_host, $glance_user_password, $glance_db_password, - $public_address, -) inherits openstack::params { - - # Configure admin_address and internal address if needed. - if (admin_address == undef) { - $real_admin_address = $public_address - } else { - $real_admin_address = $admin_address - } - - if (internal_address == undef) { - $real_internal_address = $public_address - } else { - $real_internal_address = $internal_address - } + $db_type = 'mysql', + $glance_db_user = 'glance', + $glance_db_dbname = 'glance', + $verbose = false, + $enabled = true +) { # Configure the db string case $db_type { @@ -59,31 +44,28 @@ class openstack::glance ( log_verbose => $verbose, log_debug => $verbose, auth_type => 'keystone', + auth_port => '35357', keystone_tenant => 'services', keystone_user => 'glance', keystone_password => $glance_user_password, + enabled => $enabled, } # Install and configure glance-registry class { 'glance::registry': log_verbose => $verbose, log_debug => $verbose, + auth_host => $keystone_host, + auth_port => '35357', auth_type => 'keystone', keystone_tenant => 'services', keystone_user => 'glance', keystone_password => $glance_user_password, sql_connection => $sql_connection, + enabled => $enabled, } # Configure file storage backend class { 'glance::backend::file': } - # Configure Glance to use Keystone - class { 'glance::keystone::auth': - password => $glance_user_password, - public_address => $public_address, - admin_address => $real_admin_address, - internal_address => $real_internal_address, - } - } diff --git a/manifests/horizon.pp b/manifests/horizon.pp index 43e5055..cc9405a 100644 --- a/manifests/horizon.pp +++ b/manifests/horizon.pp @@ -10,7 +10,7 @@ # # === Examples # -# class { 'openstack::horizon': +# class { 'openstack::horizon': # secret_key => 'dummy_secret_key', # } # diff --git a/manifests/keystone.pp b/manifests/keystone.pp index 97f2757..292b962 100644 --- a/manifests/keystone.pp +++ b/manifests/keystone.pp @@ -69,6 +69,14 @@ class openstack::keystone ( internal_address => $real_internal_address, } + # Configure Glance to use Keystone + class { 'glance::keystone::auth': + password => $glance_user_password, + public_address => $public_address, + admin_address => $real_admin_address, + internal_address => $real_internal_address, + } + # Configure the Keystone database case $db_type { 'mysql': { diff --git a/manifests/nova/compute.pp b/manifests/nova/compute.pp index 8a81473..82ddb44 100644 --- a/manifests/nova/compute.pp +++ b/manifests/nova/compute.pp @@ -15,7 +15,18 @@ # nova_user_password => 'changeme', # } +# NOTE this file should not actually change from the old openstack::compute +# class its worth doing a diff of the old file to better understadn the differneces + +# +# NOTE move this to openstack::compute +# NOTE grab all of the missing logic from openstack::compute + class openstack::nova::compute ( + # Required Network + $internal_address, + # Required Nova + $nova_user_password, # Network $public_address = undef, $public_interface = 'eth0', @@ -29,65 +40,23 @@ class openstack::nova::compute ( # Volumes $nova_volume = 'nova-volumes', $manage_volumes = true, - $iscsi_ip_address = undef, + $iscsi_ip_address = $internal_address, # VNC $vnc_enabled = true, - $vncserver_listen = undef, $vncserver_proxyclient_address = undef, $vncproxy_host = undef, # General $verbose = false, $exported_resources = true, - $enabled = true, - # Required Network - $internal_address, - # Required Nova - $nova_user_password -) inherits openstack::params { - - # Set iscsi ip address if not set - if ($iscsi_ip_address == undef) { - $real_iscsi_ip_address = $internal_address - } else { - $real_iscsi_ip_address = $iscsi_ip_address - } - - # Configure VNC variables - if ($vnc_enabled == true) { - if ($vncserver_listen == undef) { - $real_vncserver_listen = $internal_address - } else { - $real_vncserver_listen = $vncserver_listen - } - - if ($vncserver_proxyclient_address == undef) { - $real_vncserver_proxyclient_address = $internal_address - } else { - $real_vncserver_proxyclient_address = $vncserver_proxyclient_address - } - - if ($vncproxy_host == undef) { - if ($multi_host == true and $public_address != undef) { - $real_vncproxy_host = $public_address - } else { - fail('vncproxy_host must be set.') - } - } else { - # This should be the public IP of the cloud controller... - $real_vncproxy_host = $vncproxy_host - } - } else { - $real_vncserver_listen = undef - $real_vncserver_proxyclient_address = undef - $real_vncproxy_host = undef - } + $enabled = true +) { # Install / configure nova-compute class { '::nova::compute': enabled => true, vnc_enabled => $vnc_enabled, - vncserver_proxyclient_address => $real_vncserver_proxyclient_address, - vncproxy_host => $real_vncproxy_host, + vncserver_proxyclient_address => $internal_address, + vncproxy_host => $vncproxy_host, } # Configure libvirt for nova-compute @@ -109,7 +78,7 @@ class openstack::nova::compute ( } $enable_network_service = true class { 'nova::api': - enabled => $enabled, + enabled => true, admin_tenant_name => 'services', admin_user => 'nova', admin_password => $nova_user_password, @@ -128,10 +97,10 @@ class openstack::nova::compute ( private_interface => $private_interface, public_interface => $public_interface, fixed_range => $fixed_range, - floating_range => false, # double check + floating_range => false, network_manager => $network_manager, config_overrides => $network_config, - create_networks => false, # double check + create_networks => false, enabled => $enable_network_service, install_service => $enable_network_service, } @@ -145,7 +114,7 @@ class openstack::nova::compute ( if $enabled { class { 'nova::volume::iscsi': volume_group => $nova_volume, - iscsi_ip_address => $internal_address, + iscsi_ip_address => $iscsi_ip_address, } } } diff --git a/manifests/nova/controller.pp b/manifests/nova/controller.pp index bc23cf3..cd6a9cc 100644 --- a/manifests/nova/controller.pp +++ b/manifests/nova/controller.pp @@ -85,7 +85,6 @@ class openstack::nova::controller ( } else { $real_glance_api_servers = $glance_api_servers } - if ($export_resources) { # export all of the things that will be needed by the clients @@nova_config { 'rabbit_host': value => $internal_address } @@ -108,11 +107,11 @@ class openstack::nova::controller ( $rabbit_connection = $internal_address } - # Install / configure rabbitmq class { 'nova::rabbitmq': userid => $rabbit_user, password => $rabbit_password, + enabled => $enabled, } # Configure Nova to use Keystone @@ -148,7 +147,7 @@ class openstack::nova::controller ( if $enabled == true { $enable_network_service = true } else { - $enable_network-service = false + $enable_network_service = false } } diff --git a/manifests/test_file.pp b/manifests/test_file.pp index 564e1e7..b39a1a4 100644 --- a/manifests/test_file.pp +++ b/manifests/test_file.pp @@ -23,6 +23,6 @@ class openstack::test_file( file { $path: content => template('openstack/test_nova.sh.erb'), - } + } }