mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
bug 10847: sg got executed in a big transaction leading to the deadlock
This commit is contained in:
parent
9c627a15f3
commit
200d2b9cd0
@ -556,16 +556,19 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
|||||||
throw new ConcurrentOperationException("Unable to change the state of " + vm);
|
throw new ConcurrentOperationException("Unable to change the state of " + vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DB
|
|
||||||
protected <T extends VMInstanceVO> boolean changeState(T vm, Event event, Long hostId, ItWorkVO work, Step step) throws NoTransitionException {
|
protected <T extends VMInstanceVO> boolean changeState(T vm, Event event, Long hostId, ItWorkVO work, Step step) throws NoTransitionException {
|
||||||
Transaction txn = Transaction.currentTxn();
|
// FIXME: We should do this better.
|
||||||
txn.start();
|
Step previousStep = work.getStep();
|
||||||
if (!stateTransitTo(vm, event, hostId)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_workDao.updateStep(work, step);
|
_workDao.updateStep(work, step);
|
||||||
txn.commit();
|
boolean result = false;
|
||||||
return true;
|
try {
|
||||||
|
result = stateTransitTo(vm, event, hostId);
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
if (!result) {
|
||||||
|
_workDao.updateStep(work, previousStep);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user