Refactor cinder-vmware role
Change-Id: Ibe86b7794d347e11d0465b927502bd58e2356b1a Implements: blueprint refactor-cinder-vmware-role
This commit is contained in:
parent
0c8de9b59d
commit
5473fb6c33
@ -44,8 +44,6 @@ if (member($roles, 'cinder') and $storage_hash['volumes_lvm']) {
|
|||||||
$manage_volumes = 'iscsi'
|
$manage_volumes = 'iscsi'
|
||||||
} elsif ($storage_hash['volumes_ceph']) {
|
} elsif ($storage_hash['volumes_ceph']) {
|
||||||
$manage_volumes = 'ceph'
|
$manage_volumes = 'ceph'
|
||||||
} elsif member($roles, 'cinder-vmware') {
|
|
||||||
$manage_volumes = 'vmdk'
|
|
||||||
} else {
|
} else {
|
||||||
$manage_volumes = false
|
$manage_volumes = false
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
- id: openstack-cinder
|
- id: openstack-cinder
|
||||||
type: puppet
|
type: puppet
|
||||||
groups: [primary-controller, controller, cinder-vmware]
|
groups: [primary-controller, controller]
|
||||||
required_for: [deploy_end, openstack-controller]
|
required_for: [deploy_end, openstack-controller]
|
||||||
requires: [rabbitmq, keystone, hosts, firewall]
|
requires: [rabbitmq, keystone, hosts, firewall]
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -146,7 +146,7 @@ $idle_timeout = '3600'
|
|||||||
if (member($roles, 'cinder') and $storage_hash['volumes_lvm']) {
|
if (member($roles, 'cinder') and $storage_hash['volumes_lvm']) {
|
||||||
$manage_volumes = 'iscsi'
|
$manage_volumes = 'iscsi'
|
||||||
$physical_volumes = false
|
$physical_volumes = false
|
||||||
} elsif (member($roles, 'cinder') and $storage_hash['volumes_vmdk']) {
|
} elsif member($roles, 'cinder-vmware') {
|
||||||
$manage_volumes = 'vmdk'
|
$manage_volumes = 'vmdk'
|
||||||
$physical_volumes = false
|
$physical_volumes = false
|
||||||
} elsif ($storage_hash['volumes_ceph']) {
|
} elsif ($storage_hash['volumes_ceph']) {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
- id: top-role-cinder
|
- id: top-role-cinder
|
||||||
type: puppet
|
type: puppet
|
||||||
groups: [cinder,cinder-block-device]
|
groups: [cinder, cinder-block-device, cinder-vmware]
|
||||||
required_for: [deploy_end]
|
required_for: [deploy_end]
|
||||||
requires: [hosts, firewall]
|
requires: [hosts, firewall]
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
type: puppet
|
type: puppet
|
||||||
groups: [cinder-vmware]
|
groups: [cinder-vmware]
|
||||||
required_for: [deploy_end]
|
required_for: [deploy_end]
|
||||||
requires: [openstack-cinder]
|
requires: [top-role-cinder]
|
||||||
condition: "settings:common.use_vcenter.value == true"
|
condition: "settings:common.use_vcenter.value == true"
|
||||||
parameters:
|
parameters:
|
||||||
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/vmware/cinder-vmware.pp
|
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/vmware/cinder-vmware.pp
|
||||||
|
33
deployment/puppet/vmware/files/cinder-volume-vmware.conf
Normal file
33
deployment/puppet/vmware/files/cinder-volume-vmware.conf
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
description "OpenStack Cinder Volume for VMware"
|
||||||
|
author "Alexander Arzhanov <aarzhanov@mirantis.com>"
|
||||||
|
|
||||||
|
start on runlevel [2345]
|
||||||
|
stop on runlevel [!2345]
|
||||||
|
|
||||||
|
chdir /var/run
|
||||||
|
|
||||||
|
respawn
|
||||||
|
respawn limit 20 5
|
||||||
|
limit nofile 65535 65535
|
||||||
|
|
||||||
|
pre-start script
|
||||||
|
for i in lock run log lib ; do
|
||||||
|
mkdir -p /var/$i/cinder
|
||||||
|
chown cinder /var/$i/cinder
|
||||||
|
done
|
||||||
|
end script
|
||||||
|
|
||||||
|
script
|
||||||
|
[ -x "/usr/bin/cinder-volume" ] || exit 0
|
||||||
|
DAEMON_ARGS=""
|
||||||
|
CINDER_VOLUME_OPTS=""
|
||||||
|
[ -r /etc/default/openstack ] && . /etc/default/openstack
|
||||||
|
[ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB
|
||||||
|
[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
|
||||||
|
[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/cinder/$UPSTART_JOB.log"
|
||||||
|
|
||||||
|
exec start-stop-daemon --start --chdir /var/lib/cinder \
|
||||||
|
--chuid cinder:cinder --make-pidfile --pidfile /var/run/cinder/$UPSTART_JOB.pid \
|
||||||
|
--exec /usr/bin/cinder-volume -- --config-file=/etc/cinder/cinder.conf ${CINDER_VOLUME_OPTS} ${DAEMON_ARGS}
|
||||||
|
end script
|
||||||
|
|
114
deployment/puppet/vmware/files/openstack-cinder-volume-vmware
Normal file
114
deployment/puppet/vmware/files/openstack-cinder-volume-vmware
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# openstack-cinder-volume OpenStack Cinder Volume Services
|
||||||
|
#
|
||||||
|
# chkconfig: - 98 02
|
||||||
|
# description: Volume Workers interact with iSCSI storage to manage \
|
||||||
|
# LVM-based instance volumes. Specific functions include: \
|
||||||
|
# * Create Volumes \
|
||||||
|
# * Establish Compute volumes
|
||||||
|
## BEGIN INIT INFO
|
||||||
|
# Provides:
|
||||||
|
# Required-Start: $remote_fs $network $syslog
|
||||||
|
# Required-Stop: $remote_fs $syslog
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: OpenStack cinder Volume Worker
|
||||||
|
# Description: Volume Workers interact with iSCSI storage to manage
|
||||||
|
# LVM-based instance volumes. Specific functions include:
|
||||||
|
# * Create Volumes
|
||||||
|
# * Delete Volumes
|
||||||
|
# * Establish Compute volumes
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
. /etc/rc.d/init.d/functions
|
||||||
|
|
||||||
|
suffix=volume
|
||||||
|
cluster=${0##*-} # s/cluster/index/
|
||||||
|
prog=openstack-cinder-$suffix-vmware-$cluster
|
||||||
|
exec="/usr/bin/cinder-$suffix"
|
||||||
|
config="/etc/cinder/cinder.conf"
|
||||||
|
pidfile="/var/run/cinder/cinder-$suffix.$cluster.pid"
|
||||||
|
logfile="/var/log/cinder/$suffix-$cluster.log"
|
||||||
|
|
||||||
|
[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||||
|
|
||||||
|
lockfile=/var/lock/subsys/$prog
|
||||||
|
|
||||||
|
start() {
|
||||||
|
[ -x $exec ] || exit 5
|
||||||
|
[ -f $config ] || exit 6
|
||||||
|
echo -n $"Starting $prog: "
|
||||||
|
daemon --user cinder --pidfile $pidfile "$exec --logfile $logfile --config-file=$config ${OPTIONS} &>/dev/null & echo \$! > $pidfile"
|
||||||
|
retval=$?
|
||||||
|
echo
|
||||||
|
[ $retval -eq 0 ] && touch $lockfile
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
echo -n $"Stopping $prog: "
|
||||||
|
killproc -p $pidfile ${prog%%.*}
|
||||||
|
if pgrep -f "cinder-$suffix.*$cluster\.conf" &>/dev/null ; then
|
||||||
|
sleep 2
|
||||||
|
pgrep -f "cinder-$suffix.*$cluster\.conf" &>/dev/null && \
|
||||||
|
pkill -f "$cluster.conf"
|
||||||
|
fi
|
||||||
|
retval=$?
|
||||||
|
echo
|
||||||
|
[ $retval -eq 0 ] && rm -f $lockfile
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
|
||||||
|
restart() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
restart
|
||||||
|
}
|
||||||
|
|
||||||
|
force_reload() {
|
||||||
|
restart
|
||||||
|
}
|
||||||
|
|
||||||
|
rh_status() {
|
||||||
|
status -p $pidfile $prog
|
||||||
|
}
|
||||||
|
|
||||||
|
rh_status_q() {
|
||||||
|
rh_status >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
rh_status_q && exit 0
|
||||||
|
$1
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
rh_status_q || exit 0
|
||||||
|
$1
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
$1
|
||||||
|
;;
|
||||||
|
reload)
|
||||||
|
rh_status_q || exit 7
|
||||||
|
$1
|
||||||
|
;;
|
||||||
|
force-reload)
|
||||||
|
force_reload
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
rh_status
|
||||||
|
;;
|
||||||
|
condrestart|try-restart)
|
||||||
|
rh_status_q || exit 0
|
||||||
|
restart
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||||
|
exit 2
|
||||||
|
esac
|
||||||
|
exit $?
|
@ -33,27 +33,10 @@ define vmware::cinder::vmdk(
|
|||||||
$debug = false,
|
$debug = false,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
include cinder::params
|
include cinder::params
|
||||||
$index = $availability_zone_name
|
$index = $availability_zone_name
|
||||||
$cinder_volume_conf = "${cinder_conf_dir}/vmware-${index}.conf"
|
$cinder_volume_conf = "${cinder_conf_dir}/vmware-${index}.conf"
|
||||||
$cinder_volume_log = "${cinder_log_dir}/vmware-${index}.log"
|
|
||||||
$cinder_conf = '/etc/cinder/cinder.conf'
|
|
||||||
$cinder_volume_vmware = "${::cinder::params::volume_service}-vmware"
|
$cinder_volume_vmware = "${::cinder::params::volume_service}-vmware"
|
||||||
$storage_hash = hiera('storage', {})
|
|
||||||
$nodes_hash = hiera('nodes', {})
|
|
||||||
$roles = node_roles($nodes_hash, hiera('uid'))
|
|
||||||
|
|
||||||
if ($storage_hash['volumes_ceph']) and
|
|
||||||
!(member($roles, 'primary-controller') or
|
|
||||||
member($roles, 'controller')) {
|
|
||||||
service { 'cinder-volume':
|
|
||||||
enable => false,
|
|
||||||
ensure => stopped,
|
|
||||||
name => $::cinder::params::volume_service,
|
|
||||||
hasstatus => true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ! defined(File[$cinder_conf_dir]) {
|
if ! defined(File[$cinder_conf_dir]) {
|
||||||
file { $cinder_conf_dir:
|
file { $cinder_conf_dir:
|
||||||
@ -76,6 +59,15 @@ define vmware::cinder::vmdk(
|
|||||||
|
|
||||||
File[$cinder_conf_dir]->File[$cinder_volume_conf]
|
File[$cinder_conf_dir]->File[$cinder_volume_conf]
|
||||||
|
|
||||||
|
if ! defined(Service["cinder_volume_vmware"]) {
|
||||||
|
service { "cinder_volume_vmware":
|
||||||
|
enable => false,
|
||||||
|
ensure => stopped,
|
||||||
|
name => "${cinder_volume_vmware}",
|
||||||
|
hasstatus => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ! defined(Service["cinder_volume_vmware_${index}"]) {
|
if ! defined(Service["cinder_volume_vmware_${index}"]) {
|
||||||
service { "cinder_volume_vmware_${index}":
|
service { "cinder_volume_vmware_${index}":
|
||||||
ensure => running,
|
ensure => running,
|
||||||
@ -88,6 +80,7 @@ define vmware::cinder::vmdk(
|
|||||||
'RedHat': {
|
'RedHat': {
|
||||||
$src_init = $cinder_volume_vmware
|
$src_init = $cinder_volume_vmware
|
||||||
$dst_init = '/etc/init.d'
|
$dst_init = '/etc/init.d'
|
||||||
|
$file_perm = '0755'
|
||||||
$cinder_volume_vmware_init = "${dst_init}/${cinder_volume_vmware}"
|
$cinder_volume_vmware_init = "${dst_init}/${cinder_volume_vmware}"
|
||||||
$init_link = "${cinder_volume_vmware_init}-${index}"
|
$init_link = "${cinder_volume_vmware_init}-${index}"
|
||||||
if ! defined(File[$init_link]) {
|
if ! defined(File[$init_link]) {
|
||||||
@ -101,26 +94,26 @@ define vmware::cinder::vmdk(
|
|||||||
if ! defined(File[$cinder_volume_default]){
|
if ! defined(File[$cinder_volume_default]){
|
||||||
file { $cinder_volume_default:
|
file { $cinder_volume_default:
|
||||||
ensure => present,
|
ensure => present,
|
||||||
content => "OPTIONS='--config-file=${cinder_conf} \
|
content => "OPTIONS='--config-file=${cinder_volume_conf}'",
|
||||||
--config-file=${cinder_volume_conf}'",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File[$cinder_volume_default]~>
|
File[$cinder_volume_default]~>
|
||||||
Service["cinder_volume_vmware_${index}"]
|
Service["cinder_volume_vmware_${index}"]->
|
||||||
|
Service["cinder_volume_vmware"]
|
||||||
}
|
}
|
||||||
'Debian': {
|
'Debian': {
|
||||||
$cinder_volume_default = "/etc/default/${cinder_volume_vmware}-${index}"
|
$cinder_volume_default = "/etc/default/${cinder_volume_vmware}-${index}"
|
||||||
$src_init = "${cinder_volume_vmware}.conf"
|
$src_init = "${cinder_volume_vmware}.conf"
|
||||||
$dst_init = '/etc/init'
|
$dst_init = '/etc/init'
|
||||||
|
$file_perm = '0644'
|
||||||
|
|
||||||
ensure_packages($::cinder::params::volume_package)
|
ensure_packages($::cinder::params::volume_package)
|
||||||
Package[$::cinder::params::volume_package] -> Exec[$src_init]
|
Package[$::cinder::params::volume_package] -> File[$src_init]
|
||||||
|
|
||||||
if ! defined(File[$cinder_volume_default]) {
|
if ! defined(File[$cinder_volume_default]) {
|
||||||
file { $cinder_volume_default:
|
file { $cinder_volume_default:
|
||||||
ensure => present,
|
ensure => present,
|
||||||
content => "CINDER_VOLUME_OPTS='--config-file=${cinder_conf} \
|
content => "CINDER_VOLUME_OPTS='--config-file=${cinder_volume_conf}'",
|
||||||
--config-file=${cinder_volume_conf} --log-file=${cinder_volume_log}'",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,23 +137,25 @@ define vmware::cinder::vmdk(
|
|||||||
|
|
||||||
File[$cinder_volume_default]~>
|
File[$cinder_volume_default]~>
|
||||||
Exec[$init_reload]->
|
Exec[$init_reload]->
|
||||||
Service["cinder_volume_vmware_${index}"]
|
Service["cinder_volume_vmware_${index}"]->
|
||||||
|
Service["cinder_volume_vmware"]
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
fail { "Unsupported OS family (${::osfamily})": }
|
fail { "Unsupported OS family (${::osfamily})": }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmd = "cp /usr/share/cinder/${src_init} ${dst_init}"
|
if ! defined(File[$src_init]) {
|
||||||
if ! defined(Exec[$src_init]) {
|
file { $src_init:
|
||||||
exec {$src_init:
|
source => "puppet:///modules/vmware/${src_init}",
|
||||||
command => $cmd,
|
path => "${dst_init}/${src_init}",
|
||||||
path => [ '/bin', '/sbin', '/usr/bin', '/usr/sbin' ]
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => $file_perm,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Exec[$src_init]->
|
File[$src_init]->
|
||||||
File[$init_link]->
|
File[$init_link]->
|
||||||
File[$cinder_volume_default]
|
File[$cinder_volume_default]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user