Updated Branches: refs/heads/vmsync b7d61f09b -> 52c9ea6a1
Cleanup some commented code Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/52c9ea6a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/52c9ea6a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/52c9ea6a Branch: refs/heads/vmsync Commit: 52c9ea6a1ff934fccfde29ec2bd77b77de485c50 Parents: b7d61f0 Author: Alex Huang <alex.hu...@gmail.com> Authored: Thu Jun 27 16:21:56 2013 -0700 Committer: Alex Huang <alex.hu...@gmail.com> Committed: Thu Jun 27 16:21:56 2013 -0700 ---------------------------------------------------------------------- .../com/cloud/vm/VirtualMachineManagerImpl.java | 103 ------------------- 1 file changed, 103 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/52c9ea6a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 7a5345d..ae16f45 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -551,109 +551,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } } - /* - protected boolean checkWorkItems(VMInstanceVO vm, State state) throws ConcurrentOperationException { - while (true) { - VmWorkJobVO vo = _workDao.findByOutstandingWork(vm.getId(), state); - if (vo == null) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Unable to find work for VM: " + vm + " and state: " + state); - } - return true; - } - - if (vo.getStep() == Step.Done) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Work for " + vm + " is " + vo.getStep()); - } - return true; - } - - if (vo.getSecondsTaskIsInactive() > _cancelWait) { - s_logger.warn("The task item for vm " + vm + " has been inactive for " + vo.getSecondsTaskIsInactive()); - return false; - } - - try { - Thread.sleep(_opWaitInterval); - } catch (InterruptedException e) { - s_logger.info("Waiting for " + vm + " but is interrupted"); - throw new ConcurrentOperationException("Waiting for " + vm + " but is interrupted"); - } - s_logger.debug("Waiting some more to make sure there's no activity on " + vm); - } - } - */ - - /* - @DB - protected VirtualMachineernary<T, ReservationContext, VmWorkJobVO> changeToStartState(VirtualMachineGuru<T> vmGuru, String vmUuid, User caller, Account account) - throws ConcurrentOperationException { - long vmId = vm.getId(); - - VmWorkJobVO work = new VmWorkJobVO(UUID.randomUUID().toString(), _nodeId, State.Starting, vm.getType(), vm.getId()); - int retry = _lockStateRetry; - while (retry-- != 0) { - Transaction txn = Transaction.currentTxn(); - Ternary<T, ReservationContext, VmWorkJobVO> result = null; - txn.start(); - try { - Journal journal = new Journal.LogJournal("Creating " + vm, s_logger); - work = _workDao.persist(work); - ReservationContextImpl context = new ReservationContextImpl(work.getId(), journal, caller, account); - - if (stateTransitTo(vm, VirtualMachine.Event.StartRequested, null, work.getId())) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Successfully transitioned to start state for " + vm + " reservation id = " + work.getId()); - } - result = new Ternary<T, ReservationContext, VmWorkJobVO>(vmGuru.findById(vmId), context, work); - txn.commit(); - return result; - } - } catch (NoTransitionException e) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Unable to transition into Starting state due to " + e.getMessage()); - } - } finally { - if (result == null) { - txn.rollback(); - } - } - - VMInstanceVO instance = _vmDao.findById(vmId); - if (instance == null) { - throw new ConcurrentOperationException("Unable to acquire lock on " + vm); - } - - if (s_logger.isDebugEnabled()) { - s_logger.debug("Determining why we're unable to update the state to Starting for " + instance + ". Retry=" + retry); - } - - State state = instance.getState(); - if (state == State.Running) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("VM is already started: " + vm); - } - return null; - } - - if (state.isTransitional()) { - if (!checkWorkItems(vm, state)) { - throw new ConcurrentOperationException("There are concurrent operations on " + vm); - } else { - continue; - } - } - - if (state != State.Stopped) { - s_logger.debug("VM " + vm + " is not in a state to be started: " + state); - return null; - } - } - - throw new ConcurrentOperationException("Unable to change the state of " + vm); - } - */ @DB protected Ternary<VMInstanceVO, ReservationContext, VmWorkJobVO> changeToStartState(VirtualMachineGuru vmGuru, VMInstanceVO vm, User caller, Account account)