@@ -1304,6 +1304,8 @@ protected Command compareState(VMInstanceVO vm, final AgentVmInfo info, final bo
13041304 final State serverState = vm .getState ();
13051305 final String serverName = vm .getName ();
13061306
1307+ VirtualMachineGuru <VMInstanceVO > vmGuru = getVmGuru (vm );
1308+
13071309 Command command = null ;
13081310
13091311 if (s_logger .isDebugEnabled ()) {
@@ -1389,7 +1391,33 @@ protected Command compareState(VMInstanceVO vm, final AgentVmInfo info, final bo
13891391 s_logger .debug ("VM state is starting on full sync so updating it to running" );
13901392 vm = findById (vm .getType (), vm .getId ());
13911393 stateTransitTo (vm , Event .AgentReportRunning , vm .getHostId ());
1392- //finalizeStart(new VirtualMachineProfileImpl<VMInstanceVO>(vm), vm.getHostId(), null, null);
1394+ s_logger .debug ("VM's " + vm + " state is starting on full sync so updating it to Running" );
1395+ vm = vmGuru .findById (vm .getId ());
1396+
1397+ VirtualMachineProfile <VMInstanceVO > profile = new VirtualMachineProfileImpl <VMInstanceVO >(vm );
1398+
1399+ Commands cmds = new Commands (OnError .Revert );
1400+ s_logger .debug ("Finalizing commands that need to be send to complete Start process for the vm " + vm );
1401+ vmGuru .finalizeCommandsOnStart (cmds , profile );
1402+
1403+ if (cmds .size () != 0 ) {
1404+ try {
1405+ _agentMgr .send (vm .getHostId (), cmds );
1406+ } catch (OperationTimedoutException e ){
1407+ s_logger .error ("Exception during update for running vm: " + vm , e );
1408+ return null ;
1409+ } catch (ResourceUnavailableException e ) {
1410+ s_logger .error ("Exception during update for running vm: " + vm , e );
1411+ return null ;
1412+ }
1413+ }
1414+
1415+ if (vmGuru .finalizeStart (profile , vm .getHostId (), cmds , null )) {
1416+ stateTransitTo (vm , Event .AgentReportRunning , vm .getHostId ());
1417+ } else {
1418+ s_logger .error ("Exception during update for running vm: " + vm );
1419+ return null ;
1420+ }
13931421 }
13941422 } else if (serverState == State .Stopping ) {
13951423 if (fullSync ) {
0 commit comments