Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr: fix "osd status" command exception if OSD not in pgmap stats #18173

Merged
merged 2 commits into from Nov 20, 2017

Conversation

Projects
None yet
3 participants
@gmayyyha
Copy link
Contributor

commented Oct 9, 2017

@gmayyyha

This comment has been minimized.

Copy link
Contributor Author

commented Oct 9, 2017

@jcsp pls help review. thanks!

@gmayyyha

This comment has been minimized.

Copy link
Contributor Author

commented Oct 9, 2017

before:
before

after:
after

autoout

@jcsp
Copy link
Contributor

left a comment

Apologies for delay reviewing this, please see comments.

stats = osd_stats[osd_id]

osd_table.add_row([osd_id, metadata['hostname'],
self.format_bytes(stats['kb_used'] * 1024, 5),

This comment has been minimized.

Copy link
@jcsp

jcsp Oct 26, 2017

Contributor

it would be nicer to have a couple of variables for the kb_used/kb_avail columns, so that the overall add_row call could just be there once instead of duplicating the whole thing

@@ -252,7 +252,7 @@ def handle_fs_status(self, cmd):
return 0, "", output

def handle_osd_status(self, cmd):
osd_table = PrettyTable(['id', 'host', 'used', 'avail', 'wr ops', 'wr data', 'rd ops', 'rd data'])
osd_table = PrettyTable(['id', 'host', 'used', 'avail', 'wr ops', 'wr data', 'rd ops', 'rd data', 'state'])

This comment has been minimized.

Copy link
@jcsp

jcsp Oct 26, 2017

Contributor

I don't mind adding state, but please put it in a separate commit to the bug fix. Also, please output the state as something like ",".join(osd['state'])

This comment has been minimized.

Copy link
@gmayyyha

gmayyyha Oct 27, 2017

Author Contributor

like this?

+----+--------+-------+-------+--------+---------+--------+---------+------------+
| id |  host  |  used | avail | wr ops | wr data | rd ops | rd data |   state    |
+----+--------+-------+-------+--------+---------+--------+---------+------------+
| 0  | ceph14 | 1092M | 9211M |    0   |     0   |    0   |     0   | exists,up  |
| 1  | ceph14 | 1092M | 9211M |    0   |     0   |    0   |     0   | exists,up  |
| 2  | ceph14 | 1092M | 9211M |    0   |     0   |    0   |     0   | exists,up  |
| 3  |        |    0  |    0  |    0   |     0   |    0   |     0   | exists,new |
+----+--------+-------+-------+--------+---------+--------+---------+------------+

@gmayyyha gmayyyha force-pushed the gmayyyha:osd-status-21707 branch from 5da12a7 to 8d5845e Oct 27, 2017

kb_used = stats['kb_used'] * 1024
kb_avail = stats['kb_avail'] * 1024

state = ""

This comment has been minimized.

Copy link
@jcsp

jcsp Nov 1, 2017

Contributor

This is the right format, but we don't need to write out a for loop like this: you can do it in one line with ",".join(osd['state'])

This comment has been minimized.

Copy link
@gmayyyha

gmayyyha Nov 6, 2017

Author Contributor

done.

mgr: 'osd status' command return add state
Signed-off-by: Yanhu Cao <gmayyyha@gmail.com>

@gmayyyha gmayyyha force-pushed the gmayyyha:osd-status-21707 branch from 8d5845e to f3475c9 Nov 6, 2017

@liewegas

This comment has been minimized.

Copy link
Member

commented Nov 17, 2017

@jcsp ping

@jcsp

jcsp approved these changes Nov 20, 2017

Copy link
Contributor

left a comment

Looks great, thank you!

@jcsp jcsp merged commit 50412f7 into ceph:master Nov 20, 2017

5 checks passed

Docs: build check OK - docs built
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
make check (arm64) make check succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.