mirror of https://github.com/apache/cloudstack.git
Cleanup some commented code
This commit is contained in:
parent
b7d61f09b9
commit
52c9ea6a1f
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue