Skip to content

Conversation

@hqhq
Copy link
Contributor

@hqhq hqhq commented Jul 5, 2017

Fixes: #407

@hqhq
Copy link
Contributor Author

hqhq commented Jul 5, 2017

ping @Mashimiao @liangchenye @mrunalp

I know we have to update runtime-spec to fully remove platform in runtime-tools, I haven't done this because I'm not sure how much amends we have to do to adapt the latest runtime-spec, I might not have time for this for now, and it's safe we just remove checking platform in runtime-tools.

@hqhq
Copy link
Contributor Author

hqhq commented Jul 5, 2017

CI failed, fixing.

@hqhq hqhq force-pushed the remove_platform branch from 1a09147 to 82520c2 Compare July 5, 2017 06:31
@hqhq
Copy link
Contributor Author

hqhq commented Jul 5, 2017

CI passed, PTAL.

},
cli.StringFlag{
Name: "platform",
Value: "Linux",

Choose a reason for hiding this comment

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

should be linux

}

g.SetPlatformOS(context.String("os"))
g.SetPlatformArch(context.String("arch"))

Choose a reason for hiding this comment

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

I think you also need to remove options os and arch from cli.Flag and manpage

func (v *Validator) CheckPlatform() (msgs []string) {
logrus.Debugf("check platform")

if v.platform != "linux" && v.platform != "solaris" && v.platform != "windows" {

Choose a reason for hiding this comment

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

So, spec just supports linux, solaris and windows, all other platforms are invalid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I think we should check

if v.platform != "linux" && v.platform != "solaris" && v.platform != "windows" {

right after

	platform := context.GlobalString("platform")

Copy link
Contributor Author

@hqhq hqhq Jul 5, 2017

Choose a reason for hiding this comment

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

I'm fine with either, if check platform right after got it from context, it would be like a runtime-tools limitation, while it's actually can be an OCI validation, so check it in Validator methods seems reasonable to me.

Plus I moved CheckPlatform to the top in the second commit, so we don't do much unnecessary check it platform is wrong.

@hqhq hqhq force-pushed the remove_platform branch from 82520c2 to db36f4b Compare July 5, 2017 06:53
@hqhq
Copy link
Contributor Author

hqhq commented Jul 5, 2017

@Mashimiao Fixed, thanks.

hqhq added 2 commits July 5, 2017 14:56
As it's deleted from runtime-spec.

Signed-off-by: Qiang Huang <[email protected]>
@hqhq hqhq force-pushed the remove_platform branch from db36f4b to 6d4aba9 Compare July 5, 2017 07:01
inputPath := context.String("path")
hostSpecific := context.GlobalBool("host-specific")
v, err := validate.NewValidatorFromPath(inputPath, hostSpecific)
platform := context.GlobalString("platform")
Copy link
Member

Choose a reason for hiding this comment

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

Add 'platform' to man page as well.

return err
}

platform := context.String("platform")
Copy link
Member

Choose a reason for hiding this comment

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

We also need to pass this to validation_test.go#getDefaultGenerator and change the Makefile (by adding a PLATFORM for example).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, but I don't think we use it in generator.

Copy link
Member

Choose a reason for hiding this comment

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

I mean we should change:

g.SetProcessArgs([]string{"/runtimetest"})

to

g.SetProcessArgs([]string{"/runtimetest", "platform", platform})

since you add a platform option to runtimetest command.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we don't use it anymore in generator.

Copy link
Contributor Author

@hqhq hqhq Jul 5, 2017

Choose a reason for hiding this comment

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

But platform is not a process arg. It should be a generator arg as it's a validate arg.

I know what you mean, here the process is runtimetest.

@hqhq hqhq force-pushed the remove_platform branch from 6d4aba9 to c8a87d3 Compare July 5, 2017 07:47
Usage: "Path to the configuration",
},
cli.StringFlag{
Name: "platform",

Choose a reason for hiding this comment

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

Should the runtimetest automatically get which platform it is running on? I think it seems there is no need to specify it manunally. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

@hqhq how does runc do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Mashimiao We can, but can we do that in a follow up PR, what we did in this PR looks consistent and we have the default value.

@liangchenye runc doesn't check platform at all, the spec author should be responsible to give runc the right config.

@hqhq hqhq force-pushed the remove_platform branch from c8a87d3 to 1af3b09 Compare July 5, 2017 08:07
@liangchenye
Copy link
Member

liangchenye commented Jul 5, 2017

LGTM

Approved with PullApprove

1 similar comment
@Mashimiao
Copy link

Mashimiao commented Jul 5, 2017

LGTM

Approved with PullApprove

@Mashimiao Mashimiao merged commit fc994d5 into opencontainers:master Jul 5, 2017
@hqhq hqhq deleted the remove_platform branch July 5, 2017 08:32
wking added a commit to wking/ocitools-v2 that referenced this pull request Apr 11, 2018
Don't fill in a bunch of Linux stuff if runtime.GOOS isn't Linux ;).
We don't have sensible defaults for other OSes yet, so error out in
those cases.  This commit restores the --os argument which had
previously been removed in 597c7d4 (Remove platform, 2017-07-05,
opencontainers#409).

The diff here is fairly large, because many callers depend (directly
or indirectly) on the generation code, and now all of those callers
need to be on the lookout for errors.

Generation will currently fail for all GOOS besides linux and solaris.
I doubt the Solaris default is particularly useful either; it has all
the POSIX settings from our Linux default, but I don't know enough
about Solaris to know which Solaris-specific properties should get
defaults.  And while some rlimits are OS-specific, RLIMIT_NOFILE (the
only one we set in our default config) is in POSIX [1], so I've put
the rlimit config in the POSIX block.

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_resource.h.html

Signed-off-by: W. Trevor King <[email protected]>
@wking wking mentioned this pull request Apr 11, 2018
wking added a commit to wking/ocitools-v2 that referenced this pull request Apr 11, 2018
Don't fill in a bunch of Linux stuff if runtime.GOOS isn't Linux ;).
We don't have sensible defaults for other OSes yet, so error out in
those cases.  This commit restores the --os argument which had
previously been removed in 597c7d4 (Remove platform, 2017-07-05,
opencontainers#409).

The diff here is fairly large, because many callers depend (directly
or indirectly) on the generation code, and now all of those callers
need to be on the lookout for errors.

Generation will currently fail for all GOOS besides linux and solaris.
I doubt the Solaris default is particularly useful either; it has all
the POSIX settings from our Linux default, but I don't know enough
about Solaris to know which Solaris-specific properties should get
defaults.  And while some rlimits are OS-specific, RLIMIT_NOFILE (the
only one we set in our default config) is in POSIX [1], so I've put
the rlimit config in the POSIX block.

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_resource.h.html

Signed-off-by: W. Trevor King <[email protected]>
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.

3 participants