Esempio n. 1
0
 @Override
 public void onSucceeded(Guid cmdId, List<Guid> childCmdIds) {
   RemoveVmPoolCommand<? extends VmPoolParametersBase> cmd = getCommand(cmdId);
   CommandCoordinatorUtil.removeAllCommandsInHierarchy(cmdId);
   cmd.getParameters().setTaskGroupSuccess(true);
   cmd.endAction();
 }
Esempio n. 2
0
  @Override
  public void doPolling(Guid cmdId, List<Guid> childCmdIds) {
    RemoveVmPoolCommand<? extends VmPoolParametersBase> command = getCommand(cmdId);

    boolean anyFailed = false;
    for (Guid childCmdId : childCmdIds) {
      CommandEntity entity = CommandCoordinatorUtil.getCommandEntity(childCmdId);
      switch (entity.getCommandStatus()) {
        case ENDED_WITH_FAILURE:
        case FAILED:
        case EXECUTION_FAILED:
        case UNKNOWN:
          anyFailed = true;
          break;

        default:
          break;
      }
    }

    if (anyFailed) {
      command.setCommandStatus(CommandStatus.FAILED);
    } else {
      VmPool pool = DbFacade.getInstance().getVmPoolDao().get(command.getVmPoolId());
      if (pool == null || pool.getRunningVmsCount() == 0) {
        command.setCommandStatus(CommandStatus.SUCCEEDED);
      }
    }
  }