Qemu basics instructions

Hello,

As Basic QEMU plugin questions , I have basics questions.

I’m starting to use Qemu driver. I only use qemu with LXD before.

This is my testing job:

job "ubuntu" {
  region      = "global"
  datacenters = ["dc1"]
  type        = "service"

  group "ubuntu" {
    count = 1

    restart {
      attempts = 10
      interval = "5m"
      delay = "30s"
      mode = "delay"
    }

    network {
      port "http" {
        to = 80
      }

      port "ssh" {
        to = 22
      }
    }

    task "ubuntu" {
      driver = "qemu"

      artifact {
        source      = "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64-disk-kvm.img"
        destination = "local/focal-server-cloudimg-amd64-disk-kvm.img"
        options {
          checksum = "md5:89f1bb2f76c3b0c7328ca7098f13d1dc"
        }
      }

      config {
        image_path        = "local/focal-server-cloudimg-amd64-disk-kvm.img"
        accelerator       = "kvm"
        graceful_shutdown = true    
        args              = ["-nodefaults"]
      }
    }
  }
}

But I have this error:

qemu-system-x86_64: -drive file=local/focal-server-cloudimg-amd64-disk-kvm.img: A regular file was expected by the 'file' driver, but something else was given

I found somes informations as it needs to have img with specific size.

I don’t understand with nomad how to specify size and simply how to have simple ubuntu image working.

Thanks and sorry for newbie’s questions.

Somes advices please :cry:

job “ubuntu” {
region = “global”
datacenters = [“dc1”]
type = “service”

group "ubuntu" {
  count = 1

  restart {
    attempts = 10
    interval = "5m"
    delay = "30s"
    mode = "delay"
  }

  network {
    port "ssh" { }
  }

  task "ubuntu" {
    driver = "qemu"

    artifact {
      source      = "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64-disk-kvm.img"
      destination = "local/focal-server-cloudimg-amd64-disk-kvm.img"

    }

    config {
      image_path        = "local/focal-server-cloudimg-amd64-disk-kvm.img"
      graceful_shutdown = true    
      args              = ["-nodefaults"]
      port_map = {
        ssh = 22
      }
    }
  }
}

}