github.com/dkerwin/nomad@v0.3.3-0.20160525181927-74554135514b/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  ## Examples
    44  
    45  A simple config block to run a `Qemu` image:
    46  
    47  ```
    48  task "virtual" {
    49    driver = "qemu"
    50  
    51    config {
    52      image_path = "local/linux.img"
    53      accelerator = "kvm"
    54    }
    55  
    56    # Specifying an artifact is required with the "qemu"
    57    # driver. This is the # mechanism to ship the image to be run.
    58    artifact {
    59      source = "https://dl.dropboxusercontent.com/u/1234/linux.img"
    60  
    61      options {
    62        checksum = "md5:123445555555555"
    63      }
    64    }
    65  ```
    66  
    67  ## Client Requirements
    68  
    69  The `Qemu` driver requires Qemu to be installed and in your system's `$PATH`.
    70  The task must also specify at least one artifact to download as this is the only
    71  way to retrieve the image being run.
    72  
    73  ## Client Attributes
    74  
    75  The `Qemu` driver will set the following client attributes:
    76  
    77  * `driver.qemu` - Set to `1` if Qemu is found on the host node. Nomad determines
    78  this by executing `qemu-system-x86_64 -version` on the host and parsing the output
    79  * `driver.qemu.version` - Version of `qemu-system-x86_64`, ex: `2.4.0`
    80  
    81  ## Resource Isolation
    82  
    83  Nomad uses Qemu to provide full software virtualization for virtual machine
    84  workloads. Nomad can use Qemu KVM's hardware-assisted virtualization to deliver
    85  better performance.
    86  
    87  Virtualization provides the highest level of isolation for workloads that
    88  require additional security, and resource use is constrained by the Qemu
    89  hypervisor rather than the host kernel. VM network traffic still flows through
    90  the host's interface(s).