private List<NodeEntity> getNodesToBeSetLocalRepo(ChunkContext chunkContext, String clusterName)
      throws TaskException {
    List<NodeEntity> toBeSetLocalRepo = null;
    if ((managementOperation == ManagementOperation.CREATE)
        || (managementOperation == ManagementOperation.RESUME)) {
      toBeSetLocalRepo = getClusterEntityMgr().findAllNodes(clusterName);
      return toBeSetLocalRepo;
    } else if (managementOperation == ManagementOperation.RESIZE) {
      String groupName =
          getJobParameters(chunkContext).getString(JobConstants.GROUP_NAME_JOB_PARAM);
      List<NodeEntity> nodesInGroup = clusterEntityMgr.findAllNodes(clusterName, groupName);
      long oldInstanceNum =
          getJobParameters(chunkContext).getLong(JobConstants.GROUP_INSTANCE_OLD_NUMBER_JOB_PARAM);

      for (NodeEntity node : nodesInGroup) {
        long index = CommonUtil.getVmIndex(node.getVmName());
        if (index < oldInstanceNum) {
          // do not verify existing nodes from last successful deployment
          continue;
        }
        if (node.getStatus().ordinal() >= NodeStatus.VM_READY.ordinal()) {
          if (toBeSetLocalRepo == null) {
            toBeSetLocalRepo = new ArrayList<NodeEntity>();
          }
          toBeSetLocalRepo.add(node);
        }
      }
      return toBeSetLocalRepo;
    } else {
      throw TaskException.EXECUTION_FAILED("Unknown operation type.");
    }
  }