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 cat > $UPGRADE_SCRIPT << 'ENDOFCAT'
13 ### DO NOT MODIFY THIS FILE
14 ### This file is automatically delivered to the ceph-storage nodes as part of the
15 ### tripleo upgrades workflow
18 echo INFO: starting $(basename "$0")
21 if ! pidof ceph-osd; then
22 echo INFO: ceph-osd is not running, skipping
27 INSTALLED_VERSION=$(ceph --version | awk '{print $3}')
28 if ! [[ "$INSTALLED_VERSION" =~ ^0\.94.* ]]; then
29 echo INFO: version of Ceph installed is not 0.94, skipping
33 OSD_PIDS=$(pidof ceph-osd)
34 OSD_IDS=$(ls /var/lib/ceph/osd | awk 'BEGIN { FS = "-" } ; { print $2 }')
36 # "so that mirrors aren't rebalanced as if the OSD died" - gfidente / leseb
38 ceph osd set norebalance
39 ceph osd set nodeep-scrub
42 # Stop daemon using Hammer sysvinit script
43 for OSD_ID in $OSD_IDS; do
44 service ceph stop osd.${OSD_ID}
47 # Nice guy will return non-0 only when all failed
48 timeout 60 bash -c "while kill -0 ${OSD_PIDS} 2> /dev/null; do
52 # Update (Ceph to Jewel)
53 yum -y install python-zaqarclient # needed for os-collect-config
56 # Restart/Exit if not on Jewel, only in that case we need the changes
57 UPDATED_VERSION=$(ceph --version | awk '{print $3}')
58 if [[ "$UPDATED_VERSION" =~ ^0\.94.* ]]; then
59 echo WARNING: Ceph was not upgraded, restarting daemon
60 for OSD_ID in $OSD_IDS; do
61 service ceph start osd.${OSD_ID}
63 elif [[ "$UPDATED_VERSION" =~ ^10\.2.* ]]; then
64 # RPM could own some of these but we can't take risks on the pre-existing files
65 for d in /var/lib/ceph/osd /var/log/ceph /var/run/ceph /etc/ceph; do
66 chown -R ceph:ceph $d || echo WARNING: chown of $d failed
69 # Replay udev events with newer rules
70 udevadm trigger && udevadm settle
73 systemctl enable ceph-osd.target
74 for OSD_ID in $OSD_IDS; do
75 systemctl enable ceph-osd@${OSD_ID}
76 systemctl start ceph-osd@${OSD_ID}
79 echo INFO: Ceph was upgraded to Jewel
81 echo ERROR: Ceph was upgraded to an unknown release, daemon is stopped, need manual intervention
86 ceph osd unset norebalance
87 ceph osd unset nodeep-scrub
88 ceph osd unset noscrub
91 # ensure the permissions are OK
92 chmod 0755 $UPGRADE_SCRIPT