qemu vnc: hardcoded lowerbound leaves negative ports

```hcl2
  vnc_port_min = 5000
  vnc_port_max = 5500
```

Build returns faulty:
```
    qemu.one: view the screen of the VM, connect via VNC to vnc://127.0.0.1:5138
(...)
2020/09/06 19:09:52 packer-builder-qemu plugin: Qemu stderr: qemu-system-x86_64: -vnc 127.0.0.1:-762,password: can't convert to a number: -762
```
This commit is contained in:
Ronald van Zantvoort 2020-09-06 21:18:12 +02:00 committed by GitHub
parent dfe8aa51b0
commit 7335695c84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -76,9 +76,9 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
var vnc string
if !config.VNCUsePassword {
vnc = fmt.Sprintf("%s:%d", vncIP, vncPort-5900)
vnc = fmt.Sprintf("%s:%d", vncIP, vncPort-config.VNCPortMin)
} else {
vnc = fmt.Sprintf("%s:%d,password", vncIP, vncPort-5900)
vnc = fmt.Sprintf("%s:%d,password", vncIP, vncPort-config.VNCPortMin)
}
if config.QMPEnable {