// restoreChanged will be called whenever restoreInfo doc changes signaling a new // step in the restore process. func (a *MachineAgent) restoreChanged(st *state.State) error { rinfo, err := st.RestoreInfoSetter() if err != nil { return errors.Annotate(err, "cannot read restore state") } switch rinfo.Status() { case state.RestorePending: a.PrepareRestore() case state.RestoreInProgress: a.BeginRestore() case state.RestoreFailed: a.EndRestore() } return nil }