packer-plugin-xenserver/builder/xenserver/common/step_boot_wait.go
Cheng Sun 152bdee7f2 Initial work on splitting ISO and XVA builders
Compiles -- but xva create_instance is incomplete

Several changes were rolled into this commit, including:

- "export_format" is now "format", and "keep_instance" is "keep_vm"
- gox is used for building (with the intention of allowing
  cross-compilation in the future)
2014-12-31 16:09:23 +00:00

32 lines
847 B
Go

package common
import (
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
type StepBootWait struct{}
func (self *StepBootWait) Run(state multistep.StateBag) multistep.StepAction {
client := state.Get("client").(XenAPIClient)
config := state.Get("commonconfig").(CommonConfig)
ui := state.Get("ui").(packer.Ui)
instance, _ := client.GetVMByUuid(state.Get("instance_uuid").(string))
ui.Say("Unpausing VM " + state.Get("instance_uuid").(string))
instance.Unpause()
if int64(config.BootWait) > 0 {
ui.Say(fmt.Sprintf("Waiting %s for boot...", config.BootWait))
err := InterruptibleWait{Timeout: config.BootWait}.Wait(state)
if err != nil {
ui.Error(err.Error())
return multistep.ActionHalt
}
}
return multistep.ActionContinue
}
func (self *StepBootWait) Cleanup(state multistep.StateBag) {}