runtime-tools icon indicating copy to clipboard operation
runtime-tools copied to clipboard

Handle errors in specerror

Open zhouhao3 opened this issue 8 years ago • 46 comments

There are some declared errors in specerror that have not been called to validate them. Now they are listed below, and we can discuss what needs to be done and what does not. If there's anything you need to add or remove, you can edit directly.

Bundle

  • [x] ConfigConstName: This REQUIRED file MUST be named config.json.

Config-linux

Namespace

  • [x] NSProcInPath: The runtime MUST place the container process in the namespace associated with that path.
  • [x] NSPathMatchTypeError: The runtime MUST generate an error if path is not associated with a namespace of type type.
  • [x] NSNewNSWithoutPath: If path is not specified, the runtime MUST create a new container namespace of type type.
  • [x] NSInheritWithoutType: If a namespace type is not specified in the namespaces array, the container MUST inherit the runtime namespace of that type.

User namespace mappings

  • ❌ UserNSMapOwnershipRO: The runtime SHOULD NOT modify the ownership of referenced filesystems to realize the mapping.

Devices

  • ❌ DevicesMajMinRequired: major, minor (int64, REQUIRED unless type is p) - major, minor numbers for the device.
  • [x] DevicesErrorOnDup: The same type, major and minor SHOULD NOT be used for multiple devices.

Cgroups

  • ❌ CgroupsPathAbsOrRel: The value of cgroupsPath MUST be either an absolute path or a relative path.
  • [x] CgroupsAbsPathRelToMount: In the case of an absolute path (starting with /), the runtime MUST take the path to be relative to the cgroups mount point.
  • [x] CgroupsPathAttach: If the value is specified, the runtime MUST consistently attach to the same place in the cgroups hierarchy given the same value of cgroupsPath.
  • :x: CgroupsPathError: Runtimes MAY consider certain cgroupsPath values to be invalid, and MUST generate an error if this is the case.

Device whitelist

  • [x] DevicesApplyInOrder: The runtime MUST apply entries in the listed order.

Block IO

  • [x] BlkIOWeightOrLeafWeightExist: You MUST specify at least one of weight or leafWeight in a given entry, and MAY specify both.

IntelRdt

  • :x: IntelRdtPIDWrite: If intelRdt is set, the runtime MUST write the container process ID to the <container-id>/tasks file in a mounted resctrl pseudo-filesystem, using the container ID from start and creating the container-id directory if necessary.
  • :x: IntelRdtNoMountedResctrlError: If no mounted resctrl pseudo-filesystem is available in the runtime mount namespace, the runtime MUST generate an error.
  • :x: NotManipResctrlWithoutIntelRdt: If intelRdt is not set, the runtime MUST NOT manipulate any resctrl pseudo-filesystems.
  • :x: IntelRdtL3CacheSchemaWrite: If l3CacheSchema is set, runtimes MUST write the value to the schemata file in the <container-id> directory discussed in intelRdt.
  • :x: IntelRdtL3CacheSchemaNotWrite: If l3CacheSchema is not set, runtimes MUST NOT write to schemata files in any resctrl pseudo-filesystems.

Config-Windows

HyperV

  • ❌ WindowsHyperVPresent: If present, the container MUST be run with Hyper-V isolation.
  • ❌ WindowsHyperVOmit: If omitted, the container MUST be run as a Windows Server container.

Config

Root

  • [x] RootOnWindowsRequired: On Windows, for Windows Server Containers, this field is REQUIRED.

Mounts

  • ❌ MountsOptionsOnWindowsROSupport: Windows: runtimes MUST support ro, mounting the filesystem read-only when ro is given.

Process

  • ❌ ProcRequiredAtStart: This property is REQUIRED when start is called. (same with StartWithProcUnsetGenError)
  • ❌ ProcConsoleSizeIgnore: Runtimes MUST ignore consoleSize if terminal is false or unset.

POSIX process

  • [x] PosixProcRlimitsTypeGenError: The runtime MUST generate an error for any values which cannot be mapped to a relevant kernel interface.
  • ❌ PosixProcRlimitsTypeGet: For each entry in rlimits, a getrlimit(3) on type MUST succeed.
  • [x] PosixProcRlimitsSoftMatchCur: rlim.rlim_cur MUST match the configured value.
  • [x] PosixProcRlimitsHardMatchMax: rlim.rlim_max MUST match the configured value.

Linux Process

  • [x] LinuxProcCapError: Any value which cannot be mapped to a relevant kernel interface MUST cause an error.
  • ❌ LinuxProcOomScoreAdjNotSet: If oomScoreAdj is not set, the runtime MUST NOT change the value of oom_score_adj.

POSIX-platform Hooks

  • [x] PosixHooksCalledInOrder: Hooks MUST be called in the listed order.
  • [x] PosixHooksStateToStdin: The state of the container MUST be passed to hooks over stdin so that they may do work appropriate to the current state of the container.

Annotations

  • ❌ AnnotationsKeyValueMap: Annotations MUST be a key-value map.
  • ❌ AnnotationsKeyRequired: Keys MUST NOT be an empty string.
  • [x] AnnotationsKeyReversedDomain: Keys SHOULD be named using a reverse domain notation - e.g. com.example.myKey.
  • [x] AnnotationsKeyReservedNS: Keys using the org.opencontainers namespace are reserved and MUST NOT be used by subsequent specifications.
  • [x] AnnotationsKeyIgnoreUnknown: Implementations that are reading/processing this configuration file MUST NOT generate an error if they encounter an unknown annotation key.
  • ❌ AnnotationsValueString: Values MUST be strings.

Extensibility

  • [x] ExtensibilityIgnoreUnknownProp: Runtimes that are reading or processing this configuration file MUST NOT generate an error if they encounter an unknown property.

Valid values

  • [x] ValidValues: Runtimes that are reading or processing this configuration file MUST generate an error when invalid or unsupported values are encountered.

Runtime-Linux

  • [x] DefaultRuntimeLinuxSymlinks: While creating the container (step 2 in the lifecycle), runtimes MUST create default symlinks if the source file exists after processing mounts.

Runtime

  • ❌ EntityOperSameContainer: The entity using a runtime to create a container MUST be able to use the operations defined in this specification against that same container.

State

  • ❌ StateIDUniq: id (string, REQUIRED) is the container's ID. This MUST be unique across all containers on this host.
  • ❌ StateNewStatus: Additional values MAY be defined by the runtime, however, they MUST be used to represent new runtime states not defined above.
  • [x] DefaultStateJSONPattern: When serialized in JSON, the format MUST adhere to the default pattern.

Lifecycle

  • ❌ EnvCreateImplement: The container's runtime environment MUST be created according to the configuration in config.json.
  • ❌ EnvCreateError: If the runtime is unable to create the environment specified in the config.json, it MUST generate an error.
  • [x] ConfigUpdatesWithoutAffect: Any updates to config.json after this step MUST NOT affect the container.
  • [x] PrestartHookFailGenError: If any prestart hook fails, the runtime MUST generate an error, stop the container, and continue the lifecycle at step 9.
  • :x: UndoCreateSteps: The container MUST be destroyed by undoing the steps performed during create phase (step 2).

Errors

  • ❌ ErrorsLeaveStateUnchange: Unless otherwise stated, generating an error MUST leave the state of the environment as if the operation were never attempted - modulo any possible trivial ancillary changes such as logging.

Warnings

  • ❌ WarnsLeaveFlowUnchange: Unless otherwise stated, logging a warning does not change the flow of the operation; it MUST continue as if the warning had not been logged.

Operations

  • ❌ DefaultOperations: Unless otherwise stated, runtimes MUST support the default operations.

Create

  • [x] PropsApplyExceptProcOnCreate: All of the properties configured in config.json except for process MUST be applied.
  • [x] ProcArgsApplyUntilStart: process.args MUST NOT be applied until triggered by the start operation.
  • [x] PropApplyFailGenError: If the runtime cannot apply a property as specified in the configuration, it MUST generate an error.
  • [x] PropApplyFailNotCreate: If the runtime cannot apply a property as specified in the configuration, a new container MUST NOT be created.

Start

  • [x] StartWithoutIDGenError: start operation MUST generate an error if it is not provided the container ID.
  • [x] StartNonCreateHaveNoEffect: Attempting to start a container that is not created MUST have no effect on the container.
  • [x] StartNonCreateGenError: Attempting to start a container that is not created MUST generate an error.
  • [x] StartProcImplement: start operation MUST run the user-specified program as specified by process.
  • [x] StartWithProcUnsetGenError: start operation MUST generate an error if process was not set.

Kill

  • [x] KillWithoutIDGenError: kill operation MUST generate an error if it is not provided the container ID.
  • [x] KillNonCreateRunGenError: Attempting to send a signal to a container that is neither created nor running MUST generate an error.
  • [x] KillSignalImplement: kill operation MUST send the specified signal to the container process.
  • [x] KillNonCreateRunHaveNoEffect: Attempting to send a signal to a container that is neither created nor running MUST have no effect.

Delete

  • [x] DeleteWithoutIDGenError: delete operation MUST generate an error if it is not provided the container ID.
  • [x] DeleteNonStopHaveNoEffect: Attempting to delete a container that is not stopped MUST have no effect on the container.
  • [x] DeleteNonStopGenError: Attempting to delete a container that is not stopped MUST generate an error.
  • [x] DeleteResImplement: Deleting a container MUST delete the resources that were created during the create step.
  • [x] DeleteOnlyCreatedRes: Note that resources associated with the container, but not created by this container, MUST NOT be deleted.

zhouhao3 avatar Feb 07 '18 08:02 zhouhao3

good ! Seems we still need lots of work to do.

liangchenye avatar Feb 07 '18 08:02 liangchenye

I think this is done

ConfigConstName: This REQUIRED file MUST be named config.json.

We have 'specConfig' in validate.go. So these two 'MUST' are actually the same thing.

This REQUIRED file MUST reside in the root of the bundle directory and MUST be named config.json. 

liangchenye avatar Feb 07 '18 09:02 liangchenye

About the 3 State items, StateIDUniq --- Cannot validate it. StateNewStatus --- Cannot validate it. DefaultStateJSONPattern --- https://github.com/opencontainers/runtime-tools/pull/575

liangchenye avatar Feb 08 '18 03:02 liangchenye

About Devices's items DevicesMajMinRequired --- To wait for this pr land can be verified. DevicesErrorOnDup --- #576

zhouhao3 avatar Feb 08 '18 06:02 zhouhao3

#576 is checked in. I'll set 'DevicesErrorOnDup' to 'done'.

liangchenye avatar Feb 08 '18 07:02 liangchenye

Set DefaultStateJSONPattern to done.

zhouhao3 avatar Feb 08 '18 07:02 zhouhao3

We can add ❌ mark things that are unverifiable.

zhouhao3 avatar Feb 08 '18 08:02 zhouhao3

@q384566678 and I remove the '[ ]' to list valid tasks only.

liangchenye avatar Feb 08 '18 08:02 liangchenye

'start' test is done here: https://github.com/opencontainers/runtime-tools/pull/578

liangchenye avatar Feb 08 '18 12:02 liangchenye

Sine #577 merged. Set PosixHooksCalledInOrder to done. Sine #578 merged. Set 'start' to done.

zhouhao3 avatar Feb 12 '18 02:02 zhouhao3

I have ruled out the following errors that need not be verified: UserNSMapOwnershipRO CgroupsPathAbsOrRel ProcRequiredAtStart PosixProcRlimitsTypeGet AnnotationsKeyValueMap AnnotationsKeyRequired AnnotationsValueString

I'll just mark them as ❌ , and if there's any inaccuracy, I can modify it. What other needs to be added or modified can be directly updated here.

zhouhao3 avatar Feb 12 '18 07:02 zhouhao3

StartWithProcUnsetGenError is same with ProcRequiredAtStart, I added a comment to ProcRequiredAtStart.

liangchenye avatar Feb 12 '18 09:02 liangchenye

'kill' test is mostly done here: #580 One missing spec error is mentioned in that PR.

----added on 2.27 580 is merged, set three tasks to done.

liangchenye avatar Feb 12 '18 09:02 liangchenye

Mark 'BlkIOWeightOrLeafWeightExist' to DONE since #570 is merged.

liangchenye avatar Feb 12 '18 09:02 liangchenye

RootOnWindowsRequired is checked in #584

liangchenye avatar Feb 28 '18 05:02 liangchenye

Set RootOnWindowsRequired to DONE sine #584 is merged.

zhouhao3 avatar Feb 28 '18 05:02 zhouhao3

DefaultRuntimeLinuxSymlinks has implemented in runtimetest/main.go . Set it to DONE.

zhouhao3 avatar Mar 02 '18 06:03 zhouhao3

set PosixProcRlimitsSoftMatchCur and PosixProcRlimitsHardMatchMax to 'done' since #587 is merged

liangchenye avatar Mar 05 '18 12:03 liangchenye

LinuxProcCapError and PosixProcRlimitsTypeGenError is checked in #591

zhouhao3 avatar Mar 06 '18 05:03 zhouhao3

Mark LinuxProcCapError and PosixProcRlimitsTypeGenError to 'done'.

liangchenye avatar Mar 06 '18 06:03 liangchenye

set AnnotationsKeyIgnoreUnknown, AnnotationsKeyReversedDomain, AnnotationsKeyReservedNS, ValidValues and ExtensibilityIgnoreUnknownProp to done.

zhouhao3 avatar Mar 12 '18 05:03 zhouhao3

I tried to write a test program for the intelRdt, but I got the following information, so I thought the contents related to the intelRdt were marked as :x:.

intelRdt is specified in config, but Intel RDT feature is not supported or enabled

zhouhao3 avatar Mar 12 '18 08:03 zhouhao3

@q384566678 I read the git history of 'how intelRdt being added to the runtime spec', it seems a quite new feature to the linux kernel. So I think most running servers nowadays will not support this, which means it is hard for us to verify it. I suggest we need help from the original committer @xiaochenshen. What do you think about this? @xiaochenshen

PS, We also need Windows/Solaris developers' help.

liangchenye avatar Mar 12 '18 10:03 liangchenye

@q384566678 I read the git history of 'how intelRdt being added to the runtime spec', it seems a quite new feature to the linux kernel. So I think most running servers nowadays will not support this, which means it is hard for us to verify it. I suggest we need help from the original committer @xiaochenshen. What do you think about this? @xiaochenshen

Current Intel RDT implementation in OCI/runc could handle these two cases: (1) hardware support Intel RDT, (2) hardware doesn't support Intel RDT.

For case (1), in my opinion, it is not difficult to find a hardware platform to verify.

Intel RDT features are supported from recent generations of Intel Xeon servers. You could find the matrix of Intel RDT features and supported hardware: https://github.com/intel/intel-cmt-cat/blob/master/README#L108

xiaochenshen avatar Mar 13 '18 04:03 xiaochenshen

ProcArgsApplyUntilStart is checked in #602

zhouhao3 avatar Mar 14 '18 03:03 zhouhao3

mark ProcArgsApplyUntilStar done

liangchenye avatar Mar 14 '18 06:03 liangchenye

ConfigUpdatesWithoutAffect is checked in #604

zhouhao3 avatar Mar 14 '18 08:03 zhouhao3

DevicesMajMinRequired cannot be verified. The default '0' value is also valid. Mark it ❌.

liangchenye avatar Mar 16 '18 02:03 liangchenye

working on KillNonCreateRunHaveNoEffect in #607

liangchenye avatar Mar 16 '18 04:03 liangchenye

Set PosixHooksStateToStdin to DONE.

zhouhao3 avatar Mar 19 '18 02:03 zhouhao3