5 echo INFO: starting $(basename "$0")
8 if ! pidof ceph-mon &> /dev/null; then
9 echo INFO: ceph-mon is not running, skipping
14 INSTALLED_VERSION=$(ceph --version | awk '{print $3}')
15 if ! [[ "$INSTALLED_VERSION" =~ ^0\.94.* ]]; then
16 echo INFO: version of Ceph installed is not 0.94, skipping
20 CEPH_STATUS=$(ceph health | awk '{print $1}')
21 if [ ${CEPH_STATUS} = HEALTH_ERR ]; then
22 echo ERROR: Ceph cluster status is HEALTH_ERR, cannot be upgraded
26 # Useful when upgrading with OSDs num < replica size
27 if [[ ${ignore_ceph_upgrade_warnings:-False} != [Tt]rue ]]; then
28 timeout 300 bash -c "while [ ${CEPH_STATUS} != HEALTH_OK ]; do
29 echo WARNING: Waiting for Ceph cluster status to go HEALTH_OK;
31 CEPH_STATUS=$(ceph health | awk '{print $1}')
35 MON_PID=$(pidof ceph-mon)
38 # Stop daemon using Hammer sysvinit script
39 service ceph stop mon.${MON_ID}
42 timeout 60 bash -c "while kill -0 ${MON_PID} 2> /dev/null; do
47 yum -y -q update ceph-mon ceph
49 # Restart/Exit if not on Jewel, only in that case we need the changes
50 UPDATED_VERSION=$(ceph --version | awk '{print $3}')
51 if [[ "$UPDATED_VERSION" =~ ^0\.94.* ]]; then
52 echo WARNING: Ceph was not upgraded, restarting daemons
53 service ceph start mon.${MON_ID}
54 elif [[ "$UPDATED_VERSION" =~ ^10\.2.* ]]; then
55 # RPM could own some of these but we can't take risks on the pre-existing files
56 for d in /var/lib/ceph/mon /var/log/ceph /var/run/ceph /etc/ceph; do
57 chown -L -R ceph:ceph $d || echo WARNING: chown of $d failed
60 # Replay udev events with newer rules
64 systemctl enable ceph-mon.target
65 systemctl enable ceph-mon@${MON_ID}
66 systemctl start ceph-mon@${MON_ID}
68 # Wait for daemon to be back in the quorum
69 timeout 300 bash -c "until (ceph quorum_status | jq .quorum_names | grep -sq ${MON_ID}); do
70 echo WARNING: Waiting for mon.${MON_ID} to re-join quorum;
74 # if tunables become legacy, cluster status will be HEALTH_WARN causing
75 # upgrade to fail on following node
76 ceph osd crush tunables default
78 echo INFO: Ceph was upgraded to Jewel
80 echo ERROR: Ceph was upgraded to an unknown release, daemon is stopped, need manual intervention