From 05962667761269d31b0a6a89e3e87061ac8fc8eb Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 7 Jun 2013 14:50:07 -0700 Subject: [PATCH] builder/vmware: Add better logging --- builder/vmware/step_configure_vnc.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builder/vmware/step_configure_vnc.go b/builder/vmware/step_configure_vnc.go index e91a9f12e..1590a598e 100644 --- a/builder/vmware/step_configure_vnc.go +++ b/builder/vmware/step_configure_vnc.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" + "log" "io/ioutil" "math/rand" "net" @@ -41,10 +42,12 @@ func (stepConfigureVNC) Run(state map[string]interface{}) multistep.StepAction { // Find an open VNC port. Note that this can still fail later on // because we have to release the port at some point. But this does its // best. + log.Printf("Looking for available port between %d and %d", config.VNCPortMin, config.VNCPortMax) var vncPort uint portRange := int(config.VNCPortMax - config.VNCPortMin) for { vncPort = uint(rand.Intn(portRange) + portRange) + log.Printf("Trying port: %d", vncPort) l, err := net.Listen("tcp", fmt.Sprintf(":%d", vncPort)) if err == nil { defer l.Close() @@ -52,6 +55,8 @@ func (stepConfigureVNC) Run(state map[string]interface{}) multistep.StepAction { } } + log.Printf("Found available VNC port: %d", vncPort) + vmxData := ParseVMX(string(vmxBytes)) vmxData["RemoteDisplay.vnc.enabled"] = "TRUE" vmxData["RemoteDisplay.vnc.port"] = fmt.Sprintf("%d", vncPort)