Skip to content

Commit

Permalink
Merge pull request #41098 from dvanders/nautilus_neg_progress
Browse files Browse the repository at this point in the history
nautilus: mon: ensure progress is [0,1] before printing

Reviewed-by: Sage Weil <sage@redhat.com>
Reviewed-by: Neha Ojha <nojha@redhat.com>
Reviewed-by: Josh Durgin <jdurgin@redhat.com>
  • Loading branch information
yuriw committed May 4, 2021
2 parents c320dd9 + 310c343 commit b329970
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/mon/Monitor.cc
Expand Up @@ -3063,8 +3063,14 @@ void Monitor::get_cluster_status(stringstream &ss, Formatter *f)
for (auto& i : pem) {
ss << " " << i.second.message << "\n";
ss << " [";
unsigned p;
if (i.second.progress >= 0.0 && i.second.progress <= 1.0) {
p = (unsigned)(i.second.progress * 30.0);
} else {
p = 0;
}
unsigned j;
for (j = 0; j < (unsigned)(i.second.progress * 30.0); ++j) {
for (j = 0; j < p; ++j) {
ss << '=';
}
for (; j < 30; ++j) {
Expand Down

0 comments on commit b329970

Please sign in to comment.