3 # This delivers the ceph-storage upgrade script to be invoked as part of the tripleo
4 # major upgrade workflow.
9 UPGRADE_SCRIPT=/root/tripleo_upgrade_node.sh
11 declare -f special_case_ovs_upgrade_if_needed > $UPGRADE_SCRIPT
12 # use >> here so we don't lose the declaration we added above
13 cat >> $UPGRADE_SCRIPT << 'ENDOFCAT'
15 ### DO NOT MODIFY THIS FILE
16 ### This file is automatically delivered to the ceph-storage nodes as part of the
17 ### tripleo upgrades workflow
20 echo INFO: starting $(basename "$0")
23 if ! pidof ceph-osd &> /dev/null; then
24 echo INFO: ceph-osd is not running, skipping
29 INSTALLED_VERSION=$(ceph --version | awk '{print $3}')
30 if ! [[ "$INSTALLED_VERSION" =~ ^0\.94.* ]]; then
31 echo INFO: version of Ceph installed is not 0.94, skipping
35 OSD_PIDS=$(pidof ceph-osd)
36 OSD_IDS=$(ls /var/lib/ceph/osd | awk 'BEGIN { FS = "-" } ; { print $2 }')
38 # "so that mirrors aren't rebalanced as if the OSD died" - gfidente / leseb
40 ceph osd set norebalance
41 ceph osd set nodeep-scrub
44 # Stop daemon using Hammer sysvinit script
45 for OSD_ID in $OSD_IDS; do
46 service ceph stop osd.${OSD_ID}
49 # Nice guy will return non-0 only when all failed
50 timeout 60 bash -c "while kill -0 ${OSD_PIDS} 2> /dev/null; do
54 special_case_ovs_upgrade_if_needed
56 # Update (Ceph to Jewel)
57 yum -y install python-zaqarclient # needed for os-collect-config
60 # Restart/Exit if not on Jewel, only in that case we need the changes
61 UPDATED_VERSION=$(ceph --version | awk '{print $3}')
62 if [[ "$UPDATED_VERSION" =~ ^0\.94.* ]]; then
63 echo WARNING: Ceph was not upgraded, restarting daemon
64 for OSD_ID in $OSD_IDS; do
65 service ceph start osd.${OSD_ID}
67 elif [[ "$UPDATED_VERSION" =~ ^10\.2.* ]]; then
68 # RPM could own some of these but we can't take risks on the pre-existing files
69 for d in /var/lib/ceph/osd /var/log/ceph /var/run/ceph /etc/ceph; do
70 chown -L -R ceph:ceph $d || echo WARNING: chown of $d failed
73 # Replay udev events with newer rules
74 udevadm trigger && udevadm settle
76 # If on ext4, we need to enforce lower values for name and namespace len
77 # or ceph-osd will refuse to start, see: http://tracker.ceph.com/issues/16187
78 for OSD_ID in $OSD_IDS; do
79 OSD_FS=$(df -l --output=fstype /var/lib/ceph/osd/ceph-${OSD_ID} | tail -n +2)
80 if [ ${OSD_FS} = ext4 ]; then
81 crudini --set /etc/ceph/ceph.conf global osd_max_object_name_len 256
82 crudini --set /etc/ceph/ceph.conf global osd_max_object_namespace_len 64
87 systemctl enable ceph-osd.target
88 for OSD_ID in $OSD_IDS; do
89 systemctl enable ceph-osd@${OSD_ID}
90 systemctl start ceph-osd@${OSD_ID}
93 echo INFO: Ceph was upgraded to Jewel
95 echo ERROR: Ceph was upgraded to an unknown release, daemon is stopped, need manual intervention
100 ceph osd unset norebalance
101 ceph osd unset nodeep-scrub
102 ceph osd unset noscrub
105 # ensure the permissions are OK
106 chmod 0755 $UPGRADE_SCRIPT