From 0ee00d71130643433468ab1d04e9310d80aab148 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Thu, 11 Oct 2012 02:10:22 -0700 Subject: [PATCH] Add cinder support remove volume management from openstack::compute add cinder server services to openstack::controller add cinder db code --- manifests/cinder.pp | 25 +++++++++++++++++++++++++ manifests/compute.pp | 21 ++------------------- manifests/controller.pp | 26 ++++++++++++++++++++++++-- manifests/db/mysql.pp | 14 +++++++++++++- manifests/keystone.pp | 30 ++++++++++++++++++++++++++++++ 5 files changed, 94 insertions(+), 22 deletions(-) create mode 100644 manifests/cinder.pp diff --git a/manifests/cinder.pp b/manifests/cinder.pp new file mode 100644 index 0000000..d45b509 --- /dev/null +++ b/manifests/cinder.pp @@ -0,0 +1,25 @@ +class openstack::cinder( + $sql_connection, + $rabbit_password, + $rabbit_host = '127.0.0.1', + $volume_group = 'nova-volumes', + $enabled = true +) { + + class { 'cinder::base': + rabbit_password => $rabbit_password, + rabbit_host => $rabbit_host, + sql_connection => $sql_connection, + verbose => $verbose, + } + + # Install / configure nova-volume + class { 'cinder::volume': + enabled => $enabled, + } + if $enabled { + class { 'cinder::volume::iscsi': + volume_group => $volume_group, + } + } +} diff --git a/manifests/compute.pp b/manifests/compute.pp index c84189e..0ee4920 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -1,7 +1,7 @@ # # == Class: openstack::compute # -# Manifest to install/configure nova-compute and nova-volume +# Manifest to install/configure nova-compute # # === Parameters # @@ -41,11 +41,6 @@ class openstack::compute ( $glance_api_servers = false, # Virtualization $libvirt_type = 'kvm', - # Volumes - $nova_volume = 'nova-volumes', - $manage_volumes = true, - # TODO - not sure if using a variable as a default really works - $iscsi_ip_address = $internal_address, # VNC $vnc_enabled = true, $vncproxy_host = undef, @@ -111,6 +106,7 @@ class openstack::compute ( admin_tenant_name => 'services', admin_user => 'nova', admin_password => $nova_user_password, + # TODO override enabled_apis } } else { $enable_network_service = false @@ -132,17 +128,4 @@ class openstack::compute ( install_service => $enable_network_service, } - if $manage_volumes { - # Install / configure nova-volume - class { 'nova::volume': - enabled => $enabled, - } - if $enabled { - class { 'nova::volume::iscsi': - volume_group => $nova_volume, - iscsi_ip_address => $iscsi_ip_address, - } - } - } - } diff --git a/manifests/controller.pp b/manifests/controller.pp index 730256e..e4636a4 100644 --- a/manifests/controller.pp +++ b/manifests/controller.pp @@ -30,7 +30,7 @@ # Defaults to false. # [network_config] Hash that can be used to pass implementation specifc # network settings. Optioal. Defaults to {} -# [verbose] Rahter to log services at verbose. +# [verbose] Whether to log services at verbose. # [export_resources] Rather to export resources. # Horizon related config - assumes puppetlabs-horizon code # [secret_key] secret key to encode cookies, … @@ -121,8 +121,13 @@ class openstack::controller ( $quantum = false, $horizon_app_links = undef, # General - $verbose = false, + $verbose = 'False', $export_resources = true, + # if the cinder management components should be installed + $cinder_user_password = 'cinder_user_pass', + $cinder_db_password = 'cinder_db_pass', + $cinder_db_user = 'cinder', + $cinder_db_dbname = 'cinder', $enabled = true ) { @@ -150,6 +155,9 @@ class openstack::controller ( nova_db_user => $nova_db_user, nova_db_password => $nova_db_password, nova_db_dbname => $nova_db_dbname, + cinder_db_user => $cinder_db_user, + cinder_db_password => $cinder_db_password, + cinder_db_dbname => $cinder_db_dbname, allowed_hosts => $allowed_hosts, enabled => $enabled, } @@ -172,6 +180,7 @@ class openstack::controller ( admin_address => $admin_address, glance_user_password => $glance_user_password, nova_user_password => $nova_user_password, + cinder_user_password => $cinder_user_password, enabled => $enabled, } @@ -232,6 +241,19 @@ class openstack::controller ( exported_resources => $export_resources, } + ######### Cinder Controller Services ######## + class { "cinder::base": + verbose => $verbose, + sql_connection => "mysql://${cinder_db_user}:${cinder_db_password}@${db_host}/${cinder_db_dbname}?charset=utf8", + rabbit_password => $rabbit_password, + } + + class { 'cinder::api': + keystone_password => $cinder_user_password, + } + + class { 'cinder::scheduler': } + ######## Horizon ######## class { 'openstack::horizon': secret_key => $secret_key, diff --git a/manifests/db/mysql.pp b/manifests/db/mysql.pp index c8cf142..ac8952f 100644 --- a/manifests/db/mysql.pp +++ b/manifests/db/mysql.pp @@ -37,6 +37,7 @@ class openstack::db::mysql ( $keystone_db_password, $glance_db_password, $nova_db_password, + $cinder_db_password, # MySQL $mysql_bind_address = '0.0.0.0', $mysql_account_security = true, @@ -50,13 +51,16 @@ class openstack::db::mysql ( $nova_db_user = 'nova', $nova_db_dbname = 'nova', $allowed_hosts = false, + # Cinder + $cinder_db_user = 'cinder', + $cinder_db_dbname = 'cinder', $enabled = true ) { # Install and configure MySQL Server class { 'mysql::server': config_hash => { - 'root_password' => $mysql_root_password, + #'root_password' => $mysql_root_password, 'bind_address' => $mysql_bind_address, }, enabled => $enabled, @@ -91,5 +95,13 @@ class openstack::db::mysql ( dbname => $nova_db_dbname, allowed_hosts => $allowed_hosts, } + + # create cinder db + class { 'cinder::db::mysql': + user => $cinder_db_user, + password => $cinder_db_password, + dbname => $cinder_db_dbname, + allowed_hosts => $allowed_hosts, + } } } diff --git a/manifests/keystone.pp b/manifests/keystone.pp index d47b733..53fc152 100644 --- a/manifests/keystone.pp +++ b/manifests/keystone.pp @@ -45,6 +45,7 @@ class openstack::keystone ( $admin_password, $glance_user_password, $nova_user_password, + $cinder_user_password, $public_address, $db_type = 'mysql', $db_user = 'keystone', @@ -60,9 +61,13 @@ class openstack::keystone ( $nova_public_address = $public_address, $nova_internal_address = false, $nova_admin_address = false, + $cinder_public_address = false, + $cinder_internal_address = false, + $cinder_admin_address = false, $glance = true, $nova = true, $enabled = true, + $cinder = true, ) { # Install and configure Keystone @@ -104,6 +109,21 @@ class openstack::keystone ( } else { $nova_admin_real = $nova_internal_real } + if($cinder_public_address) { + $cinder_public_real = $cinder_public_address + } else { + $cinder_public_real = $public_address + } + if($cinder_internal_address) { + $cinder_internal_real = $cinder_internal_address + } else { + $cinder_internal_real = $cinder_public_real + } + if($cinder_admin_address) { + $cinder_admin_real = $cinder_admin_address + } else { + $cinder_admin_real = $cinder_internal_real + } class { '::keystone': log_verbose => $verbose, @@ -148,6 +168,16 @@ class openstack::keystone ( internal_address => $nova_internal_real, } } + + # Configure Nova endpoint in Keystone + if $cinder { + class { 'cinder::keystone::auth': + password => $cinder_user_password, + public_address => $cinder_public_real, + admin_address => $cinder_admin_real, + internal_address => $cinder_internal_real, + } + } } }