-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
vendor: update runtime-spec v1.0.3-0.20200728170252-4d89ac9fbff6 #2520
Conversation
@@ -400,7 +400,7 @@ func (p *initProcess) start() (retErr error) { | |||
} | |||
// initProcessStartTime hasn't been set yet. | |||
s.Pid = p.cmd.Process.Pid | |||
s.Status = configs.Creating |
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.
Maybe change Status
type from string
to specs.ContainerState
instead of typecasting?
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 was looking at that; I think that would be a breaking change though, WDYT?
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.
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.
It won't be a breaking change -- the state information is serialised to JSON and the JSON form will remain the same (json.Marshal
doesn't care about type aliases like type ContainerState string
).
EDIT: But I do understand the concern @thaJeztah -- we did make this mistake before with initProcessTime
and it was pretty bad.
EDIT2: Oh I missed that this was about State
being part of the runtime-spec
-- I think opencontainers/runtime-spec#1056 looks reasonable.
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.
Yeah, (Go) is a bit hairy in that respect; https://play.golang.org/p/LGJ3vs3ncu0
package main
type Foo string
type Foobar struct {
Bla Foo
}
const somethingFoo Foo = "something"
func main() {
// This works
_ = Foobar{Bla: "something"}
// This works
_ = Foobar{Bla: somethingFoo}
// This won't work
something := "something"
_ = Foobar{Bla: something}
}
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.
whoa! mind blown! @thaJeztah
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.
Yeah, I've hit this in the past as well (I think Foobar{Bla: "something"}
working is actually a mistake on the Go language side of things, because it leads to more edge-cases than would be ideal).
However I think it's fine to make a change like that -- the Go files aren't really what is being versioned by SemVer
, it's the specification. While we would ideally not break upgrades, I think doing a major version bump on runtime-spec
because of a type alias would be a little bit of an over-reaction. 😉
a79d039
to
34ac72f
Compare
I'd rather have opencontainers/runtime-spec#1056 merged first and then redo this PR on top of it |
34ac72f
to
9f05f3c
Compare
@@ -1863,7 +1863,7 @@ func (c *linuxContainer) currentOCIState() (*specs.State, error) { | |||
if err != nil { | |||
return nil, err | |||
} | |||
state.Status = status.String() | |||
state.Status = specs.ContainerState(status.String()) |
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.
Notice that status.String()
can return states that are not in the OCI runtime spec ("pausing"
, "paused"
, "unknown"
), and vice versa: the runtime spec defines "creating"
which does not map to a libcontainer state ;
runc/libcontainer/container.go
Lines 31 to 46 in ceefc3f
func (s Status) String() string { | |
switch s { | |
case Created: | |
return "created" | |
case Running: | |
return "running" | |
case Pausing: | |
return "pausing" | |
case Paused: | |
return "paused" | |
case Stopped: | |
return "stopped" | |
default: | |
return "unknown" | |
} | |
} |
How should we deal with those?
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 it's fine for runc to have a superset of statuses as defined by OCI spec. It's also fine to never return some statuses, like "creating".
Updated to get the latest runtime-spec, but left a comment above #2520 (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.
LGTM
Whoops, this needs a rebase @thaJeztah |
ah! no worries; on it! |
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
9f05f3c
to
901dccf
Compare
rebased |
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.
LGTM
@cyphar LGTY? |
No description provided.