Project

General

Profile

Revision f9b0002e

IDf9b0002e13bba44e90a5df5509fcc5a4a843f35a
Parent 74b7fe2d
Child cdb44aa9

Added by Noah Watkins over 10 years ago

kraken: fix negative osd counts

Count the OSD states explicitly.

Fixes: #5771

Signed-off-by: Noah Watkins <>

View differences:

webapp/calamari/ceph/management/commands/ceph_refresh.py
144 144
        return counts
145 145

  
146 146
    def _calculate_osd_counters(self):
147
        osds = self.client.get_status()['osdmap']['osdmap']
148
        keys = ['num_osds', 'num_up_osds', 'num_in_osds']
149
        total, up, inn = (int(osds[k]) for k in keys)
150
        return {
151
            'total': total,
152
            'up_in': inn,
153
            'up_not_in': up-inn,
154
            'not_up_not_in': total-up,
147
        osds = self.client.get_osds()["osds"]
148
        counters = {
149
            'total': len(osds),
150
            'not_up_not_in': 0,
151
            'not_up_in': 0,
152
            'up_not_in': 0,
153
            'up_in': 0
155 154
        }
155
        for osd in osds:
156
            up, inn = osd['up'], osd['in']
157
            if not up and not inn:
158
                counters['not_up_not_in'] += 1
159
            elif not up and inn:
160
                counters['not_up_in'] += 1
161
            elif up and not inn:
162
                counters['up_not_in'] += 1
163
            elif up and inn:
164
                counters['up_in'] += 1
165
        return counters
156 166

  
157 167
    def _calculate_mds_counters(self):
158 168
        mdsmap = self.client.get_status()['mdsmap']

Also available in: Unified diff