mirror of https://github.com/apache/cloudstack.git
Bug 11457 - NullPointerException while synching VM state from Starting -> Running between management server and agent
reviewed-by: Alex/Kelven Changes: 1. UserVmManagerImpl :: finalizeStart() Added null check for the cmds.getAnswers() object. Return ‘true’ if null. 2. VirtualMachineManagerImpl :: advanceStart() Move the line to set PodId to the vm being started above the state transition where hostId gets set, so that podId is not null in case management server goes down when vm starts on the agent. On restart, podId is not updated during fullsync. So this will prevent podId remaining null. vm.setPodId(dest.getPod().getId());
This commit is contained in:
parent
bc724d702e
commit
df17ce5648
|
|
@ -2751,6 +2751,14 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
@Override
|
||||
public boolean finalizeStart(VirtualMachineProfile<UserVmVO> profile, long hostId, Commands cmds, ReservationContext context) {
|
||||
UserVmVO vm = profile.getVirtualMachine();
|
||||
|
||||
Answer[] answersToCmds = cmds.getAnswers();
|
||||
if(answersToCmds == null){
|
||||
if(s_logger.isDebugEnabled()){
|
||||
s_logger.debug("Returning from finalizeStart() since there are no answers to read");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Answer startAnswer = cmds.getAnswer(StartAnswer.class);
|
||||
String returnedIp = null;
|
||||
String originalIp = null;
|
||||
|
|
|
|||
|
|
@ -692,6 +692,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
|||
}
|
||||
|
||||
long destHostId = dest.getHost().getId();
|
||||
vm.setPodId(dest.getPod().getId());
|
||||
|
||||
try {
|
||||
if (!changeState(vm, Event.OperationRetry, destHostId, work, Step.Prepare)) {
|
||||
|
|
@ -715,7 +716,6 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
|||
cmds.addCommand(new StartCommand(vmTO));
|
||||
|
||||
vmGuru.finalizeDeployment(cmds, vmProfile, dest, ctx);
|
||||
vm.setPodId(dest.getPod().getId());
|
||||
|
||||
work = _workDao.findById(work.getId());
|
||||
if (work == null || work.getStep() != Step.Prepare) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue