github.com/mattyr/nomad@v0.3.3-0.20160919021406-3485a065154a/website/source/docs/drivers/qemu.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Drivers: Qemu"
     4  sidebar_current: "docs-drivers-qemu"
     5  description: |-
     6    The Qemu task driver is used to run virtual machines using Qemu/KVM.
     7  ---
     8  
     9  # Qemu Driver
    10  
    11  Name: `qemu`
    12  
    13  The `Qemu` driver provides a generic virtual machine runner. Qemu can utilize
    14  the KVM kernel module to utilize hardware virtualization features and provide
    15  great performance. Currently the `Qemu` driver can map a set of ports from the
    16  host machine to the guest virtual machine, and provides configuration for
    17  resource allocation.
    18  
    19  The `Qemu` driver can execute any regular `qemu` image (e.g. `qcow`, `img`,
    20  `iso`), and is currently invoked with `qemu-system-x86_64`.
    21  
    22  The driver requires the image to be accessible from the Nomad client via the
    23  [`artifact` downloader](/docs/jobspec/index.html#artifact_doc). 
    24  
    25  ## Task Configuration
    26  
    27  The `Qemu` driver supports the following configuration in the job spec:
    28  
    29  * `image_path` - The path to the downloaded image. In most cases this will just be
    30    the name of the image. However, if the supplied artifact is an archive that
    31    contains the image in a subfolder, the path will need to be the relative path
    32    (`subdir/from_archive/my.img`).
    33  
    34  * `accelerator` - (Optional) The type of accelerator to use in the invocation.
    35    If the host machine has `Qemu` installed with KVM support, users can specify
    36    `kvm` for the `accelerator`. Default is `tcg`.
    37  
    38  * `port_map` - (Optional) A `map[string]int` that maps port labels to ports
    39    on the guest. This forwards the host port to the guest VM. For example,
    40    `port_map { db = 6539 }` would forward the host port with label `db` to the
    41    guest VM's port 6539.
    42  
    43  * `args` - (Optional) A `[]string` that is passed to qemu as command line options.
    44    For example, `args = [ "-nodefconfig", "-nodefaults" ]`.
    45  
    46  ## Examples
    47  
    48  A simple config block to run a `Qemu` image:
    49  
    50  ```
    51  task "virtual" {
    52    driver = "qemu"
    53  
    54    config {
    55      image_path = "local/linux.img"
    56      accelerator = "kvm"
    57      args = [ "-nodefaults", "-nodefconfig" ]
    58    }
    59  
    60    # Specifying an artifact is required with the "qemu"
    61    # driver. This is the # mechanism to ship the image to be run.
    62    artifact {
    63      source = "https://dl.dropboxusercontent.com/u/1234/linux.img"
    64  
    65      options {
    66        checksum = "md5:123445555555555"
    67      }
    68    }
    69  ```
    70  
    71  ## Client Requirements
    72  
    73  The `Qemu` driver requires Qemu to be installed and in your system's `$PATH`.
    74  The task must also specify at least one artifact to download, as this is the only
    75  way to retrieve the image being run.
    76  
    77  ## Client Attributes
    78  
    79  The `Qemu` driver will set the following client attributes:
    80  
    81  * `driver.qemu` - Set to `1` if Qemu is found on the host node. Nomad determines
    82  this by executing `qemu-system-x86_64 -version` on the host and parsing the output
    83  * `driver.qemu.version` - Version of `qemu-system-x86_64`, ex: `2.4.0`
    84  
    85  ## Resource Isolation
    86  
    87  Nomad uses Qemu to provide full software virtualization for virtual machine
    88  workloads. Nomad can use Qemu KVM's hardware-assisted virtualization to deliver
    89  better performance.
    90  
    91  Virtualization provides the highest level of isolation for workloads that
    92  require additional security, and resource use is constrained by the Qemu
    93  hypervisor rather than the host kernel. VM network traffic still flows through
    94  the host's interface(s).