-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
ceph-volume: add inventory command #24859
Conversation
I kept the per-drive report and the json formatted reports quite verbose. Tighter filtering could easily be done.
|
Related to #24768 |
Can you show us the output in json when no device is passed ? Reading the code makes me feel that all the devices will be reported. |
This patch is exposing ceph-volume internals data structure. That could be acceptable but that's create a serious dependency with 3rd party tools like orchestrators. If we would merge in the actual state, that would mean that those exposed data structures could never been renamed or amended (data type etc..). Which would maybe lead to versioning the data structure to track a possible change in the format / types. That might sound overkill but we may have to get an abstraction here where we map some internals with "external" names like in an API. So the reported structure is consistent even if the internal data structure changes. |
This looks like a good first pass. I don't think that the key/value from the data structure needs to change or be renamed. No need to version things either. However, we would need to improve the presentation a bit for the non-json format, so that the highly verbose output can be parsed a bit better. One thing we've done in other commands is adding a separator between items, and indenting the key/values for each section. Another thing we've done is to be fully verbose with JSON output, but minimally so with the pretty (or non-json) format. That way it helps trim down the repetitive items. Finally, I think that some filtering could be added to add or remove attributes from being shown. That might be too much effort from an initial pass, but good to keep in mind! |
Yes all devices will be reported, that what I took away from your comment here. See this paste for a json output
Agreed...this needs some work. I was trying to avoid to many details before people got a chance to comment.
Same approach here. Only for the per-drive non.json output I wasn't sure what to not print. I'll remove a bunch of not so interesting fields to see what people think. |
I'm not saying that we have to change or rename the datastructures. So two options
|
@jan--f The pretty output is unsorted and seems to be presented in an order which match the python's internal representation. This sorting have strictly no meaning for the admin/user.
|
I think we are missing here to report which disks are actually used by ceph. We know which block device is a backend storage for our OSDs. In that case, the disk should be reported as in use by ceph (fsid ? osds ?)
|
this PR shouldn't get derailed by a discussion on what @ErwanAliasr1 thinks about "internal" vs. "external". Throughout ceph-volume we keep consistency between system APIs (like output from LVM) with what we present back to the user. @jan--f I am happy about the current direction, let me know when this is ready for a thorough review! |
@alfredodeza I really wonder why you consider a remark on why exposing internal data structures as a default format with external tools (orchestrators in this case) is derailing this PR. Really. |
@alfredodeza one more time, I would have appreciate a technical debate rather then having a moral consideration. Derailed. Waow. |
I'd argue that exposing a dict of {str: str} is manageable even if it could be considered an internal data structure. Should this at some point change to be a more complex data structure further abstractions (like a translation table) could easily be added. At this point I'd consider it unnecessary complexity. Also the information are physical disk attributes, kernel information and c-v specific info that we explicitly want to expose. None of these pieces are likely to dramatically change. |
@jan--f If we go in that direction, we have to get a test that ensure the structures members we expose like disk_api, path, reject_reasons, sys_api/*, valid should not be renamed and keeps the same data structure (string/int/array/...). If we don't do this, any commit that touch this could break the orchestrator/manager/UI. |
This looks generally reasonable to me, but I've not yet spent any real time looking at the ceph-volume code. Just so I understand, @ErwanAliasr1, you're concerned that this may expose internal data structures of ceph-volume, but @alfredodeza is saying that what's exposed is really only what's passed through from the underlying system tools? |
@tserong This feature have two users, humans and a chain of 3rd party tools including ceph-manager and the orchestrators. So the json ouput of this command will be consumed by this chain of 3rd party tools. That implies that once the c-v output will be defined it, will be consumed and defacto considered as the expected output of c-v in this command. So those 3rd party tools will implement their decoding/parsing of it. To function, c-v is reading stuff on the system from various sources, store them into datastructures for a later use like other c-v functions or presenting them to the user for an output. What question me here is the fact the output of this command will be an automated extraction of those datastructures. That once the ceph-mgr/orchestrator will start consuming this output, if one is making a commit on any of those expose datastructures (name or format), the whole chain is broken. When you make a commit on the internals of the project, it's pretty unlikely that would immediately break the whole chain. So, in my opinion we should protect ceph-volume against that potential change by having a test that guarantee that no-one will break this data structures that we expose as a default format for ceph-mgr/orchestrator. We can also add an indirection layer that allow a potential change inside the datastructure while keeping a stable output. That may be added later once we'll discover a case of this test I'm speaking reporting a breakage in the output. The two approaches are complementary. @alfredodeza consider that I'm derailing the PR by considering the work we are doing here with the manager should be stable & guaranteed over time. This chain is supposed to be one of the feature of nautilus as repeated by @liewegas. |
de5dd0a
to
97d2db8
Compare
I updated the commit with improved formatting, sorted output and a test case to make sure the interface looks as expected. I also dropped the Looking forward to comments. @ErwanAliasr1 I certainly understand your concerns on the conceptual level. I think its worth keeping in mind though that
|
97d2db8
to
b56845f
Compare
909030a
to
c6c7ce3
Compare
With respect to the (imo valid) discussion about exposing internal data structures, what about reviewing the data we want to expose?
Looks sane to me. I have just minor things to consider here:
|
0b898a7
to
e015754
Compare
Example output with logical volume scaning:
I'll try to add output from a shared device as well, don't have one handy right now. |
Thanks @jan--f. Your PR is very promising to get this important feature inside the product. |
@jan--f The rejected_reasons and valid field were added to indicate if a device is free to make a new OSD. So if we know that's already an OSD, there is no need to report that information. That could be confusing. |
The Device class is aware of ceph-disk OSDs iiuc. I'll add it to the report.
I think those fields each serve their purpose. I'd rather not change the report structure based on its content. |
That makes sense. Maybe I should rename "valid" by another semantic like "free", "empty" or any other proposal to get a term meaning the disk could be used to make a new OSD. The "valid" here is very very confusing in such context. Any thoughts ? @alfredodeza ? |
I think we can make |
@@ -57,43 +129,96 @@ def __repr__(self): | |||
prefix = 'Raw Device' | |||
return '<%s: %s>' % (prefix, self.abspath) | |||
|
|||
def pretty_report(self): | |||
output = ['\n====== Device report {} ======\n'.format(self.path)] | |||
output.extend( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the last thing I see could be improved is special casing the rejected reasons. Right now displays a Python list. If the list grows to more than one item it defeats the purpose of using the pretty
option (might as well just parse the JSON).
When a device is not available it should be pretty clear that it isn't (to avoid having the user scrolling to look for it). Some items that might help would be making the title/header red, and placing the rejected
always first (or always last?).
When the rejected reasons are displayed, they shouldn't use the list, they should be rendered one per line, something like:
====== Device report /dev/vdg ======
rejected reasons
* locked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorting is already implemented. Devices are sorted by the valid flag (valid < invalid) and the device name otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RIght, but if you are displaying 100 devices and you have 84 devices that are invalid, you still need to browse through quite a bunch to find where the division between valid/invalid starts.
Again, I am not saying this is necessary for this PR, if prioritizing, I think the rejected reasons fix would be preferable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could flip the ordering. Maybe it makes more sense though to add the ability to simply not display invalid devices?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my opinion the default should be listing everything.
We have 3 categories of drives ,
- totally free to be used as new OSDs
- used by ceph
- used by anything else
It could be useful to have flags to keep only a single category to ease the reading for humans or make an orchestrator having a way to pre-filter the devices types like "please tell me what devices are free to be used".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would mostly be interesting for the pretty report. Any software piece that interacts with the json output can easily filter this output and an orchestrator implementation might actually want that info (how many unavailable disks).
I do think this would be best addressed in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to go. My last nit about rejected reasons can be done separately (feel free to address here though), as well as changing valid
to some other name. This PR is about introducing the inventory
sub-command, would like to avoid feature creep.
Once we'll have this PR merge, I'll update the semantic of "valid". |
@ErwanAliasr1 I have code to address http://tracker.ceph.com/issues/36701. A property rename could easily be part of that. I did use |
The inventory command provides information about a nodes disk inventory. Existing logical volumes on a disk or one of its partitions are scanned and reported. The output can be formatted as plain text or json. Signed-off-by: Jan Fajerski <jfajerski@suse.com>
e015754
to
57adfc6
Compare
k, I added formatting for the rejected_reasons field. The remaining comments should be addressed in separate PRs imho, i.e. this is good to go. |
jenkins test ceph-volume tox |
@jan--f would you mind following up with some doc updates? both for |
Thanks, everyone! |
@@ -117,6 +117,21 @@ def test_not_used_by_ceph(self, device_info, pvolumes, monkeypatch): | |||
disk = device.Device("/dev/sda") | |||
assert not disk.used_by_ceph | |||
|
|||
disk1 = device.Device("/dev/sda") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't catch these, but these are causing failures on systems where /dev/sda
doesn't exist.
The inventory command provides information about a nodes disk inventory.
The output can be formatted as plain text or json.
Signed-off-by: Jan Fajerski jfajerski@suse.com
Fixes: http://tracker.ceph.com/issues/24972