コード例 #1
0
  @Override
  public void scheduleStop(VMInstanceVO vm, long hostId, WorkType type) {
    assert (type == WorkType.CheckStop || type == WorkType.ForceStop || type == WorkType.Stop);

    if (_haDao.hasBeenScheduled(vm.getId(), type)) {
      s_logger.info("There's already a job scheduled to stop " + vm);
      return;
    }

    HaWorkVO work =
        new HaWorkVO(
            vm.getId(),
            vm.getType(),
            type,
            Step.Scheduled,
            hostId,
            vm.getState(),
            0,
            vm.getUpdated());
    _haDao.persist(work);
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("Scheduled " + work);
    }
    wakeupWorkers();
  }
コード例 #2
0
  @Override
  public void scheduleStop(final VMInstanceVO vm, long hostId, boolean verifyHost) {

    if (_haDao.hasBeenScheduled(vm.getId(), verifyHost ? WorkType.CheckStop : WorkType.Stop)) {
      s_logger.info("There's already a job scheduled to stop " + vm.toString());
      return;
    }

    final HaWorkVO work =
        new HaWorkVO(
            vm.getId(),
            vm.getType(),
            verifyHost ? WorkType.CheckStop : WorkType.Stop,
            Step.Scheduled,
            hostId,
            vm.getState(),
            0,
            vm.getUpdated());
    _haDao.persist(work);
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("Scheduled " + work.toString() + " verifyHost = " + verifyHost);
    }
    wakeupWorkers();
  }