mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Merge branch '4.9'
This commit is contained in:
		
						commit
						d8c038e5b2
					
				| @ -89,6 +89,8 @@ public interface VirtualMachineManager extends Manager { | ||||
| 
 | ||||
|     void stop(String vmUuid) throws ResourceUnavailableException; | ||||
| 
 | ||||
|     void stopForced(String vmUuid) throws ResourceUnavailableException; | ||||
| 
 | ||||
|     void expunge(String vmUuid) throws ResourceUnavailableException; | ||||
| 
 | ||||
|     void registerGuru(VirtualMachine.Type type, VirtualMachineGuru guru); | ||||
|  | ||||
| @ -114,6 +114,12 @@ public interface VirtualMachineEntity extends CloudStackEntity { | ||||
|      */ | ||||
|     boolean stop(String caller) throws ResourceUnavailableException, CloudException; | ||||
| 
 | ||||
|     /** | ||||
|      * Stop the virtual machine, by force if necessary | ||||
|      * | ||||
|      */ | ||||
|     boolean stopForced(String caller) throws ResourceUnavailableException, CloudException; | ||||
| 
 | ||||
|     /** | ||||
|      * Cleans up after any botched starts.  CloudStack Orchestration Platform | ||||
|      * will attempt a best effort to actually shutdown any resource but | ||||
|  | ||||
| @ -1239,6 +1239,18 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac | ||||
|         } catch (final ConcurrentOperationException e) { | ||||
|             throw new CloudRuntimeException("Unable to stop vm because of a concurrent operation", e); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void stopForced(String vmUuid) throws ResourceUnavailableException { | ||||
|         try { | ||||
|             advanceStop(vmUuid, true); | ||||
|         } catch (final OperationTimedoutException e) { | ||||
|             throw new AgentUnavailableException("Unable to stop vm because the operation to stop timed out", e.getAgentId(), e); | ||||
|         } catch (final ConcurrentOperationException e) { | ||||
|             throw new CloudRuntimeException("Unable to stop vm because of a concurrent operation", e); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | ||||
| @ -44,5 +44,7 @@ public interface VMEntityManager { | ||||
| 
 | ||||
|     boolean stopvirtualmachine(VMEntityVO vmEntityVO, String caller) throws ResourceUnavailableException; | ||||
| 
 | ||||
|     boolean stopvirtualmachineforced(VMEntityVO vmEntityVO, String caller) throws ResourceUnavailableException; | ||||
| 
 | ||||
|     boolean destroyVirtualMachine(VMEntityVO vmEntityVO, String caller) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException; | ||||
| } | ||||
|  | ||||
| @ -254,6 +254,12 @@ public class VMEntityManagerImpl implements VMEntityManager { | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean stopvirtualmachineforced(VMEntityVO vmEntityVO, String caller) throws ResourceUnavailableException { | ||||
|         _itMgr.stopForced(vmEntityVO.getUuid()); | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean destroyVirtualMachine(VMEntityVO vmEntityVO, String caller) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException { | ||||
| 
 | ||||
|  | ||||
| @ -217,6 +217,11 @@ public class VirtualMachineEntityImpl implements VirtualMachineEntity { | ||||
|         return manager.stopvirtualmachine(this.vmEntityVO, caller); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean stopForced(String caller) throws ResourceUnavailableException { | ||||
|         return manager.stopvirtualmachineforced(this.vmEntityVO, caller); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void cleanup() { | ||||
|         // TODO Auto-generated method stub | ||||
|  | ||||
| @ -200,7 +200,7 @@ public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxe | ||||
|         cmd.addVmData("metadata", "local-hostname", StringUtils.unicodeEscape(vm.getInstanceName())); | ||||
|         cmd.addVmData("metadata", "public-ipv4", nic.getIPv4Address()); | ||||
|         cmd.addVmData("metadata", "public-hostname", StringUtils.unicodeEscape(vm.getInstanceName())); | ||||
|         cmd.addVmData("metadata", "instance-id", String.valueOf(vm.getId())); | ||||
|         cmd.addVmData("metadata", "instance-id", String.valueOf(vm.getUuid())); | ||||
|         cmd.addVmData("metadata", "vm-id", String.valueOf(vm.getInstanceName())); | ||||
|         cmd.addVmData("metadata", "public-keys", null); | ||||
|         String cloudIdentifier = _configDao.getValue("cloud.identifier"); | ||||
|  | ||||
| @ -3918,7 +3918,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir | ||||
|         boolean status = false; | ||||
|         try { | ||||
|             VirtualMachineEntity vmEntity = _orchSrvc.getVirtualMachine(vm.getUuid()); | ||||
| 
 | ||||
|             if(forced) { | ||||
|                 status = vmEntity.stopForced(Long.toString(userId)); | ||||
|             } else { | ||||
|                 status = vmEntity.stop(Long.toString(userId)); | ||||
|             } | ||||
|             if (status) { | ||||
|                return _vmDao.findById(vmId); | ||||
|             } else { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user