@@ -1047,7 +1047,7 @@ public void orchestrateStart(String vmUuid, Map<VirtualMachineProfile.Param, Obj
10471047 s_logger .info ("The guru did not like the answers so stopping " + vm );
10481048 }
10491049
1050- StopCommand cmd = new StopCommand (vm , getExecuteInSequence (vm .getHypervisorType ()));
1050+ StopCommand cmd = new StopCommand (vm , getExecuteInSequence (vm .getHypervisorType ()), false );
10511051 StopAnswer answer = (StopAnswer ) _agentMgr .easySend (destHostId , cmd );
10521052 if ( answer != null ) {
10531053
@@ -1225,9 +1225,9 @@ protected boolean getExecuteInSequence(HypervisorType hypervisorType) {
12251225 }
12261226 }
12271227
1228- protected boolean sendStop (VirtualMachineGuru guru , VirtualMachineProfile profile , boolean force ) {
1228+ protected boolean sendStop (VirtualMachineGuru guru , VirtualMachineProfile profile , boolean force , boolean checkBeforeCleanup ) {
12291229 VirtualMachine vm = profile .getVirtualMachine ();
1230- StopCommand stop = new StopCommand (vm , getExecuteInSequence (vm .getHypervisorType ()));
1230+ StopCommand stop = new StopCommand (vm , getExecuteInSequence (vm .getHypervisorType ()), checkBeforeCleanup );
12311231 try {
12321232 StopAnswer answer = (StopAnswer )_agentMgr .send (vm .getHostId (), stop );
12331233 if (answer != null ) {
@@ -1282,7 +1282,7 @@ protected boolean cleanup(VirtualMachineGuru guru, VirtualMachineProfile profile
12821282
12831283 if (step == Step .Started || step == Step .Starting || step == Step .Release ) {
12841284 if (vm .getHostId () != null ) {
1285- if (!sendStop (guru , profile , cleanUpEvenIfUnableToStop )) {
1285+ if (!sendStop (guru , profile , cleanUpEvenIfUnableToStop , false )) {
12861286 s_logger .warn ("Failed to stop vm " + vm + " in " + State .Starting + " state as a part of cleanup process" );
12871287 return false ;
12881288 }
@@ -1295,26 +1295,26 @@ protected boolean cleanup(VirtualMachineGuru guru, VirtualMachineProfile profile
12951295 }
12961296 } else if (state == State .Stopping ) {
12971297 if (vm .getHostId () != null ) {
1298- if (!sendStop (guru , profile , cleanUpEvenIfUnableToStop )) {
1298+ if (!sendStop (guru , profile , cleanUpEvenIfUnableToStop , false )) {
12991299 s_logger .warn ("Failed to stop vm " + vm + " in " + State .Stopping + " state as a part of cleanup process" );
13001300 return false ;
13011301 }
13021302 }
13031303 } else if (state == State .Migrating ) {
13041304 if (vm .getHostId () != null ) {
1305- if (!sendStop (guru , profile , cleanUpEvenIfUnableToStop )) {
1305+ if (!sendStop (guru , profile , cleanUpEvenIfUnableToStop , false )) {
13061306 s_logger .warn ("Failed to stop vm " + vm + " in " + State .Migrating + " state as a part of cleanup process" );
13071307 return false ;
13081308 }
13091309 }
13101310 if (vm .getLastHostId () != null ) {
1311- if (!sendStop (guru , profile , cleanUpEvenIfUnableToStop )) {
1311+ if (!sendStop (guru , profile , cleanUpEvenIfUnableToStop , false )) {
13121312 s_logger .warn ("Failed to stop vm " + vm + " in " + State .Migrating + " state as a part of cleanup process" );
13131313 return false ;
13141314 }
13151315 }
13161316 } else if (state == State .Running ) {
1317- if (!sendStop (guru , profile , cleanUpEvenIfUnableToStop )) {
1317+ if (!sendStop (guru , profile , cleanUpEvenIfUnableToStop , false )) {
13181318 s_logger .warn ("Failed to stop vm " + vm + " in " + State .Running + " state as a part of cleanup process" );
13191319 return false ;
13201320 }
@@ -1488,7 +1488,7 @@ private void advanceStop(VMInstanceVO vm, boolean cleanUpEvenIfUnableToStop) thr
14881488
14891489 vmGuru .prepareStop (profile );
14901490
1491- StopCommand stop = new StopCommand (vm , getExecuteInSequence (vm .getHypervisorType ()));
1491+ StopCommand stop = new StopCommand (vm , getExecuteInSequence (vm .getHypervisorType ()), false );
14921492
14931493 boolean stopped = false ;
14941494 StopAnswer answer = null ;
@@ -2464,11 +2464,11 @@ private void orchestrateReboot(String vmUuid, Map<VirtualMachineProfile.Param, O
24642464 }
24652465
24662466 public Command cleanup (VirtualMachine vm ) {
2467- return new StopCommand (vm , getExecuteInSequence (vm .getHypervisorType ()));
2467+ return new StopCommand (vm , getExecuteInSequence (vm .getHypervisorType ()), false );
24682468 }
24692469
24702470 public Command cleanup (String vmName ) {
2471- return new StopCommand (vmName , getExecuteInSequence (null ));
2471+ return new StopCommand (vmName , getExecuteInSequence (null ), false );
24722472
24732473 }
24742474
@@ -4257,7 +4257,7 @@ private void handlePowerOffReportWithNoPendingJobsOnVM(VMInstanceVO vm) {
42574257
42584258 VirtualMachineGuru vmGuru = getVmGuru (vm );
42594259 VirtualMachineProfile profile = new VirtualMachineProfileImpl (vm );
4260- sendStop (vmGuru , profile , true );
4260+ sendStop (vmGuru , profile , true , true );
42614261
42624262 try {
42634263 stateTransitTo (vm , VirtualMachine .Event .FollowAgentPowerOffReport , null );
0 commit comments