Commit 01232316 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Merge pull request #2267 from bubaflub/fix_qemu_vnc_port_range

builder/qemu: Force qemu to use a VNC port by setting vnc_min_port == vnc_max_port
parents ac510cd8 b77fcd90
......@@ -32,7 +32,12 @@ func (stepConfigureVNC) Run(state multistep.StateBag) multistep.StepAction {
var vncPort uint
portRange := int(config.VNCPortMax - config.VNCPortMin)
for {
vncPort = uint(rand.Intn(portRange)) + config.VNCPortMin
if portRange > 0 {
vncPort = uint(rand.Intn(portRange)) + config.VNCPortMin
} else {
vncPort = config.VNCPortMin
}
log.Printf("Trying port: %d", vncPort)
l, err := net.Listen("tcp", fmt.Sprintf(":%d", vncPort))
if err == nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment