-
Notifications
You must be signed in to change notification settings - Fork 108
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
Mdstat #293
base: master
Are you sure you want to change the base?
Mdstat #293
Conversation
Mostly complete functionality with a test case that covers several cases.
Thanks for starting work on this!
Sometimes it's a mix of both. I personally don't have a need for mdstat parsing (my machines don't have MD disks), but I'd like I'm not familiar with the
Understood, this is a challenge. If you know what code is generating the mdstat output, including references to that would be very useful |
That makes sense. I can rework the code with that in mind. Another question I have is: to what extent should parsing be strict? Should the code bail-out at the first sign of trouble, or return info on the best-effort basis or something in between?
In general, method referenced in an original issue is en entry point for generating a For testing purposes, this can create a raid to play arround with:
|
Good question. This is mostly a judgement call, and it takes into account the complicatedness of the format, how the data would be represented in procfs, how the data would be used, etc. A reasonable example to look at might be the My general approach has been: if a procfs file that we are parsing has an unexpected format, then that is a bug in procfs, to be handled with |
My stab at parsing
mdstat
file in relation to #278 . Code seems to be working as intended, but is a bit messy. I'm opening a pull request to gather feedback before sinking too much time cleaning things up "the wrong way".I abstained from adding regex dependency. It would definitely make some things easier, but the format is so full of nested optional bits that it wouldn't clear up all the messiness of parsing it. I see from support.md that there are many unsupported files. I'm not sure if it's because of lack of interest for them, or they are also tricky to parse? If later, maybe going for something like logos would be even more useful than just regex.
Another thing is that there are many output states that seem possible from looking at the code generating it, but I'm not sure how to produce them, so there are lot of places where the parser is coded from my understanding of the generating code, rather than any example I've found, or managed to reproduce.