Move umm from puppet to a package
Move umm related file from puppet to a package and change deploing process Change-Id: I466d89158fab523981ea002e83933696284a11ac Closes-bug:#1508274
This commit is contained in:
parent
e6078cff95
commit
8d138e0e0d
|
@ -22,3 +22,11 @@ Architecture: all
|
|||
Depends: ${misc:Depends}, ${shlibs:Depends}, dbus, python-gobject-2, python-gobject, python-dbus, python-daemon
|
||||
Description: Fuel RabbitMQ fencing utilitites
|
||||
.
|
||||
|
||||
Package: fuel-umm
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}, upstart
|
||||
Description: Unified maintenance mode
|
||||
Packet provide posibility to put operation system in the state when it has only
|
||||
critical set of working services which are needed for basic network and disk
|
||||
operations. Also node in MM state is reachable with ssh from network.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
var/lib/umm/
|
|
@ -0,0 +1,11 @@
|
|||
files/fuel-umm/issue.mm /etc/
|
||||
files/fuel-umm/umm.conf /etc/
|
||||
files/fuel-umm/umm.sh /etc/profile.d/
|
||||
files/fuel-umm/umm /usr/bin/
|
||||
files/fuel-umm/umm_svc /usr/lib/umm/
|
||||
files/fuel-umm/umm_svc.u1404 /usr/lib/umm/
|
||||
files/fuel-umm/umm_vars /usr/lib/umm/
|
||||
files/fuel-umm/umm-br.conf /etc/init/
|
||||
files/fuel-umm/umm-console.conf /etc/init/
|
||||
files/fuel-umm/umm-run.conf /etc/init/
|
||||
files/fuel-umm/umm-tr.conf /etc/init/
|
0
deployment/puppet/umm/files/umm-install.u1404 → debian/fuel-umm.postinst
vendored
Executable file → Normal file
0
deployment/puppet/umm/files/umm-install.u1404 → debian/fuel-umm.postinst
vendored
Executable file → Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
rm -f /etc/init/rc-sysinit.override
|
||||
rm -f /etc/init/failsafe.override
|
||||
rm -f /etc/init/umm.conf
|
||||
rm -f /etc/grub.d/55_umm
|
||||
update-grub
|
|
@ -13,4 +13,7 @@ override_dh_install:
|
|||
mv debian/fuel-ha-utils/usr/lib/ocf/resource.d/fuel/heat_engine_ubuntu debian/fuel-ha-utils/usr/lib/ocf/resource.d/fuel/heat-engine
|
||||
mv debian/fuel-misc/usr/bin/logrotate debian/fuel-misc/usr/bin/fuel-logrotate
|
||||
rm debian/fuel-ha-utils/usr/lib/ocf/resource.d/fuel/heat_engine_centos
|
||||
mv debian/fuel-umm/usr/lib/umm/umm_svc.u1404 debian/fuel-umm/usr/lib/umm/umm_svc.local
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
sed -e '/post-stop script/,/end script/!d' \
|
||||
-e '/post-stop script/a\ \ \ \ \ [ -f /usr/lib/umm/umm_svc ] && /usr/lib/umm/umm_svc' \
|
||||
/etc/init/rcS.conf >/etc/init/rcS.override
|
||||
|
||||
[ -f /boot/grub/grub.conf ] && GRC=/boot/grub/grub.conf
|
||||
|
||||
|
||||
if [ ! -z "$GRC" ]; then
|
||||
sed -e '/#UMM BEGIN/,/#UMM END/d' -i $GRC
|
||||
eval $(sed -n -e '/default=/ p' $GRC)
|
||||
ST='-e 1,/^title/d'
|
||||
until [ "$default" == "0" ] ; do
|
||||
ST="$ST -e 1,/^title/d"
|
||||
default=$(($default - 1))
|
||||
done;
|
||||
echo "#UMM BEGIN" >/tmp/mm-gr
|
||||
echo "title Unified Mintenance mode (UMM)" >>/tmp/mm-gr
|
||||
sed $ST -e 's/\(^\s*kernel .*\)/\1 umm/' -e '/^title/,$ d' $GRC>>/tmp/mm-gr
|
||||
echo "#UMM END" >>/tmp/mm-gr
|
||||
cat /tmp/mm-gr >>$GRC
|
||||
|
||||
rm /tmp/mm-gr
|
||||
fi
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
|
||||
|
||||
class umm::common (
|
||||
$release,
|
||||
)
|
||||
|
||||
{
|
||||
file { 'umm.conf':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/umm/umm.conf',
|
||||
path => '/etc/umm.conf',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0660',
|
||||
}
|
||||
|
||||
file { 'issue.mm':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/umm/issue.mm',
|
||||
path => '/etc/issue.mm',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0770',
|
||||
}
|
||||
|
||||
file { 'ummvar':
|
||||
ensure => directory,
|
||||
path => '/var/lib/umm',
|
||||
}
|
||||
|
||||
file { 'ummlib':
|
||||
ensure => directory,
|
||||
path => '/usr/lib/umm',
|
||||
require => File['ummvar'],
|
||||
}
|
||||
|
||||
file { 'umm_svc':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/umm/umm_svc',
|
||||
path => '/usr/lib/umm/umm_svc',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0770',
|
||||
require => File['ummlib']
|
||||
}
|
||||
|
||||
|
||||
file { 'umm_vars':
|
||||
ensure => present,
|
||||
content => template('umm/umm_vars.erb'),
|
||||
path => '/usr/lib/umm/umm_vars',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0770',
|
||||
require => File['ummlib']
|
||||
}
|
||||
|
||||
file { 'umm':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/umm/umm',
|
||||
path => '/usr/local/bin/umm',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0770',
|
||||
}
|
||||
|
||||
file { 'umm.sh':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/umm/umm.sh',
|
||||
path => '/etc/profile.d/umm.sh',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0770',
|
||||
}
|
||||
|
||||
file { 'umm-br.conf':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/umm/umm-br.conf',
|
||||
path => '/etc/init/umm-br.conf',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0660',
|
||||
}
|
||||
|
||||
file { 'umm-console.conf':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/umm/umm-console.conf',
|
||||
path => '/etc/init/umm-console.conf',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0660',
|
||||
}
|
||||
|
||||
file { 'umm-run.conf':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/umm/umm-run.conf',
|
||||
path => '/etc/init/umm-run.conf',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0660',
|
||||
}
|
||||
|
||||
file { 'umm-tr.conf':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/umm/umm-tr.conf',
|
||||
path => '/etc/init/umm-tr.conf',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0660',
|
||||
}
|
||||
}
|
||||
|
|
@ -1,79 +1,17 @@
|
|||
|
||||
|
||||
class umm (
|
||||
$umm_enabled = 'yes',
|
||||
$umm_reboot_count = '2',
|
||||
$umm_counter_reset_time = '10',
|
||||
)
|
||||
|
||||
{
|
||||
package { 'fuel-umm' :
|
||||
ensure => 'installed',
|
||||
}
|
||||
|
||||
if $::osfamily == 'Redhat' {
|
||||
if $::operatingsystemmajrelease == '6' {
|
||||
|
||||
class { 'umm::common':
|
||||
release => 'rh6',
|
||||
}
|
||||
|
||||
file { 'umm_svc.rh6':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/umm/umm_svc.rh6',
|
||||
path => '/usr/lib/umm/umm_svc.rh6',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0770',
|
||||
require => File['ummlib'],
|
||||
}
|
||||
|
||||
file { 'umm-install.sh':
|
||||
source => 'puppet:///modules/umm/umm-install.rh6',
|
||||
path => '/tmp/umm-install.sh',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0770',
|
||||
}
|
||||
|
||||
exec { 'umm-install':
|
||||
command => '/tmp/umm-install.sh',
|
||||
require => File['umm-install.sh'],
|
||||
path => ['/usr/sbin', '/usr/bin', '/sbin', '/bin' ],
|
||||
refreshonly => false,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if $::operatingsystem == 'ubuntu' {
|
||||
if $::operatingsystemrelease == '14.04' {
|
||||
|
||||
class { 'umm::common':
|
||||
release => 'u1404',
|
||||
}
|
||||
|
||||
file { 'umm_svc.u1404':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/umm/umm_svc.u1404',
|
||||
path => '/usr/lib/umm/umm_svc.u1404',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0770',
|
||||
require => File['ummlib'],
|
||||
}
|
||||
|
||||
file { 'umm-install.sh':
|
||||
source => 'puppet:///modules/umm/umm-install.u1404',
|
||||
path => '/tmp/umm-install.sh',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0770',
|
||||
}
|
||||
|
||||
exec { 'umm-install':
|
||||
command => '/tmp/umm-install.sh',
|
||||
require => File['umm-install.sh'],
|
||||
path => ['/usr/sbin', '/usr/bin', '/sbin', '/bin' ],
|
||||
refreshonly => false,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
file { 'umm_config' :
|
||||
ensure => present,
|
||||
content => template('umm/umm.conf.erb'),
|
||||
path => '/etc/umm.conf',
|
||||
require => Package['fuel-umm'],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
UMM=<%= @umm_enabled %>
|
||||
REBOOT_COUNT=<%= @umm_reboot_count %>
|
||||
COUNTER_RESET_TIME=<%= @umm_counter_reset_time %>
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
[[ -f /boot/grub/grub.conf ]] && GRC=/boot/grub/grub.conf
|
||||
[[ -f /etc/bashrc ]] && source /etc/bashrc
|
||||
|
||||
if [[ "$1" == "add" ]] ; then
|
||||
sed -e '/post-stop script/,/end script/!d' \
|
||||
-e '/post-stop script/a\ \ \ \ \ [ -f /usr/lib/umm/umm_svc ] && /usr/lib/umm/umm_svc' \
|
||||
/etc/init/rcS.conf >/etc/init/rcS.override
|
||||
if [[ ! -z "$GRC" ]] ; then
|
||||
sed -e '/#UMM BEGIN/,/#UMM END/d' -i $GRC
|
||||
eval $(sed -n -e '/default=/ p' $GRC)
|
||||
ST='-e 1,/^title/d'
|
||||
until [ "$default" == "0" ] ; do
|
||||
ST="$ST -e 1,/^title/d"
|
||||
default=$(($default - 1))
|
||||
done
|
||||
echo "#UMM BEGIN" >/tmp/mm-gr
|
||||
echo "title Unified Mintenance mode (UMM)" >>/tmp/mm-gr
|
||||
sed $ST -e 's/\(^\s*kernel .*\)/\1 umm/' -e '/^title/,$ d' $GRC>>/tmp/mm-gr
|
||||
echo "#UMM END" >>/tmp/mm-gr
|
||||
cat /tmp/mm-gr >>$GRC
|
||||
rm /tmp/mm-gr
|
||||
fi
|
||||
else
|
||||
rm -f /etc/init/rcS.override
|
||||
[[ ! -z $GRC ]] && sed -e '/#UMM BEGIN/,/#UMM END/d' -i $GRC
|
||||
fi
|
||||
|
||||
initctl reload-configuration
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
cat >/etc/init/rc-sysinit.override <<"EOF"
|
||||
start on umm
|
||||
EOF
|
||||
|
||||
cat >/etc/init/failsafe.override <<"EOF"
|
||||
stop on static-network-up or starting rc-sysinit or starting umm
|
||||
EOF
|
||||
|
||||
cat >/etc/init/umm.conf <<"EOF"
|
||||
# umm - Openstak maiteenace mode.
|
||||
#
|
||||
|
||||
description "Openstack maintenance mode"
|
||||
author "pzhurba@mirantis.com"
|
||||
|
||||
start on (filesystem and static-network-up) or failsafe-boot
|
||||
|
||||
emits umm
|
||||
|
||||
script
|
||||
[ -f /usr/lib/umm/umm_svc ] && /usr/lib/umm/umm_svc
|
||||
initctl emit umm
|
||||
end script
|
||||
EOF
|
||||
|
||||
cat >/etc/grub.d/55_umm << "EOF"
|
||||
if [ -f /etc/grub.d/10_linux ] ; then
|
||||
/etc/grub.d/10_linux | sed -n -e '/menuentry.*{/,/}/p' | sed -e "s/menuentry\s*'[^']*' /menuentry 'Unified maintenance mode (UMM)' /" -e 's/\(^\s*linux\s.*\)/\1 umm/' -e '/}/,$d'; echo '}'
|
||||
fi
|
||||
EOF
|
||||
|
||||
chmod +x /etc/grub.d/55_umm
|
||||
|
||||
update-grub
|
|
@ -28,7 +28,7 @@ initctl start umm-tr || true
|
|||
|
||||
|
||||
if [ -f $UMM_FLAG ] ; then
|
||||
${0}.${UMM_R}
|
||||
[ -x ${0}.local ] && ${0}.local
|
||||
initctl start umm-run || true
|
||||
fi
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
[ -f /etc/umm.conf ] && . /etc/umm.conf
|
||||
UMM_R=<%= @release %>
|
||||
UMM=${UMM:=no}
|
||||
|
||||
REBOOT_COUNT=${REBOOT_COUNT:=2}
|
|
@ -115,7 +115,24 @@ install -m 0644 %{files_source}/fuel-notify/free_disk_space_check.yaml %{buildro
|
|||
install -m 0755 %{files_source}/fuel-notify/fuel_notify.py %{buildroot}/usr/bin/fuel_notify.py
|
||||
#fuel-migrate
|
||||
install -m 0755 %{files_source}/fuel-migrate/fuel-migrate %{buildroot}/usr/bin/fuel-migrate
|
||||
|
||||
#UMM
|
||||
mkdir -p %{buildroot}/etc/init
|
||||
mkdir -p %{buildroot}/etc/profile.d/
|
||||
mkdir -p %{buildroot}/usr/bin
|
||||
mkdir -p %{buildroot}/usr/lib/umm
|
||||
mkdir -p %{buildroot}/var/lib/umm
|
||||
install -m 0644 %{files_source}/fuel-umm/issue.mm %{buildroot}/etc/issue.mm
|
||||
install -m 0644 %{files_source}/fuel-umm/umm.conf %{buildroot}/etc/umm.conf
|
||||
install -m 0755 %{files_source}/fuel-umm/umm.sh %{buildroot}/etc/profile.d/umm.sh
|
||||
install -m 0755 %{files_source}/fuel-umm/umm %{buildroot}/usr/bin/umm
|
||||
install -m 0755 %{files_source}/fuel-umm/umm_svc %{buildroot}/usr/lib/umm/umm_svc
|
||||
install -m 0755 %{files_source}/fuel-umm/umm_svc.rh6 %{buildroot}/usr/lib/umm/umm_svc.local
|
||||
install -m 0755 %{files_source}/fuel-umm/umm_vars %{buildroot}/usr/lib/umm/umm_vars
|
||||
install -m 0755 %{files_source}/fuel-umm/umm-install.rh6 %{buildroot}/usr/lib/umm/umm-install.rh6
|
||||
install -m 0644 %{files_source}/fuel-umm/umm-br.conf %{buildroot}/etc/init/umm-br.conf
|
||||
install -m 0644 %{files_source}/fuel-umm/umm-console.conf %{buildroot}/etc/init/umm-console.conf
|
||||
install -m 0644 %{files_source}/fuel-umm/umm-run.conf %{buildroot}/etc/init/umm-run.conf
|
||||
install -m 0644 %{files_source}/fuel-umm/umm-tr.conf %{buildroot}/etc/init/umm-tr.conf
|
||||
|
||||
|
||||
%post -p /bin/bash
|
||||
|
@ -262,6 +279,39 @@ Script for migrate Fuel master into vm
|
|||
#
|
||||
|
||||
|
||||
%package -n fuel-umm
|
||||
Summary: Unified maintenance mode
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
Group: System Environment/Libraries
|
||||
License: Apache 2.0
|
||||
Requires: upstart
|
||||
URL: http://github.com/openstack/fuel-library
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/fuel-library-%{version}-%{release}
|
||||
|
||||
%description -n fuel-umm
|
||||
Packet provide posibility to put operation system in the state when it has only
|
||||
critical set of working services which are needed for basic network and disk
|
||||
operations. Also node in MM state is reachable with ssh from network.
|
||||
|
||||
For further information go to:
|
||||
https://www.mirantis.com/products/mirantis-openstack-software/documentation/
|
||||
|
||||
%post -n fuel-umm
|
||||
/usr/lib/umm/umm-install.rh6 add
|
||||
%preun -n fuel-umm
|
||||
/usr/lib/umm/umm-install.rh6 del
|
||||
|
||||
%files -n fuel-umm
|
||||
/etc/issue.mm
|
||||
/etc/profile.d/umm.sh
|
||||
/etc/init/umm-*
|
||||
/usr/lib/umm/*
|
||||
/usr/bin/umm
|
||||
%dir /var/lib/umm
|
||||
%config(noreplace) /etc/umm.conf
|
||||
|
||||
%package -n fuel-notify
|
||||
Summary: Fuel disk space monitor
|
||||
Version: %{version}
|
||||
|
|
|
@ -3,6 +3,18 @@ require 'shared-examples'
|
|||
manifest = 'umm/umm.pp'
|
||||
|
||||
describe manifest do
|
||||
shared_examples 'catalog' do
|
||||
role = Noop.hiera 'role'
|
||||
it 'ensures fuel-umm installed and /etc/umm.conf is present' do
|
||||
if role == 'primary-controller' or role == 'controller'
|
||||
should contain_package('fuel-umm')
|
||||
should contain_file('umm_config').with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/umm.conf',
|
||||
)
|
||||
end
|
||||
end
|
||||
end # end of shared_examples
|
||||
test_ubuntu_and_centos manifest
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue