|
|
|
|
@ -63,7 +63,6 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
@ -74,10 +73,16 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
|
|
|
|
|
defaultArgs := make(map[string]interface{})
|
|
|
|
|
var deviceArgs []string
|
|
|
|
|
var driveArgs []string
|
|
|
|
|
var sshHostPort uint
|
|
|
|
|
|
|
|
|
|
defaultArgs["-name"] = vmName
|
|
|
|
|
defaultArgs["-machine"] = fmt.Sprintf("type=%s", config.MachineType)
|
|
|
|
|
defaultArgs["-netdev"] = fmt.Sprintf("user,id=user.0,hostfwd=tcp::%v-:%d", sshHostPort, config.Comm.Port())
|
|
|
|
|
if config.Comm.Type != "none" {
|
|
|
|
|
sshHostPort = state.Get("sshHostPort").(uint)
|
|
|
|
|
defaultArgs["-netdev"] = fmt.Sprintf("user,id=user.0,hostfwd=tcp::%v-:%d", sshHostPort, config.Comm.Port())
|
|
|
|
|
} else {
|
|
|
|
|
defaultArgs["-netdev"] = fmt.Sprintf("user,id=user.0")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qemuVersion, err := driver.Version()
|
|
|
|
|
if err != nil {
|
|
|
|
|
@ -157,13 +162,23 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
|
|
|
|
|
|
|
|
|
|
httpPort := state.Get("http_port").(uint)
|
|
|
|
|
ctx := config.ctx
|
|
|
|
|
ctx.Data = qemuArgsTemplateData{
|
|
|
|
|
"10.0.2.2",
|
|
|
|
|
httpPort,
|
|
|
|
|
config.HTTPDir,
|
|
|
|
|
config.OutputDir,
|
|
|
|
|
config.VMName,
|
|
|
|
|
sshHostPort,
|
|
|
|
|
if config.Comm.Type != "none" {
|
|
|
|
|
ctx.Data = qemuArgsTemplateData{
|
|
|
|
|
"10.0.2.2",
|
|
|
|
|
httpPort,
|
|
|
|
|
config.HTTPDir,
|
|
|
|
|
config.OutputDir,
|
|
|
|
|
config.VMName,
|
|
|
|
|
sshHostPort,
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ctx.Data = qemuArgsTemplateData{
|
|
|
|
|
HTTPIP: "10.0.2.2",
|
|
|
|
|
HTTPPort: httpPort,
|
|
|
|
|
HTTPDir: config.HTTPDir,
|
|
|
|
|
OutputDir: config.OutputDir,
|
|
|
|
|
Name: config.VMName,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
newQemuArgs, err := processArgs(config.QemuArgs, &ctx)
|
|
|
|
|
if err != nil {
|
|
|
|
|
|