protected void startUnits(ServiceDeploymentPlanner planner) {
   Map<Long, DeploymentUnitInstanceIdGenerator> svcInstanceIdGenerator =
       populateUsedNames(planner.getServices());
   /*
    * Ask the planner to deploy more units/ remove extra units
    */
   planner.deploy(svcInstanceIdGenerator);
 }
  private boolean needToReconcile(List<Service> services, ServiceDeploymentPlanner planner) {
    for (Service service : services) {
      if (service.getState().equals(CommonStatesConstants.INACTIVE)) {
        return true;
      }
    }

    return planner.needToReconcileDeployment();
  }
  protected void activateDeploymentUnits(ServiceDeploymentPlanner planner) {
    /*
     * Delete invalid units
     */
    planner.cleanupBadUnits();

    /*
     * Cleanup incomplete units
     */
    planner.cleanupIncompleteUnits();

    /*
     * Stop unhealthy units for service with retainIp=true
     */
    if (DataAccessor.fieldBool(
        planner.getServices().get(0), ServiceDiscoveryConstants.FIELD_SERVICE_RETAIN_IP)) {
      planner.scheduleUnhealthyUnitsStop();
    }

    /*
     * Activate all the units
     */
    startUnits(planner);

    /*
     * Delete the units that have a bad health
     */
    planner.cleanupUnhealthyUnits();

    /*
     * Cleanup unused service indexes
     */
    planner.cleanupUnusedAndDuplicatedServiceIndexes();
  }