func (s *Scheduler) StopCluster(clusterModel interfaces.ClusterModel) error {
	plan, err := s.newPlan(clusterModel, structs.ClusterFeatures{NodeCount: 0})
	if err != nil {
		return err
	}

	s.logger.Info("scheduler.stop-cluster", lager.Data{
		"instance-id": clusterModel.InstanceID(),
		"plan":        plan,
		"steps-count": len(plan.steps()),
		"steps":       plan.stepTypes(),
	})

	return s.executePlan(clusterModel, plan)
}
func (s *Scheduler) RunCluster(clusterModel interfaces.ClusterModel, features structs.ClusterFeatures) (err error) {
	err = s.VerifyClusterFeatures(features)
	if err != nil {
		return
	}

	plan, err := s.newPlan(clusterModel, features)
	if err != nil {
		return
	}

	s.logger.Info("scheduler.run-cluster", lager.Data{
		"instance-id": clusterModel.InstanceID(),
		"steps-count": len(plan.steps()),
		"steps":       plan.stepTypes(),
		"features":    features,
	})

	return s.executePlan(clusterModel, plan)
}
func (s *Scheduler) executePlan(clusterModel interfaces.ClusterModel, plan plan) error {
	steps := plan.steps()
	clusterModel.BeginScheduling(len(steps))

	for _, step := range steps {
		clusterModel.SchedulingStepStarted(step.StepType())
		err := step.Perform()
		if err != nil {
			clusterModel.SchedulingError(err)
			return err
		}
		clusterModel.SchedulingStepCompleted()
	}
	return nil
}