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

config-linux: Make Linux 'devices' explicitly optional #526

Merged
merged 2 commits into from Aug 7, 2016

Conversation

Projects
None yet
3 participants
@wking
Contributor

wking commented Aug 3, 2016

Both linux.devices and linux.resources.devices. Details in the commit messages.

wking added some commits Aug 3, 2016

config-linux: Add (array, optional) for linux.devices
To match the omitempty which the Go property has had since 28cc423
(add omitempty to 'Device' and 'Namespace', 2016-03-10, #340).

Signed-off-by: W. Trevor King <wking@tremily.us>
config-linux: Make linux.resources.devices explicitly optional
And mark it omitempty to avoid:

  $ ocitools generate --template <(echo '{"linux": {"resources": {}}}') | jq .linux
  {
    "resources": {
      "devices": null
    }
  }

Signed-off-by: W. Trevor King <wking@tremily.us>

@wking wking referenced this pull request Aug 3, 2016

Merged

support setting oom_score_adj #176

@mrunalp

This comment has been minimized.

Show comment
Hide comment
@mrunalp

mrunalp Aug 3, 2016

Contributor

LGTM

Approved with PullApprove

Contributor

mrunalp commented Aug 3, 2016

LGTM

Approved with PullApprove

@hqhq

This comment has been minimized.

Show comment
Hide comment
@hqhq

hqhq Aug 7, 2016

Contributor

LGTM

Approved with PullApprove

Contributor

hqhq commented Aug 7, 2016

LGTM

Approved with PullApprove

@hqhq hqhq merged commit c9c2574 into opencontainers:master Aug 7, 2016

2 checks passed

code-review/pullapprove Approved by hqhq, mrunalp
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@wking wking deleted the wking:optional-devices branch Aug 18, 2016

wking added a commit to wking/ocitools-v2 that referenced this pull request Nov 8, 2016

generate: Adjust command-line generator to use .Config directly
This saves a few lines of code and removes a layer of indirection.
It's now obvious to the caller exactly what is changing, although
there is sometimes less per-setting validation.  That's ok though;
folks interested in validating the config can call the validator on it
after they've finished mucking about.

This new approach also initializes any needer pointer fields at the
top.  With the current runtime-spec types, that can lead to some
orphaned pointer fields, e.g.;

  $ ./oci-runtime-tool generate --template <(echo '{}')
  {
          "ociVersion": "1.0.0-rc1-dev",
          "platform": {
                  "os": "linux",
                  "arch": "amd64"
          },
          "process": {
                  "user": {
                          "uid": 0,
                          "gid": 0
                  },
                  "args": null,
                  "cwd": "/"
          },
          "root": {
                  "path": "rootfs"
          },
          "hooks": {},
          "linux": {
                  "resources": {
                          "devices": null
                  }
          }
  }

but the devices issue was fixed in runtime-spec 1.0.0-rc2 [1] and
there are other approaches to collapsing unused pointer properties
[2].

[1]: opencontainers/runtime-spec#526
[2]: opencontainers#112

Signed-off-by: W. Trevor King <wking@tremily.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment