Skip to content
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

Merged
merged 1 commit into from
Aug 4, 2020

Conversation

thaJeztah
Copy link
Member

No description provided.

@@ -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
Copy link
Contributor

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?

Copy link
Member Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know :( but these typecasts everywhere just look wrong

@tianon @cyphar PTAL ^^^

Copy link
Member

@cyphar cyphar Jul 21, 2020

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.

Copy link
Member Author

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}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoa! mind blown! @thaJeztah

Copy link
Member

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. 😉

AkihiroSuda
AkihiroSuda previously approved these changes Jul 20, 2020
AkihiroSuda
AkihiroSuda previously approved these changes Jul 24, 2020
@kolyshkin
Copy link
Contributor

I'd rather have opencontainers/runtime-spec#1056 merged first and then redo this PR on top of it

@thaJeztah thaJeztah force-pushed the bump_runtime_spec branch from 34ac72f to 9f05f3c Compare July 28, 2020 18:09
@thaJeztah thaJeztah changed the title vendor: update runtime-spec v1.0.3-0.20200710190001-3e4195d92445 vendor: update runtime-spec v1.0.3-0.20200728170252-4d89ac9fbff6 Jul 28, 2020
@@ -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())
Copy link
Member Author

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 ;

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?

Copy link
Contributor

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".

@thaJeztah
Copy link
Member Author

Updated to get the latest runtime-spec, but left a comment above #2520 (comment)

kolyshkin
kolyshkin previously approved these changes Jul 30, 2020
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kolyshkin
Copy link
Contributor

Whoops, this needs a rebase @thaJeztah

@thaJeztah
Copy link
Member Author

ah! no worries; on it!

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
Copy link
Member Author

rebased

Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AkihiroSuda
Copy link
Member

@cyphar LGTY?

@AkihiroSuda AkihiroSuda merged commit 234d15e into opencontainers:master Aug 4, 2020
@thaJeztah thaJeztah deleted the bump_runtime_spec branch August 4, 2020 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants