2014-11-10 12:16:02 -06:00
|
|
|
package xenserver
|
|
|
|
|
|
|
|
import (
|
2014-12-08 09:34:48 -06:00
|
|
|
"github.com/mitchellh/multistep"
|
|
|
|
"github.com/mitchellh/packer/packer"
|
2014-11-10 12:16:02 -06:00
|
|
|
)
|
|
|
|
|
2014-12-08 09:34:48 -06:00
|
|
|
type stepStartVmPaused struct{}
|
2014-11-10 12:16:02 -06:00
|
|
|
|
|
|
|
func (self *stepStartVmPaused) Run(state multistep.StateBag) multistep.StepAction {
|
|
|
|
|
2014-12-08 09:34:48 -06:00
|
|
|
client := state.Get("client").(XenAPIClient)
|
|
|
|
ui := state.Get("ui").(packer.Ui)
|
2014-11-10 12:16:02 -06:00
|
|
|
|
2014-12-08 09:34:48 -06:00
|
|
|
ui.Say("Step: Start VM Paused")
|
2014-11-10 12:16:02 -06:00
|
|
|
|
2014-12-08 09:34:48 -06:00
|
|
|
instance, _ := client.GetVMByUuid(state.Get("instance_uuid").(string))
|
2014-11-10 12:16:02 -06:00
|
|
|
|
2014-12-08 09:34:48 -06:00
|
|
|
instance.Start(true, false)
|
2014-11-10 12:16:02 -06:00
|
|
|
|
2014-12-08 09:34:48 -06:00
|
|
|
domid, _ := instance.GetDomainId()
|
|
|
|
state.Put("domid", domid)
|
2014-11-10 12:16:02 -06:00
|
|
|
|
2014-12-08 09:34:48 -06:00
|
|
|
return multistep.ActionContinue
|
2014-11-10 12:16:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (self *stepStartVmPaused) Cleanup(state multistep.StateBag) {
|
|
|
|
}
|