* Set the QEMU builder vnc_port_min to have a minimum value of 5900,
with updated documentation to explain why.
* Changed output messages so that the correct port is listed in packer's
messaging to the user.
LONGER DESCRIPTION
If vnc_min_port is set to anything above 5900, then packer will fail to
connect via VNC to the QEMU instance. This is due to how QEMU parses
the port for listening to VNC:
host:d
TCP connections will only be allowed from host on
display d. By convention the TCP port is 5900+d.
Previously the calculation for the port was vncPort - VNCPortMin,
however this will result in an incorrect port being displayed in
packer's messages and potentially packer being unable to connect via VNC
to the host.
For example if vnc_port_min=5990 nad vnc_port_max=5999:
```
Looking for available port between 5990 and 5999 on 0.0.0.0
Found available port: 5996 on IP: 0.0.0.0
Found available VNC port: 5996 on IP: 0.0.0.0
[....]
==> Starting VM, booting disk image
view the screen of the VM, connect via VNC without a password to
vnc://0.0.0.0:6
```
This will cause QEMU to set the listening port to 5906 while packer's
VNC client is attempting to connect to 5996.
I am a touch concerned as this commit undoes pull request #9905
(specfically commit 7335695c), but I am also confused as to how he was
able to get QEMU to get a VNC listening port below 5900, as examining
QEMU's git history has shown that this behavior has been in since at
least 2017, probably older.
Hopefully the more explicit error messaging and documentation can make
it clear why this is being undone.
This changes fixes two crashes in `step_run` that expects certain
information to be in state from prior steps. This change requires
testing to ensure the bugs have been fixed.
I believe there may be more state values that need to be checked as they
may not be put into state if a build configuration has attributes that
would skip or otherwise not put data into the statebag.
- generating defaults
- overriding defaults with user args
The default generation has been shuffled around some, in order to
make sure that any changes to a specific arg happen in one place
to make it easier to reason about those args. Related args have
been moved close to one another.
The deviceArgs and driveArgs were overly complex after several
layers of copy/paste modifications. Careful pruning reduced the
layers of logic and repeated code, to help make it easier to reason
about.