cinder_config {
'DEFAULT/enable_v1_api': value => $enable_v1_api;
'DEFAULT/enable_v2_api': value => $enable_v2_api;
'DEFAULT/enable_v3_api': value => $enable_v3_api;
}
Class cinder::api
class cinder::api 主要配置和管理cinder的api服务
管理服务
cinder可以作为一个服务启动,也可以启动在apache下
if $service_name == $::cinder::params::api_service {
service { 'cinder-api':
ensure => $ensure,
name => $::cinder::params::api_service,
enable => $enabled,
hasstatus => true,
require => Package['cinder'],
tag => 'cinder-service',
}
} elsif $service_name == 'httpd' {
include ::apache::params
service { 'cinder-api':
ensure => 'stopped',
name => $::cinder::params::api_service,
enable => false,
tag => ['cinder-service'],
}
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => 'cinder.volume.drivers.rbd.RBDDriver';
"${name}/rbd_ceph_conf": value => $rbd_ceph_conf;
"${name}/rbd_user": value => $rbd_user;
"${name}/rbd_pool": value => $rbd_pool;
"${name}/rbd_max_clone_depth": value => $rbd_max_clone_depth;
"${name}/rbd_flatten_volume_from_snapshot": value => $rbd_flatten_volume_from_snapshot;
"${name}/rbd_secret_uuid": value => $rbd_secret_uuid;
"${name}/rados_connect_timeout": value => $rados_connect_timeout;
"${name}/rados_connection_interval": value => $rados_connection_interval;
"${name}/rados_connection_retries": value => $rados_connection_retries;
"${name}/rbd_store_chunk_size": value => $rbd_store_chunk_size;
}
Class cinder::backends
由于cinder支持多后端,这个类主要用来管理开启哪些存储后端
调用cinder_config来修改cinder.conf
class cinder::backends (
$enabled_backends = undef,
) {
# Maybe this could be extented to dynamicly find the enabled names
cinder_config {
'DEFAULT/enabled_backends': value => join($enabled_backends, ',');
}
}
Define cinder::type
cinder开启多后端后,如何确定要将卷创建到哪个后端呢,这就要有type来决定.
define cinder::type (
$set_key = undef,
$set_value = undef,
# DEPRECATED PARAMETERS
$os_password = undef,
$os_tenant_name = undef,
$os_username = undef,
$os_auth_url = undef,
$os_region_name = undef,
) {
if $os_password or $os_region_name or $os_tenant_name or $os_username or $os_auth_url {
warning('Parameters $os_password/$os_region_name/$os_tenant_name/$os_username/$os_auth_url are not longer required')
warning('Auth creds will be used from env or /root/openrc file or cinder.conf')
}
if ($set_value and $set_key) {
if is_array($set_value) {
$value = join($set_value, ',')
} else {
$value = $set_value
}
cinder_type { $name:
ensure => present,
properties => ["${set_key}=${value}"],
}
} else {
cinder_type { $name:
ensure => present,
}
}
}