Skip to content

Commit

Permalink
(cgi+cli) fixed division by zero when scount is zero in arch mode (no…
Browse files Browse the repository at this point in the history
… chunkservers - issue #412)
  • Loading branch information
acid-maker committed Dec 7, 2021
1 parent 4e260e8 commit 76a5bed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This file lists noteworthy changes in MooseFS.
- (client) fixed invalidating directory cache after 'unlink','rmdir' and 'rename'
- (cs) fixed cond variables leaking
- (all) silence silly compilator warnings
- (cgi+cli) fixed division by zero when scount is zero in arch mode (no chunkservers - issue #412)

* MooseFS 3.0.116-1 (2021-08-10)

Expand Down
5 changes: 4 additions & 1 deletion mfsscripts/mfscli.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -6099,7 +6099,10 @@ if "RS" in sectionset and leaderfound:
out.append(""" <td align="center"><span class="ERROR">NO</span></td>""")
labelsarr = []
for labelstr,mscount in arch_labellist:
msperc = (1.0 * mscount) / scount
if scount==0:
msperc = 0;
else:
msperc = (1.0 * mscount) / scount
perccolor = (int(zerocolor[0]+(allcolor[0]-zerocolor[0])*msperc),int(zerocolor[1]+(allcolor[1]-zerocolor[1])*msperc),int(zerocolor[2]+(allcolor[2]-zerocolor[2])*msperc))
color = "#%02X%02X%02X" % perccolor
labelsarr.append("""<span style="color:%s"><a style="cursor:default" title="%u/%u servers">%s</a></span>""" % (color,mscount,scount,labelstr))
Expand Down

0 comments on commit 76a5bed

Please sign in to comment.