Skip to content

validation should fail when setting per_alloc on a dynamic host volume #27140

@inahga

Description

@inahga

Nomad version

Output from nomad version

Nomad v1.10.4
BuildDate 2025-08-12T20:48:32Z
Revision 62b195aaa535b2159d215eaf89e6f4a455d6f686

Operating system and Environment details

Ubuntu 24.04 on QEMU/KVM.

Issue

When using dynamic host volumes, you can use the per_alloc setting.

This contradicts the documentation, which states:

Use per_alloc only with CSI volumes and sticky only with dynamic host volumes.

If this is the case, a host volume with per_alloc = true should fail job validation.

Reproduction steps

Create a host volume

name      = "example[0]"
type      = "host"

plugin_id = "mkdir"

capability {
  access_mode     = "single-node-writer"
  attachment_mode = "file-system"
}

Deploy a spec

job "example" {
  type      = "service"
  node_pool = "ifn"

  group "ubuntu" {
    count = 1

    volume "data" {
      type   = "host"
      source = "example"
      per_alloc = true
    }

    task "ubuntu" {
      driver = "podman"

      config {
        image = "docker.io/library/ubuntu:noble"
        command = "/usr/bin/sleep"
        args = ["infinity"]
      }

      volume_mount {
        volume      = "data"
        destination = "${NOMAD_ALLOC_DIR}/data"
      }
    }
  }
}

Expected Result

Actually, this behavior is totally fine! I like it this way, since it solves the problem of allocating multiple host volumes to a replicated service (e.g. mysql, etcd).

I'm just not sure if this was the intended behavior behind per_alloc, if the documentation is wrong, and/or whether using per_alloc in this way has unforeseen consequences and risks.

Can the maintainers tell me whether this is a broken usage of per_alloc. If so, I'd actually like us to fix the problems that prevent it from being used for host volumes (happy to help). If not, we should update the documentation to state using per_alloc is OK.

Actual Result

It deploys fine (hopefully a good thing!)

Job file (if appropriate)

Nomad Server logs (if appropriate)

Nomad Client logs (if appropriate)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Needs Roadmapping

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions