8f05952ddf
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
58 lines
1.8 KiB
Ruby
58 lines
1.8 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'ceph::osds::osd', :type => :define do
|
|
let :facts do
|
|
{ :hostname => 'test.example' }
|
|
end
|
|
|
|
context 'Simple test' do
|
|
let(:title) { '/dev/svv' }
|
|
|
|
it { should contain_exec("ceph-deploy osd prepare test.example:/dev/svv").with(
|
|
'command' => 'ceph-deploy osd prepare test.example:/dev/svv',
|
|
'returns' => 0,
|
|
'timeout' => 0,
|
|
'tries' => 2,
|
|
'try_sleep' => 1,
|
|
'logoutput' => true,
|
|
'unless' => "ceph-disk list | fgrep -q -e '/dev/svv ceph data, active' -e '/dev/svv ceph data, prepared'",
|
|
)
|
|
}
|
|
it { should contain_exec("ceph-deploy osd activate test.example:/dev/svv").with(
|
|
'command' => 'ceph-deploy osd activate test.example:/dev/svv',
|
|
'try_sleep' => 10,
|
|
'tries' => 3,
|
|
'logoutput' => true,
|
|
'timeout' => 0,
|
|
'onlyif' => "ceph-disk list | fgrep -q -e '/dev/svv ceph data, prepared'",
|
|
)
|
|
}
|
|
end
|
|
|
|
context 'Simple test with journal' do
|
|
let(:title) { '/dev/sdd:/dev/journal' }
|
|
it { should contain_exec("ceph-deploy osd prepare test.example:/dev/sdd:/dev/journal").with(
|
|
'command' => 'ceph-deploy osd prepare test.example:/dev/sdd:/dev/journal',
|
|
'returns' => 0,
|
|
'timeout' => 0,
|
|
'tries' => 2,
|
|
'try_sleep' => 1,
|
|
'logoutput' => true,
|
|
'unless' => "ceph-disk list | fgrep -q -e '/dev/sdd ceph data, active' -e '/dev/sdd ceph data, prepared'",
|
|
)
|
|
}
|
|
it { should contain_exec("ceph-deploy osd activate test.example:/dev/sdd:/dev/journal").with(
|
|
'command' => 'ceph-deploy osd activate test.example:/dev/sdd:/dev/journal',
|
|
'try_sleep' => 10,
|
|
'tries' => 3,
|
|
'logoutput' => true,
|
|
'timeout' => 0,
|
|
'onlyif' => "ceph-disk list | fgrep -q -e '/dev/sdd ceph data, prepared'",
|
|
)
|
|
}
|
|
end
|
|
|
|
end
|
|
|
|
# vim: set ts=2 sw=2 et :
|