properly scale down an OSD when requested
When scaling down an OSD, we need to run `crush remove` command before deleting the OSD, to properly scale down the Ceph cluster. This patch also improve the way we test if an OSD is up or DNE. This recommendation is documented in the official Ceph documentation: https://access.redhat.com/documentation/en/red-hat-ceph-storage/version-1.3/red-hat-ceph-storage-13-red-hat-ceph-administration-guide/#removing-osds-manual Change-Id: I1749093740a4ab5de3493e257e311a0b9a3f06e3
This commit is contained in:
1 parent
9b975ba9cc
commit
1f2be78a26
3 files changed
+11
-6
No files matched your search
+2
-1
@@ -140,8 +140,9 @@ fi
|
||||
if [ \"\$id\" ] ; then
|
||||
stop ceph-osd cluster=${cluster_name} id=\$id || true
|
||||
service ceph stop osd.\$id || true
|
||||
ceph ${cluster_option} osd crush remove osd.\$id
|
||||
ceph ${cluster_option} auth del osd.\$id
|
||||
ceph ${cluster_option} osd rm \$id
|
||||
ceph auth del osd.\$id
|
||||
rm -fr /var/lib/ceph/osd/${cluster_name}-\$id/*
|
||||
umount /var/lib/ceph/osd/${cluster_name}-\$id || true
|
||||
rm -fr /var/lib/ceph/osd/${cluster_name}-\$id
|
||||
|
||||
@@ -54,14 +54,17 @@ describe 'ceph usecases' do
|
||||
expect(r.stderr).to be_empty
|
||||
end
|
||||
|
||||
shell 'ceph osd tree', { :acceptable_exit_codes => [0] } do |r|
|
||||
expect(r.stdout).to match(/osd.0/)
|
||||
shell 'ceph osd tree | grep osd.0', { :acceptable_exit_codes => [0] } do |r|
|
||||
expect(r.stdout).to match(/up/)
|
||||
expect(r.stderr).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
it 'should uninstall one osd' do
|
||||
shell 'ceph osd tree | grep DNE', { :acceptable_exit_codes => [1] }
|
||||
shell 'ceph osd tree | grep osd.0', { :acceptable_exit_codes => [0] } do |r|
|
||||
expect(r.stdout).to match(/up/)
|
||||
expect(r.stderr).to be_empty
|
||||
end
|
||||
|
||||
pp = <<-EOS
|
||||
ceph::osd { '/srv/data':
|
||||
@@ -74,7 +77,7 @@ describe 'ceph usecases' do
|
||||
|
||||
shell 'sleep 10' # we need to wait a bit until the OSD is down
|
||||
|
||||
shell 'ceph osd tree | grep DNE', { :acceptable_exit_codes => [0] }
|
||||
shell 'ceph osd tree | grep osd.0', { :acceptable_exit_codes => [1] }
|
||||
end
|
||||
|
||||
it 'should uninstall one monitor' do
|
||||
|
||||
@@ -168,8 +168,9 @@ fi
|
||||
if [ \"\$id\" ] ; then
|
||||
stop ceph-osd cluster=ceph id=\$id || true
|
||||
service ceph stop osd.\$id || true
|
||||
ceph osd crush remove osd.\$id
|
||||
ceph auth del osd.\$id
|
||||
ceph osd rm \$id
|
||||
ceph auth del osd.\$id
|
||||
rm -fr /var/lib/ceph/osd/ceph-\$id/*
|
||||
umount /var/lib/ceph/osd/ceph-\$id || true
|
||||
rm -fr /var/lib/ceph/osd/ceph-\$id
|
||||
|
||||
Reference in new issue
Block a user