-
Notifications
You must be signed in to change notification settings - Fork 554
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
Add a 'status' field to our state struct #462
Conversation
@@ -23,6 +30,7 @@ When serialized in JSON, the format MUST adhere to the following pattern: | |||
{ | |||
"ociVersion": "0.2.0", | |||
"id": "oci-container1", | |||
"status": "running", |
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.
formatting issue
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.
tabs... the root of all evil
I commented via email last night, but GitHub seems to have eaten my I'm opposed. There is no race-free way to do this gracefully without errors, since |
@wking the intent isn't to remove any chance of an error, the intent is to make it so that an error isn't part of the normal workflow just to figure out the state of a container. |
On Fri, May 27, 2016 at 02:08:03PM -0700, Doug Davis wrote:
So “decrease the likelyhood of generating errors” (and I agree that I think that the runtime needs to be careful in this case (e.g. I |
I would prefer a |
@mrunalp we already have one: https://github.com/duglin/runtime-spec/blob/master/runtime.md#query-state |
I meant status as a separate op that just returns the current run status of the container. Sent from my iPhone
|
@mrunalp why would another op that just returned the status be better than the state op that returns status along with the other info? |
On Tue, May 31, 2016 at 10:02:56AM -0700, Daniel, Dao Quang Minh wrote:
This is getting into very fuzzy territory to me. “I want to know
At least with the current spec, delete is not idempotent 1: Attempting to delete a container that does not exist MUST generate |
@crosbymichael |
I think it will be hard to keep the status field in the state file correct and queries race free. |
@mrunalp we are not talking about cat'ing a file. The state response is dynamic as well and the status is correct it is returned. Nothing static about it in the spec or in the runc implementation. |
the spec doesn't mention state files any more - we put it all behind an op. |
@crosbymichael Agree if the state isn't persisted in a file in a implementation (but anyway that is up to the implementation). |
@duglin Needs rebase. |
I think git is acting up again - there were not conflicts at all so the rebase shouldn't have been necessary. Very odd. |
The value MAY be one of: | ||
* `created` : the container has been created but the user-specified process has not yet been executed | ||
* `running` : the container has been created and the user-specified process is running | ||
* `stopped` : the container has been created and the user-specified process has been executed but is no longer running |
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.
Signed-off-by: Doug Davis <dug@us.ibm.com>
* **`status`**: (string) is the runtime state of the container. | ||
The value MAY be one of: | ||
* `created` : the container has been created but the user-specified process has not yet been executed | ||
* `running` : the container has been created and the user-specified process is running |
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'd rather have this be “the container process has executed user-specified code has not exited”. In Linux, in any case “running” is a technical term for one possible process state, and the status you're shooting for here also covers “sleeping”, “waiting”, and “stopped”.
oh man - had to rebase again. Github is really acting up. |
1 similar comment
…ecycle After unifying the pre- and post-split hook lifecycle information (this commit's first parent), merge master to pull in subsequent mainline evolution. Conflicts: runtime.md The conflict was a trivial collision with dd0cd21 (Add a 'status' field to our state struct, 2016-05-26, opencontainers#462). Signed-off-by: W. Trevor King <wking@tremily.us>
In [1], I'd proposed replacing our old "user-specified process" with "user-specified code" to help distinguish between 'create' (cloning the container process) and 'start' (signaling the container process to execve (or similar) the user-specified $STUFF_FROM_THE_process_CONFIG rejected, although the renaming proposed there had already landed via dd0cd21 (Add a 'status' field to our state struct, 2016-05-26, opencontainers#462). This PR attempts to find a common ground between "process" (preferred by maintainers in opencontainers#466 [2,3,4], but which I consider incorrect [5]) and "code" (which maintainers found confusing [3,4,6]). The Linux execve(2) has says "program" and unpacks that to "a binary executable, or a script starting with a [shebang]" [7]. proc(5) documents /proc/[pid]/exe by talking about "the executed command" [8]. The POSIX exec docs call this the "process image" and talk about loading it from the "new process image file" [9]. POSIX formally defines "command" [11], "executable file" [12], and "program" [13]. The only reference to "process image" in the definitions is in the "executable file" entry. The "command" definition is focused on the shell, the "executable file" definition is focused on files, and the "program" definition talks about a "prepared sequence of instructions to the system", so "program" seems like the best fit. [1]: opencontainers#466 Subject: runtime: Replace "user-specified process" with "user-specified code" in 'create' [2]: opencontainers#466 (comment) [3]: opencontainers#466 (comment) [4]: opencontainers#466 (comment) [5]: opencontainers#466 (comment) [6]: opencontainers#466 (comment) [7]: http://man7.org/linux/man-pages/man2/execve.2.html [8]: http://man7.org/linux/man-pages/man5/proc.5.html [9]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html [10]: https://git.kernel.org/cgit/docs/man-pages/man-pages.git/ [11]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_104 [12]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_154 [13]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_306 Signed-off-by: W. Trevor King <wking@tremily.us>
In [1], I'd proposed replacing our old "user-specified process" with "user-specified code" to help distinguish between 'create' (cloning the container process) and 'start' (signaling the container process to execve or similar the user-specified $STUFF_FROM_THE_process_CONFIG). That PR was rejected, although the renaming proposed there had already landed via dd0cd21 (Add a 'status' field to our state struct, 2016-05-26, opencontainers#462). This PR attempts to find a common ground between "process" (preferred by maintainers in opencontainers#466 [2,3,4], but which I consider incorrect [5]) and "code" (which maintainers found confusing [3,4,6]). The Linux execve(2) has says "program" and unpacks that to "a binary executable, or a script starting with a [shebang]" [7]. proc(5) documents /proc/[pid]/exe by talking about "the executed command" [8]. The POSIX exec docs call this the "process image" and talk about loading it from the "new process image file" [9]. POSIX formally defines "command" [11], "executable file" [12], and "program" [13]. The only reference to "process image" in the definitions is in the "executable file" entry. The "command" definition is focused on the shell, the "executable file" definition is focused on files, and the "program" definition talks about a "prepared sequence of instructions to the system", so "program" seems like the best fit. [1]: opencontainers#466 Subject: runtime: Replace "user-specified process" with "user-specified code" in 'create' [2]: opencontainers#466 (comment) [3]: opencontainers#466 (comment) [4]: opencontainers#466 (comment) [5]: opencontainers#466 (comment) [6]: opencontainers#466 (comment) [7]: http://man7.org/linux/man-pages/man2/execve.2.html [8]: http://man7.org/linux/man-pages/man5/proc.5.html [9]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html [10]: https://git.kernel.org/cgit/docs/man-pages/man-pages.git/ [11]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_104 [12]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_154 [13]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_306 Signed-off-by: W. Trevor King <wking@tremily.us>
In [1], I'd proposed replacing our old "user-specified process" with "user-specified code" to help distinguish between 'create' (cloning the container process) and 'start' (signaling the container process to execve or similar the user-specified $STUFF_FROM_THE_process_CONFIG). That PR was rejected, although the renaming proposed there had already landed via dd0cd21 (Add a 'status' field to our state struct, 2016-05-26, opencontainers#462). This PR attempts to find a common ground between "process" (preferred by maintainers in opencontainers#466 [2,3,4], but which I consider incorrect [5]) and "code" (which maintainers found confusing [3,4,6]). The Linux execve(2) says "program" and unpacks that to "a binary executable, or a script starting with a [shebang]" [7]. proc(5) documents /proc/[pid]/exe by talking about "the executed command" [8]. The POSIX exec docs call this the "process image" and talk about loading it from the "new process image file" [9]. POSIX formally defines "command" [11], "executable file" [12], and "program" [13]. The only reference to "process image" in the definitions is in the "executable file" entry. The "command" definition is focused on the shell, the "executable file" definition is focused on files, and the "program" definition talks about a "prepared sequence of instructions to the system", so "program" seems like the best fit. [1]: opencontainers#466 Subject: runtime: Replace "user-specified process" with "user-specified code" in 'create' [2]: opencontainers#466 (comment) [3]: opencontainers#466 (comment) [4]: opencontainers#466 (comment) [5]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_295 [6]: opencontainers#466 (comment) [7]: http://man7.org/linux/man-pages/man2/execve.2.html [8]: http://man7.org/linux/man-pages/man5/proc.5.html [9]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html [10]: https://git.kernel.org/cgit/docs/man-pages/man-pages.git/ [11]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_104 [12]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_154 [13]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_306 Signed-off-by: W. Trevor King <wking@tremily.us>
In [1], I'd proposed replacing our old "user-specified process" with "user-specified code" to help distinguish between 'create' (cloning the container process) and 'start' (signaling the container process to execve or similar the user-specified $STUFF_FROM_THE_process_CONFIG). That PR was rejected, although the renaming proposed there had already landed via dd0cd21 (Add a 'status' field to our state struct, 2016-05-26, opencontainers#462). This PR attempts to find a common ground between "process" (preferred by maintainers in opencontainers#466 [2,3,4], but which I consider incorrect [5]) and "code" (which maintainers found confusing [3,4,6]). The Linux execve(2) says "program" and unpacks that to "a binary executable, or a script starting with a [shebang]" [7]. proc(5) documents /proc/[pid]/exe by talking about "the executed command" [8]. The POSIX exec docs call this the "process image" and talk about loading it from the "new process image file" (although they also sprinkle in a number of “program” references, apparently interchangeably with “process image”) [9]. POSIX formally defines "command" [11], "executable file" [12], and "program" [13]. The only reference to "process image" in the definitions is in the "executable file" entry. The "command" definition is focused on the shell, the "executable file" definition is focused on files, and the "program" definition talks about a "prepared sequence of instructions to the system", so "program" seems like the best fit. [1]: opencontainers#466 Subject: runtime: Replace "user-specified process" with "user-specified code" in 'create' [2]: opencontainers#466 (comment) [3]: opencontainers#466 (comment) [4]: opencontainers#466 (comment) [5]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_295 [6]: opencontainers#466 (comment) [7]: http://man7.org/linux/man-pages/man2/execve.2.html [8]: http://man7.org/linux/man-pages/man5/proc.5.html [9]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html [10]: https://git.kernel.org/cgit/docs/man-pages/man-pages.git/ [11]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_104 [12]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_154 [13]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_306 Signed-off-by: W. Trevor King <wking@tremily.us>
…ecycle After unifying the pre- and post-split hook lifecycle information (this commit's first parent), merge master to pull in subsequent mainline evolution. Conflicts: runtime.md The conflicts were primarily due to: * dd0cd21 (Add a 'status' field to our state struct, 2016-05-26, opencontainers#462). * 98f0bdf (Add some related docs links, 2016-10-25, opencontainers#596). * c45ffb4 (*: Replace "user-specified code" with "user-specified program", 2016-11-18, opencontainers#629). Signed-off-by: W. Trevor King <wking@tremily.us>
…ecycle After unifying the pre- and post-split hook lifecycle information (this commit's first parent), merge master to pull in subsequent mainline evolution. Conflicts: runtime.md The conflicts were primarily due to: * dd0cd21 (Add a 'status' field to our state struct, 2016-05-26, opencontainers#462). * 98f0bdf (Add some related docs links, 2016-10-25, opencontainers#596). * c45ffb4 (*: Replace "user-specified code" with "user-specified program", 2016-11-18, opencontainers#629). Signed-off-by: W. Trevor King <wking@tremily.us>
…ecycle After unifying the pre- and post-split hook lifecycle information (this commit's first parent), merge master to pull in subsequent mainline evolution. Conflicts: runtime.md The conflicts were primarily due to: * dd0cd21 (Add a 'status' field to our state struct, 2016-05-26, opencontainers#462). * 98f0bdf (Add some related docs links, 2016-10-25, opencontainers#596). * c45ffb4 (*: Replace "user-specified code" with "user-specified program", 2016-11-18, opencontainers#629). Signed-off-by: W. Trevor King <wking@tremily.us>
When thinking about kill() vs delete(), a client needs to know (gracefully - w/o errors) when to call each. Which means it needs to be able to query the container to know what its current state is (running vs stopped). This defines a property in our 'state' struct to convey that info.
Signed-off-by: Doug Davis dug@us.ibm.com