[PRD-1543] enable ceph in site part 2.

Add move ceph::cinder to cinder::volumes:ceph
* add test for manage_volumes to except iscsi or ceph
* add osnaily test to set manage_volumes
Move ceph::glance to glance::backend::ceph
This commit is contained in:
Andrew Woodward 2013-09-27 17:20:33 -07:00
parent 45186146d1
commit 3251c3366a
9 changed files with 138 additions and 134 deletions

View File

@ -1,59 +0,0 @@
#ceph::cinder will setup cinder parts if detected on the system
class ceph::cinder (
$volume_driver = $::ceph::volume_driver,
$rbd_pool = $::ceph::rbd_pool,
$glance_api_version = $::ceph::glance_api_version,
$rbd_user = $::ceph::rbd_user,
$rbd_secret_uuid = $::ceph::rbd_secret_uuid,
) {
if defined(Class['openstack::cinder']){
Cinder_config<||> ~> Service["${::ceph::params::service_cinder_volume}" ]
File_line<||> ~> Service["${::ceph::params::service_cinder_volume}"]
#TODO: this needs to be re-worked to follow https://wiki.openstack.org/wiki/Cinder-multi-backend
cinder_config {
'DEFAULT/volume_driver': value => $volume_driver;
'DEFAULT/rbd_pool': value => $rbd_pool;
'DEFAULT/glance_api_version': value => $glance_api_version;
'DEFAULT/rbd_user': value => $rbd_user;
'DEFAULT/rbd_secret_uuid': value => $rbd_secret_uuid;
}
file {$::ceph::params::service_cinder_volume_opts:
ensure => 'present',
} -> file_line {'cinder-volume.conf':
path => $::ceph::params::service_cinder_volume_opts,
line => "export CEPH_ARGS='--id ${::ceph::cinder_pool}'",
}
if ! defined(Class['cinder::volume']) {
service {$::ceph::params::service_cinder_volume:
ensure => 'running',
enable => true,
hasstatus => true,
hasrestart => true,
}
}
exec {'Create Cinder Ceph client ACL':
# DO NOT SPLIT ceph auth command lines! See http://tracker.ceph.com/issues/3279
command => "ceph auth get-or-create client.${::ceph::cinder_pool} mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=${::ceph::cinder_pool}, allow rx pool=${::ceph::glance_pool}'",
logoutput => true,
}
$cinder_keyring = "/etc/ceph/ceph.client.${::ceph::cinder_pool}.keyring"
exec {'Create keys for the Cinder pool':
command => "ceph auth get-or-create client.${::ceph::cinder_pool} > ${cinder_keyring}",
before => File[$cinder_keyring],
creates => $cinder_keyring,
require => Exec['Create Cinder Ceph client ACL'],
notify => Service["${::ceph::params::service_cinder_volume}"],
returns => 0,
}
file {$cinder_keyring:
owner => cinder,
group => cinder,
require => Exec['Create keys for the Cinder pool'],
mode => '0600',
}
}
}

View File

@ -1,51 +0,0 @@
#ceph:glance will configure glance parts if present on the system
class ceph::glance (
$default_store = $::ceph::default_store,
$rbd_store_user = $::ceph::rbd_store_user,
$rbd_store_pool = $::ceph::rbd_store_pool,
$show_image_direct_url = $::ceph::show_image_direct_url,
) {
if defined(Class['openstack::glance']) {
if ! defined('glance::backend::ceph') {
package {['python-ceph']:
ensure => latest,
}
glance_api_config {
'DEFAULT/default_store': value => $default_store;
'DEFAULT/rbd_store_user': value => $rbd_store_user;
'DEFAULT/rbd_store_pool': value => $rbd_store_pool;
'DEFAULT/show_image_direct_url': value => $show_image_direct_url;
}~> Service[$::ceph::params::service_glance_api]
service { $::ceph::params::service_glance_api:
ensure => 'running',
enable => true,
hasstatus => true,
hasrestart => true,
}
}
exec {'Create Glance Ceph client ACL':
# DO NOT SPLIT ceph auth command lines! See http://tracker.ceph.com/issues/3279
command => "ceph auth get-or-create client.${::ceph::glance_pool} mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=${::ceph::glance_pool}'",
logoutput => true,
}
$glance_keyring = "/etc/ceph/ceph.client.${::ceph::glance_pool}.keyring"
exec {'Create keys for the Glance pool':
command => "ceph auth get-or-create client.${::ceph::glance_pool} > ${$glance_keyring}",
before => File[$glance_keyring],
creates => $glance_keyring,
require => Exec['Create Glance Ceph client ACL'],
notify => Service["${::ceph::params::service_glance_api}"],
returns => 0,
}
file {$glance_keyring:
owner => glance,
group => glance,
require => Exec['Create keys for the Glance pool'],
mode => '0600',
}
}
}

View File

@ -52,7 +52,7 @@ class ceph (
$rbd_secret_uuid = 'a5d0dd94-57c4-ae55-ffe0-7e3732a24455',
# Glance settings
$default_store = 'rbd',
$glance_backend = 'ceph',
$rbd_store_user = 'images',
$rbd_store_pool = 'images',
$show_image_direct_url = 'True',
@ -81,15 +81,16 @@ class ceph (
case $::fuel_settings['role'] {
'primary-controller', 'controller', 'ceph-mon': {
include ceph::mon, ceph::glance, ceph::cinder
include ceph::mon #FIXME: ceph::glance, ceph::cinder
Class['ceph::conf'] ->
Class['ceph::mon'] ->
Service['ceph'] ->
Class[['ceph::glance', 'ceph::cinder']]
Service['ceph']
if ($::ceph::use_rgw) {
include ceph::libnss, ceph::keystone, ceph::radosgw
Class['ceph::libnss'] -> Class[['ceph::keystone', 'ceph::radosgw']]
Class['ceph::params'] ->
Class['ceph::libnss'] ->
Class[['ceph::keystone', 'ceph::radosgw']]
}
}

View File

@ -5,8 +5,9 @@ class ceph::libnss {
}
file {$::ceph::rgw_nss_db_path:
ensure => 'directory',
mode => '0755',
ensure => 'directory',
mode => '0755',
require => Package['ceph']
}
}

View File

@ -0,0 +1,55 @@
class cinder::volume::ceph (
$volume_driver = $::ceph::volume_driver,
$rbd_pool = $::ceph::rbd_pool,
$glance_api_version = $::ceph::glance_api_version,
$rbd_user = $::ceph::rbd_user,
$rbd_secret_uuid = $::ceph::rbd_secret_uuid,
) {
require ::ceph
Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ],
cwd => '/root',
}
Cinder_config<||> ~> Service['cinder-volume']
File_line<||> ~> Service['cinder-volume']
# TODO: this needs to be re-worked to follow https://wiki.openstack.org/wiki/Cinder-multi-backend
cinder_config {
'DEFAULT/volume_driver': value => $volume_driver;
'DEFAULT/rbd_pool': value => $rbd_pool;
'DEFAULT/glance_api_version': value => $glance_api_version;
'DEFAULT/rbd_user': value => $rbd_user;
'DEFAULT/rbd_secret_uuid': value => $rbd_secret_uuid;
}
# TODO: convert to cinder params
file {$::ceph::params::service_cinder_volume_opts:
ensure => 'present',
} -> file_line {'cinder-volume.conf':
path => $::ceph::params::service_cinder_volume_opts,
line => "export CEPH_ARGS='--id ${::ceph::cinder_pool}'",
}
exec {'Create Cinder Ceph client ACL':
# DO NOT SPLIT ceph auth command lines! See http://tracker.ceph.com/issues/3279
command => "ceph auth get-or-create client.${::ceph::cinder_pool} mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=${::ceph::cinder_pool}, allow rx pool=${::ceph::glance_pool}'",
logoutput => true,
}
$cinder_keyring = "/etc/ceph/ceph.client.${::ceph::cinder_pool}.keyring"
exec {'Create keys for the Cinder pool':
command => "ceph auth get-or-create client.${::ceph::cinder_pool} > ${cinder_keyring}",
before => File[$cinder_keyring],
creates => $cinder_keyring,
require => Exec['Create Cinder Ceph client ACL'],
notify => Service['cinder-volume'],
returns => 0,
}
file {$cinder_keyring:
owner => cinder,
group => cinder,
require => Exec['Create keys for the Cinder pool'],
mode => '0600',
}
}

View File

@ -6,14 +6,43 @@ class glance::backend::ceph(
$show_image_direct_url = $::ceph::show_image_direct_url,
) inherits glance::api {
require ::ceph
Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ],
cwd => '/root',
}
package {'python-ceph':
ensure => latest,
}
glance_api_config {
'DEFAULT/default_store': value => $default_store;
'DEFAULT/rbd_store_user': value => $rbd_store_user;
'DEFAULT/rbd_store_pool': value => $rbd_store_pool;
'DEFAULT/show_image_direct_url': value => $show_image_direct_url;
'DEFAULT/default_store': value => $default_store;
'DEFAULT/rbd_store_user': value => $rbd_store_user;
'DEFAULT/rbd_store_pool': value => $rbd_store_pool;
'DEFAULT/show_image_direct_url': value => $show_image_direct_url;
}~> Service[$::ceph::params::service_glance_api]
exec {'Create Glance Ceph client ACL':
# DO NOT SPLIT ceph auth command lines! See http://tracker.ceph.com/issues/3279
command => "ceph auth get-or-create client.${::ceph::glance_pool} mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=${::ceph::glance_pool}'",
logoutput => true,
}
$glance_keyring = "/etc/ceph/ceph.client.${::ceph::glance_pool}.keyring"
exec {'Create keys for the Glance pool':
command => "ceph auth get-or-create client.${::ceph::glance_pool} > ${$glance_keyring}",
before => File[$glance_keyring],
creates => $glance_keyring,
require => Exec['Create Glance Ceph client ACL'],
notify => Service["${::ceph::params::service_glance_api}"],
returns => 0,
}
file {$glance_keyring:
owner => glance,
group => glance,
require => Exec['Create keys for the Glance pool'],
mode => '0600',
}
}

View File

@ -101,10 +101,17 @@ class openstack::cinder(
package_ensure => $::openstack_version['cinder'],
enabled => true,
}
class { 'cinder::volume::iscsi':
iscsi_ip_address => $iscsi_bind_host,
physical_volume => $physical_volume,
volume_group => $volume_group,
case $manage_volumes {
true, 'iscsi': {
class { 'cinder::volume::iscsi':
iscsi_ip_address => $iscsi_bind_host,
physical_volume => $physical_volume,
volume_group => $volume_group,
}
}
'ceph': {
class {'cinder::volume::ceph': }
}
}
}
}

View File

@ -131,6 +131,17 @@ if ($storage_hash['images_ceph']) {
$glance_backend = 'swift'
}
# Determine who should get the volume service
if ($::role == 'cinder' or
$storage_hash['volumes_lvm']
) {
$manage_volumes = 'iscsi'
} elsif ($storage_hash['volumes_ceph']) {
$manage_volumes = 'ceph'
} else {
$manage_volumes = false
}
if ($use_ceph) {
$primary_mons = $controllers
$primary_mon = $controllers[0]['name']
@ -139,6 +150,7 @@ if ($use_ceph) {
cluster_node_address => $controller_node_address,
use_rgw => $storage_hash['objects_ceph'],
use_ssl => false,
glance_backend => $glance_backend,
}
}
@ -160,8 +172,6 @@ if ($use_swift){
$master_swift_proxy_nodes = filter_nodes($nodes_hash,'role','primary-controller')
$master_swift_proxy_ip = $master_swift_proxy_nodes[0]['internal_address']
#$master_hostname = $master_swift_proxy_nodes[0]['name']
#Moved to CEPH if block
#$glance_backend = 'swift'
$swift_loopback = false
if $::fuel_settings['role'] == 'primary-controller' {
$primary_proxy = true
@ -195,7 +205,6 @@ if $::fuel_settings['role'] == 'primary-controller' {
#HARDCODED PARAMETERS
$multi_host = true
$manage_volumes = false
$quantum_netnode_on_cnt = true
$mirror_type = 'external'
Exec { logoutput => true }
@ -261,7 +270,7 @@ class compact_controller (
cinder_iscsi_bind_addr => $cinder_iscsi_bind_addr,
cinder_db_password => $cinder_hash[db_password],
cinder_volume_group => "cinder",
manage_volumes => $is_cinder_node,
manage_volumes => $manage_volumes,
galera_nodes => $controller_nodes,
custom_mysql_setup_class => $custom_mysql_setup_class,
mysql_skip_name_resolve => true,
@ -421,7 +430,7 @@ class virtual_ips () {
verbose => $verbose ? { 'true' => true, true => true, default=> false },
cinder_volume_group => "cinder",
vnc_enabled => true,
manage_volumes => $cinder ? { false => $manage_volumes, default =>$is_cinder_node },
manage_volumes => $manage_volumes,
nova_user_password => $nova_hash[user_password],
cache_server_ip => $controller_nodes,
service_endpoint => $::fuel_settings['management_vip'],
@ -478,7 +487,7 @@ class virtual_ips () {
rabbit_host => false,
rabbit_nodes => $::fuel_settings['management_vip'],
volume_group => 'cinder',
manage_volumes => true,
manage_volumes => $manage_volumes,
enabled => true,
auth_host => $::fuel_settings['management_vip'],
iscsi_bind_host => $storage_address,

View File

@ -128,6 +128,17 @@ if ($storage_hash['images_ceph']) {
$glance_backend = 'file'
}
# Determine who should get the volume service
if ($::role == 'cinder' or
$storage_hash['volumes_lvm']
) {
$manage_volumes = 'iscsi'
} elsif ($storage_hash['volumes_ceph']) {
$manage_volumes = 'ceph'
} else {
$manage_volumes = false
}
if ($use_ceph) {
$primary_mons = $controller
$primary_mon = $controller[0]['name']
@ -136,6 +147,7 @@ if ($use_ceph) {
cluster_node_address => $controller_node_address,
use_rgw => $storage_hash['objects_ceph'],
use_ssl => false,
glance_backend => $glance_backend,
}
}
@ -194,7 +206,7 @@ if ($use_ceph) {
cinder_db_password => $cinder_hash[db_password],
cinder_iscsi_bind_addr => $cinder_iscsi_bind_addr,
cinder_volume_group => "cinder",
manage_volumes => $::fuel_settings['cinder'] ? { false => $manage_volumes, default =>$is_cinder_node },
manage_volumes => $manage_volumes,
use_syslog => true,
syslog_log_level => $syslog_log_level,
syslog_log_facility_glance => $syslog_log_facility_glance,
@ -345,7 +357,7 @@ if ($use_ceph) {
cinder_db_password => $cinder_hash[db_password],
cinder_iscsi_bind_addr => $cinder_iscsi_bind_addr,
cinder_volume_group => "cinder",
manage_volumes => $cinder ? { false => $manage_volumes, default =>$is_cinder_node },
manage_volumes => $manage_volumes,
db_host => $controller_node_address,
debug => $debug ? { 'true' => true, true => true, default=> false },
verbose => $verbose ? { 'true' => true, true => true, default=> false },
@ -389,7 +401,7 @@ if ($use_ceph) {
qpid_user => $rabbit_hash[user],
qpid_nodes => [$controller_node_address],
volume_group => 'cinder',
manage_volumes => true,
manage_volumes => $manage_volumes,
enabled => true,
bind_host => $bind_host,
auth_host => $controller_node_address,