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

Merged
merged 2 commits into from Aug 7, 2016

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
@wking wking 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>
60fff3f
@wking wking 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>
054d2df
@wking wking referenced this pull request in opencontainers/runtime-tools Aug 3, 2016
Merged

support setting oom_score_adj #176

@mrunalp
Contributor
mrunalp commented Aug 3, 2016 edited

LGTM

Approved with PullApprove

@hqhq
Contributor
hqhq commented Aug 7, 2016 edited

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 wking added a commit to wking/ocitools-v2 that referenced this pull request Nov 8, 2016
@wking wking 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>
330d00d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment