hashicorp / hashicorp/nomad

Attempting to declare a host volume that is read-only with write permissions could use a better scheduler error

Open
#7,137 0 comments 0 reactions 0 assignees View on GitHub
theme/bad-ux theme/plan theme/scheduling type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Nomad version
v0.10.3

### Operating system and Environment details
Nomad vagrant box

### Issue

When attempting to declare a host volume for a task group as `read_only = false` when the volume is declared as `read_only = true` in the client configuration, the scheduler error could be more helpful.

The current output is:

```
+/- Job: "example"
+/- Task Group: "cache" (1 create/destroy update)
+/- Task: "redis" (forces in-place update)

Scheduler dry-run:
- WARNING: Failed to place all allocations.
Task Group "cache" (failed to place 1 allocation):
* Constraint "computed class ineligible" filtered 1 nodes
```

Something like
```
* Volume "readme" with source "nmd-r" and constraint "read_only = false" filtered 1 node
```

Or even something less specific but still volumes related
```
* Volume "readme" filtered 1 node
```

### Reproduction steps

**client.hcl**
```hcl
# ...snipped...
client {
enabled = true

host_volume "nmd-rw" {
path = "/home/vagrant/host-volumes/nmd/read-write"
read_only = false
}

host_volume "nmd-r" {
path = "/home/vagrant/host-volumes/nmd/read"
read_only = true
}
}
```

**example.nomad**
```hcl
job "example" {
datacenters = ["dc1"]

group "cache" {

volume "my-volume" {
type = "host"
read_only = false
source = "nmd-rw"
}

# This volumes causes the error, since no client has an nmd-r volume that
# allows writes.
volume "readme" {
type = "host"
read_only = false
source = "nmd-r"
}

task "redis" {
driver = "docker"

config {
image = "redis:3.2"

port_map {
db = 6379
}
}

volume_mount {
volume = "my-volume"
destination = "/foobar"
read_only = false
}

volume_mount {
volume = "readme"
destination = "/wat"
read_only = false
}

resources {
cpu = 500
memory = 256

network {
mbits = 10
port "db" {}
}
}
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the scheduler dry-run with client.hcl and example.nomad, then trace the host-volume placement path that reports "computed class ineligible." The work is complete when a read/write mismatch identifies the volume and source, with coverage confirming the improved scheduler error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.