@ -61,12 +61,13 @@ func (s *stepRun) Cleanup(state multistep.StateBag) {
func getCommandArgs ( bootDrive string , state multistep . StateBag ) ( [ ] string , error ) {
config := state . Get ( "config" ) . ( * Config )
isoPath := state . Get ( "iso_path" ) . ( string )
vncIP := state . Get ( "vnc_ip" ) . ( string )
vncPort := state . Get ( "vnc_port" ) . ( uint )
sshHostPort := state . Get ( "sshHostPort" ) . ( uint )
ui := state . Get ( "ui" ) . ( packer . Ui )
driver := state . Get ( "driver" ) . ( Driver )
vnc := fmt . Sprintf ( " 0.0.0.0:%d" , vncPort - 5900 )
vnc := fmt . Sprintf ( " %s:%d", vncIP , vncPort - 5900 )
vmName := config . VMName
imgPath := filepath . Join ( config . OutputDir , vmName )
@ -100,9 +101,22 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
deviceArgs = append ( deviceArgs , fmt . Sprintf ( "%s,netdev=user.0" , config . NetDevice ) )
if config . Headless == true {
ui . Message ( "WARNING: The VM will be started in headless mode, as configured.\n" +
"In headless mode, errors during the boot sequence or OS setup\n" +
"won't be easily visible. Use at your own discretion." )
vncIpRaw , vncIpOk := state . GetOk ( "vnc_ip" )
vncPortRaw , vncPortOk := state . GetOk ( "vnc_port" )
if vncIpOk && vncPortOk {
vncIp := vncIpRaw . ( string )
vncPort := vncPortRaw . ( uint )
ui . Message ( fmt . Sprintf (
"The VM will be run headless, without a GUI. If you want to\n" +
"view the screen of the VM, connect via VNC without a password to\n" +
"%s:%d" , vncIp , vncPort ) )
} else {
ui . Message ( "The VM will be run headless, without a GUI, as configured.\n" +
"If the run isn't succeeding as you expect, please enable the GUI\n" +
"to inspect the progress of the build." )
}
} else {
if qemuMajor >= 2 {
defaultArgs [ "-display" ] = "sdl"