-
Notifications
You must be signed in to change notification settings - Fork 296
libs: add Stat module in Unixext to handle special device IDs #6812
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
Conversation
1139dfa to
52ba24a
Compare
| Some {major; minor} | ||
|
|
||
| let encode_st_dev {major; minor} = | ||
| 0 |
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 0 |^ is added to make ocamlformat behave and keep the first major term parenthesised and aligned. The same has been done in in decode
52ba24a to
7753e0f
Compare
last-genius
left a comment
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.
Probably worth explaining the motivation for this - the fact that we saw real-world minors > 256 failing to be handled by xapi properly, as it is unable to figure out the format of the backing file, and has to handle the VDI as raw instead.
d037795 to
21cf444
Compare
These device IDs are handled in an ad-hoc way, and none of the implementations follow the actual linux behaviour. The glibc-provided macros are used for the implementation, with a pure-ocaml implementation that was useful to compare against while implementing, which has been kept in the tests, to detect any behavioural changes. Because Unix.stat returns an `int` instead of an int64, the code does not support all possible values for major supported by glibc. This shouldn't be an issue in Linux since the device value is 32-bit wide. Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
There were 5 ad-hoc implementations, they were all getting wrong results for the minor because only the lower 8 bits were accounted for. Use the unixext one which handles up to 32-bit-wide minors correctly. Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
21cf444 to
fc6ed07
Compare
Previously, when a failure happened while getting a base vhd, a non-descriptive error was printed. Because there can be many reasons that can cause this code to fail, model the possible errors and print them when needed. Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
fc6ed07 to
097d1bc
Compare
These device IDs are handled in an ad-hoc way, and none of the implementations follow the actual linux behaviour, replace all of them with an in imeplementation that uses the glibc macros to handle these.
Also change vhd_wrapper_tool to print better error messages when there's an error when getting the base VHD.
Reproduction steps:
for i in $(seq 1 512) ; do tap-ctl allocate; done. This forces the minor device ID to be higher than 255 for the local VBD created.The migration succeeds when both hosts in the pool have the changes in this PR running.