Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions content/nomad/v1.11.x/content/docs/deploy/task-driver/qemu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,37 @@ way to retrieve the image being run.
The `qemu` driver will set the following client attributes:

- `driver.qemu` - Set to `1` if QEMU is found on the host node. Nomad determines
this by executing `qemu-system-x86_64 -version` on the host and parsing the output
- `driver.qemu.version` - Version of `qemu-system-x86_64`, ex: `2.4.0`
this by executing the first found QEMU binary with `--version` on the client
and parsing the output. Nomad does not get the version of each individual QEMU
emulator.
- `driver.qemu.version` - Version found running the command for `driver.qemu`;
for example: `2.4.0`
- `driver.qemu.emulators` - A comma separated list of emulators detected on the client.

Here is an example of using these properties in a job file:

```hcl
job "docs" {
# Only run this job where the qemu version is higher than 1.2.3.
constraint {
attribute = "${driver.qemu.version}"
attribute = "${attr.driver.qemu.version}"
operator = ">"
value = "1.2.3"
}
}
```

```hcl
job "docs" {
# Only run this job where the the qemu-system-aarch64 emulator was detected.
constraint {
attribute = "${attr.driver.qemu.emulators}"
operator = "set_contains"
value = "aarch64"
}
}
```

## Plugin Options

```hcl
Expand All @@ -78,6 +93,10 @@ plugin "qemu" {
including flags that provide the VM with access to host devices such
as USB drives. Refer to the [QEMU documentation] for the available
flags.
- `emulators_allowlist` (`[]string`: `[]`) - Specifies the allowed emulators
tasks may use. When specified, Nomad only fingerprints this list and does not
allow tasks to run using other emulators. Defaults to fingerprinting and
allowing all emulators.

## Resource Isolation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ great performance. Currently the `qemu` driver can map a set of ports from the
host machine to the guest virtual machine, and provides configuration for
resource allocation.

The `qemu` driver can execute any regular `qemu` image (e.g. `qcow`, `img`,
`iso`), and is currently invoked with `qemu-system-x86_64`.
The `qemu` driver can execute any regular `qemu` image, such as `qcow`, `img`,
and `iso`. Nomad uses the QEMU binary specified by the `emulator` parameter. For
example, if you specify `x86_64d, Nomad uses `qemu-system-x86_64`.

The driver requires the image to be accessible from the Nomad client via the
[`artifact` downloader](/nomad/docs/job-specification/artifact).
Expand All @@ -31,6 +32,8 @@ task "webservice" {

config {
image_path = "/path/to/my/linux.img"
emulator = "x86_64"
machine_type = "q35"
accelerator = "kvm"
graceful_shutdown = true
args = ["-nodefaults", "-nodefconfig"]
Expand All @@ -40,10 +43,15 @@ task "webservice" {

The `qemu` driver supports the following configuration in the job spec:

- `image_path` - The path to the downloaded image. In most cases this will just
be the name of the image. However, if the supplied artifact is an archive that
contains the image in a subfolder, the path will need to be the relative path
(`subdir/from_archive/my.img`).
- `image_path` - The path to the downloaded image. In most cases this is the
name of the image. However, if the supplied artifact is an archive that
contains the image in a subfolder, the path needs to be the relative path
(`subdir/from_archive/my.img`). Nomad gives this image an ID of "image0".

- `emulator` `(string: "x86_64")` - The architecture of the QEMU emulator used to
run the virtual machine.

- `machine_type` `(string: "pc")` - Used to select the emulated machine by name.

- `drive_interface` - (Optional) This option defines on which type of interface
the drive is connected. Available types are: `ide`, `scsi`, `sd`, `mtd`,
Expand Down
17 changes: 17 additions & 0 deletions content/nomad/v1.11.x/content/docs/upgrade/upgrade-specific.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ used to document those details separately from the standard upgrade flow.

## Nomad 1.11.1

#### Task config emulators

We added `emulator` and `machine_type` to the task config.
These default to the previously used values of `qemu-system-x86_64`, and `pc`.
We also added the `emulators_allowlist` driver config, which defaults to
allowing any emulator to run.

#### `kvm` accelerator

Previously, using the `kvm` accelerator required a machine type of `host`. This
is no longer enforced. Nomad now uses the value for `machine_type`. Also, if
using `resources.cores` with the `kvm` accelerator, Nomad set the `-smp` value
to the `resources.cores` value. Nomad now only does this when you do not specify
a custom `-smp` flag.g.

#### QEMU driver

The QEMU driver now uses host file paths for filesystem environment variables
instead of relative container paths such as `/alloc` and `/local`. You may need
to update job specs utilizing these variables to reflect the new values.
Expand Down
Loading