qemu driver: `image_path` should not be required
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
### Nomad version
`Nomad v1.0.3 (08741d9f2003ec26e44c72a2c0e27cdf0eadb6ee)`
### Operating system and Environment details
```
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
$ apt-cache policy qemu-kvm
qemu-kvm:
Installed: 1:4.2-3ubuntu6.12
```
### Issue
I utilize iscsi for all volumes on my vms. The `image_path` input field appears to construct a `-drive file=$` argument to pass to qemu, but does so in a strange and non-obvious manner.
I don't see the point of this. I cannot set the `image_path` value to the value I would use if I were building the `-drive` arg directly (i.e. `-drive file=iscsi://{...}` -> `image_path = "iscsi://{...}"` does not work). Instead have to do something like `image_path = "-drive file=iscsi://{...}"`. When done like this, the way of providing the drive file format is either omitted entirely or stripped:
1. Prefixed: `image_path = "-drive format=raw,file=iscsi://{...}"` somehow strips the `format=raw` portion (or something, I don't know what, haven't looked at the code) and qemu gives me this error: `Image format was not specified for {iscsi lun description}`
2. Suffixed: `image_path = "-drive file=iscsi://{...},format=raw"` does...weird stuff, and I get the following error message: `qemu-system-x86_64: -name 7,format=raw": Invalid parameter 'format'` (7 is the LUN ID of this particular volume).
And when I try to omit it entirely:
```
2 errors occurred: * failed to parse config: * Missing required argument: The argument "image_path" is required, but no definition was found.
```
### Reproduction steps
try to deploy a vm with a non-local-file drive
### Job file (if appropriate)
...
### Nomad Client logs (if appropriate)
...
Ultimately some clarification on why `image_path` is required at all, or where it even really makes sense in a typical workflow, would be appreciated.
If a PR for this driver to stop requiring `image_path` would be accepted, I can work on one.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the Nomad QEMU driver entry point and trace how image_path is validated and converted into QEMU drive arguments. Reproduce the reported iSCSI configuration and inspect the resulting arguments and validation error. Done means image_path is optional and a non-local iSCSI drive can be configured with its format preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100