Skip to content

Commit

Permalink
Updates from latest review comments:
Browse files Browse the repository at this point in the history
- Moved VM-specific configuration into a "vm" object.
- Rename "KernelConfig" to simply "Kernel".
- Remove requirement that paths be absolute (it's permissable but not
  mandatory).
- Added example of fully populated "vm" object to config.md.

Signed-off-by: James Hunt <james.o.hunt@intel.com>
  • Loading branch information
jodh-intel committed May 19, 2016
1 parent cc226d7 commit 4c8a03c
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 45 deletions.
37 changes: 25 additions & 12 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,27 +265,40 @@ Annotations are key-value maps.
}
```

## ImagePath
## VM

ImagePath is an optional absolute path to the root filesystem image used by virtual machine-based runtimes.
VM is an optional object used by virtual machine-based runtimes.

This value refers to a path on the host (outside of the virtual machine).
* **`imagePath`** (string, required) path to file that represents the root filesystem for the virtual machine.
* **`kernel`** (object, required) specifies details of the kernel to boot the virtual machine with.

Note that this field is distinct from the **path** field in the (#Root-Configuration) section since in the context of a virtual machine-based runtime:
Note that `imagePath` refers to a path on the host (outside of the virtual machine). This field is distinct from the **`path`** field in the (#Root-Configuration) section since in the context of a virtual machine-based runtime:

* **ImagePath** will represent the root filesystem for the virtual machine.
* The container root filesystem specified by **path** will be mounted inside the virtual machine at a location chosen by the virtual machine-based runtime.
* **`ImagePath`** will represent the root filesystem for the virtual machine.
* The container root filesystem specified by **`path`** will be mounted inside the virtual machine at a location chosen by the virtual machine-based runtime.

The virtual machine-based runtime will use these two fields to arrange for **path** to be presented to the process to run as the root filesystem.
The virtual machine-based runtime will use these two path fields to arrange for **`path`** to be presented to the process to run as the root filesystem.

## Kernel-configuration
An example of a fully-populated `VM` object:

Used by VM-based runtimes only.
```json
"vm": {
"imagePath": "path/to/rootfs.img",
"kernel": {
"path": "path/to/vmlinuz",
"parameters": "foo=bar hello world",
"initrd": "path/to/initrd.img"
},
}
```

## Kernel

Used by virtual machine-based runtimes only.

* **`path`** (string, required) specifies an absolute path to the kernel
used to boot the virtual machine.
* **`path`** (string, required) specifies the path to the kernel used to boot the virtual machine.
* **`parameters`** (string, optional) specifies a space-separated list of parameters to pass to the kernel.
* **`initrd`** (string, optional) specifies an absolute path to an initial ramdisk to be used by the kernel.
* **`initrd`** (string, optional) specifies the path to an initial ramdisk to be used by the virtual machine.

## Configuration Schema Example

Expand Down
55 changes: 33 additions & 22 deletions schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,33 +165,44 @@
}
}
},
"imagePath": {
"description": "absolute path to rootfs image on host system which is used for VM-based runtimes",
"id": "https://opencontainers.org/schema/bundle/imagePath",
"type": "string"
},
"kernelConfig": {
"description": "kernel config used by VM-based runtimes",
"id": "https://opencontainers.org/schema/bundle/kernelConfig",
"vm": {
"description": "configuration for virtual machine-based runtimes",
"id": "https://opencontainers.org/schema/bundle/vm",
"type": "object",
"required": [
"path"
"required" : [
"imagePath",
"kernel"
],
"properties": {
"path": {
"id": "https://opencontainers.org/schema/bundle/kernelConfig/path",
"description": "absolute path to kernel image",
"imagePath": {
"description": "path to rootfs image on host system which is used for VM-based runtimes",
"id": "https://opencontainers.org/schema/bundle/vm/imagePath",
"type": "string"
},
"parameters": {
"description": "space-separated list of kernel parameters",
"id": "https://opencontainers.org/schema/bundle/kernelConfig/parameters",
"type": "string"
},
"initrd": {
"description": "absolute path to initial ramdisk image",
"id": "https://opencontainers.org/schema/bundle/kernelConfig/initrd",
"type": "string"
"kernel": {
"description": "kernel config used by VM-based runtimes",
"id": "https://opencontainers.org/schema/bundle/vm/kernel",
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"id": "https://opencontainers.org/schema/bundle/vm/kernel/path",
"description": "path to kernel image",
"type": "string"
},
"parameters": {
"description": "space-separated list of kernel parameters",
"id": "https://opencontainers.org/schema/bundle/vm/kernel/parameters",
"type": "string"
},
"initrd": {
"description": "path to initial ramdisk image",
"id": "https://opencontainers.org/schema/bundle/vm/kernel/initrd",
"type": "string"
}
}
}
}
},
Expand Down
28 changes: 17 additions & 11 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,28 @@ type Spec struct {
Hooks Hooks `json:"hooks"`
// Annotations is an unstructured key value map that may be set by external tools to store and retrieve arbitrary metadata.
Annotations map[string]string `json:"annotations,omitempty"`
// KernelConfig specifies kernel-related configuration for virtual-machine-based runtimes.
KernelConfig KernelConfig `json:"kernelConfig"`
// ImagePath is the absolute path to the root filesystem image on the host which can be used by a virtual machine-based runtime.
ImagePath string `json:"imagePath"`
// VM specifies configuration for virtual machine-based runtimes.
VM VM `json:"vm,omitempty"`
// Linux is platform specific configuration for Linux based containers.
Linux Linux `json:"linux" platform:"linux"`
}

// KernelConfig contains information about the kernel to use for a virtual machine.
type KernelConfig struct {
// Path is the absolute path to the kernel used to boot the virtual machine.
// VM contains information for virtual machine-based runtimes.
type VM struct {
// Kernel specifies kernel-related configuration for virtual machine-based runtimes.
Kernel Kernel `json:"kernel"`
// ImagePath is the path to the root filesystem image on the host which can be used by a virtual machine-based runtime.
ImagePath string `json:"imagePath"`
}

// Kernel contains information about the kernel to use for a virtual machine.
type Kernel struct {
// Path is the path to the kernel used to boot the virtual machine.
Path string `json:"path"`
// Parameters specifies kernel parameters to pass to the virtual machine.
Parameters string `json:"parameters"`
// InitRd is the absolute path to an initial ramdisk to be used by the kernel.
InitRd string `json:"initrd"`
// Parameters specifies parameters to pass to the kernel.
Parameters string `json:"parameters,omitempty"`
// InitRd is the path to an initial ramdisk to be used by the kernel.
InitRd string `json:"initrd,omitempty"`
}

// Process contains information to start a specific application inside the container.
Expand Down

0 comments on commit 4c8a03c

Please sign in to comment.