cmd/runtimetest/main.go: Unify validateMountsExist and validateMountsOrder#456
Merged
zhouhao3 merged 1 commit intoopencontainers:masterfrom Sep 1, 2017
Conversation
0fa2a3b to
401f3b6
Compare
Contributor
Author
|
@Mashimiao had expected this unified approach to be long and complicated, but it ended up dropping over 20 lines even with the extra bookkeeping for |
401f3b6 to
60ab7ad
Compare
|
The changes are good, but I don't think something like |
…Order
Also increase the error message detail and continue through the
remaining mounts instead of breaking on the first missing/misordered
mount. Based on previous discussion in [1,2]. With this commit,
a configuration like:
"mounts": [
{
"destination": "/tmp",
"type": "tmpfs",
"source": "none"
},
{
"destination": "/tmp",
"type": "tmpfs",
"source": "none"
},
{
"destination": "/dev",
"type": "devtmpfs",
"source": "devtmpfs"
}
]
and mountinfo like:
$ grep -n '/dev \|/tmp ' /proc/self/mountinfo
2:19 17 0:6 / /dev rw,nosuid,relatime - devtmpfs devtmpfs rw,size=10240k,nr_inodes=2043951,mode=755
25:41 17 0:38 / /tmp rw,relatime - tmpfs none rw
will generate errors like:
* mounts[1] {/tmp tmpfs none []} does not exist
* mounts[2] {/dev devtmpfs devtmpfs []} mounted before mounts[0] {/tmp tmpfs none []}
Before this commit, the error was just:
* Mounts[1] /tmp is not mounted in order
I'd prefer errors like:
* mounts[1] {/tmp tmpfs none []} does not exist
* mounts[2] {/dev devtmpfs devtmpfs []} is system mount 1, while mounts[0] {/tmp tmpfs none []} is system mount 24
where grep reports 2 and 25 because it's counting from one, and
runtimetest reports 1 and 24 because it's counting from zero, but Ma
prefers to not mention the system-mount order [3].
[1]: opencontainers#444 (comment)
[2]: opencontainers#444 (comment)
[3]: opencontainers#456 (comment)
Signed-off-by: W. Trevor King <wking@tremily.us>
60ab7ad to
bcb5379
Compare
Contributor
Author
|
On Thu, Aug 31, 2017 at 06:50:20AM +0000, Ma Shimiao wrote:
The changes are good, but I don't think something like `system mount
1` really make sense. we don't need to care about what it really
mounted number, we just need to care about if it is mounted in
order. And `system mount` is not easy understand. I think
`mounts[2] {/dev devtmpfs devtmpfs []} MUST be mounted in order
after mounts[0] {/tmp tmpfs none []}, but not` may be better.
I like the system mount order information (or I wouldn't have put it
in ;), but I don't feel that strongly about it. Removed in 60ab7ad →
bcb5379, so now the errors look like:
* mounts[1] {/tmp tmpfs none []} does not exist
* mounts[2] {/dev devtmpfs devtmpfs []} mounted before mounts[0] {/tmp tmpfs none []}
|
1 similar comment
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also increase the error message detail and continue through the remaining mounts instead of breaking on the first missing/misordered mount. Based on previous discussion here and here. With this commit, a configuration like:
and mountinfo like:
will generate errors like:
Grep reports 2 and 25 because it's counting from one, and
runtimetestreports 1 and 24 because it's counting from zero.Before this commit, the error was just: