Always fetch a new VM instance from UUID for consistency

This commit is contained in:
Cheng Sun 2014-12-15 11:18:57 +00:00
parent 5e87812ecf
commit dfa9d63097
2 changed files with 6 additions and 2 deletions

View File

@ -207,7 +207,6 @@ func (self *stepCreateInstance) Run(state multistep.StateBag) multistep.StepActi
}
state.Put("instance_uuid", instanceId)
state.Put("instance", instance)
ui.Say(fmt.Sprintf("Created instance '%s'", instanceId))
return multistep.ActionContinue

View File

@ -27,7 +27,12 @@ func (self *stepStartOnHIMN) Run(state multistep.StateBag) multistep.StepAction
ui.Say("Step: Start VM on the Host Internal Mangement Network")
instance := state.Get("instance").(*VM)
uuid := state.Get("instance_uuid").(string)
instance, err := client.GetVMByUuid(uuid)
if err != nil {
ui.Error(fmt.Sprintf("Unable to get VM from UUID '%s': %s", uuid, err.Error()))
return multistep.ActionHalt
}
// Find the HIMN Ref
networks, err := client.GetNetworkByNameLabel("Host internal management network")