fuel-library/deployment/puppet/ceph/spec/classes/osds__spec.rb
Oleg Gelbukh 8f05952ddf Support Ceph OSD devices with existing data set
Partition preservation feature allows to preserve data on Ceph OSD device,
but later on Puppet will run 'ceph-deploy prepare' on every Ceph device in
a system. This call destroys data set on those devices.

To preserve data on Ceph OSD devices through deployment process, we need to
check if the device has Ceph data and if so, skip execution of 'ceph-deploy 
prepare' on that device. Only prepared devices must be activated to avoid
deployment failure.

Following steps are made in the strict sequence to ensure protection of 
the existing data:

* execute 'udevadm trigger' to force create links for devices in /dev/disk
* execute 'ceph-disk activate-all' to force activation of all devices
  identified as ceph osds
* in ceph::osds::osd class for every ceph osd device check if it is prepared
  or active, if not, run 'ceph-deploy prepare' on it
* for every osd device, check if it is prepared (not active) and activate it

Change-Id: I667fa6aab9d6f46c73bfb8ca0e267afede6049fb
Implements: blueprint upgrade-redeploy-node
2015-11-27 10:45:37 +00:00

34 lines
1.2 KiB
Ruby

require 'spec_helper'
describe 'ceph::osds', :type => :class do
context 'Simple ceph::osds class test' do
let (:params) {{ :devices => ['/dev/vdc', '/dev/vdd' ] }}
it { should contain_exec('udevadm trigger') }
it { should contain_exec('ceph-disk activate-all').that_requires('Exec[udevadm trigger]') }
it { should contain_firewall('011 ceph-osd allow').that_requires('Exec[ceph-disk activate-all]') }
it { should contain_ceph__osds__osd('/dev/vdc').that_requires('Firewall[011 ceph-osd allow]') }
it { should contain_ceph__osds__osd('/dev/vdd').that_requires('Firewall[011 ceph-osd allow]') }
end
context 'Class ceph::osds without devices' do
let (:params) {{ :devices => nil }}
it { should contain_firewall('011 ceph-osd allow') }
it { should_not contain_ceph__osds__osd }
end
context 'Class ceph::osds with devices and journals' do
let (:params) {{ :devices => ['/dev/sdc1:/dev/sdc2', '/dev/sdd1:/dev/sdd2'] }}
it { should contain_firewall('011 ceph-osd allow') }
it { should contain_ceph__osds__osd('/dev/sdc1:/dev/sdc2') }
it { should contain_ceph__osds__osd('/dev/sdd1:/dev/sdd2') }
end
end
# vim: set ts=2 sw=2 et :