Skip to content

Conversation

Freddo3000
Copy link

This PR aims to make it possible for VMs to mount several disks and of different types. So far I've implemented File and RBD, but it should be fairly easy to extend to other libvirt storages. Opening it as a draft here for feedback as I continue working on it.

Example job definition:

job "virt-example" {

  group "virt-group" {
    count = 1

    task "virt-task" {

      identity {
        env  = true
        file = true
      }

      template {
        data        = <<EOH
        Guest System
        EOH
        destination = "local/index.html"
      }

      driver = "nomad-driver-virt"

      artifact {
        source      = "http://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
        destination = "local/focal-server-cloudimg-amd64.img"
        mode        = "file"
      } 

      config {
        default_user_password           = "password"
        cmds                            = ["touch /home/ubuntu/file.txt"]
        default_user_authorized_ssh_key = "ssh-ed25519 AAAAC3NzaC1lZDI..."

        disks {
          file "vda" {
            path = "local/focal-server-cloudimg-amd64.img"
          }
          rbd "vdb" {
            name = "pool/my-rbd"
            auth {
              username = "libvirt"
              uuid = "<uuid>"
            }
            host "ceph01.example.org" {
              port = 6789
            }
            host "ceph02.example.org" {
              port = 6789
            }
          }
        }
      }

      resources {
        cores  = 4
        memory = 4000
      }
    }
  }
}

Copy link

hashicorp-cla-app bot commented Jun 25, 2025

CLA assistant check
All committers have signed the CLA.

@tgross tgross requested a review from chrisroberts September 15, 2025 17:33
@tgross tgross moved this from Needs Triage to Triaging in Nomad - Community Issues Triage Sep 15, 2025
@tgross tgross moved this from Triaging to In Progress in Nomad - Community Issues Triage Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

1 participant