mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Fix reinstall VM bug
This commit is contained in:
		
							parent
							
								
									50ab1b2fbe
								
							
						
					
					
						commit
						67794aba23
					
				| @ -31,7 +31,7 @@ public class DeployAsIsInfoTO { | |||||||
|     @LogLevel(LogLevel.Log4jLevel.Off) |     @LogLevel(LogLevel.Log4jLevel.Off) | ||||||
|     private Map<String, String> properties = new HashMap<>(); |     private Map<String, String> properties = new HashMap<>(); | ||||||
|     private Map<Integer, String> nicAdapterMap = new HashMap(); |     private Map<Integer, String> nicAdapterMap = new HashMap(); | ||||||
|     boolean replaceVm; |     private boolean replaceVm; | ||||||
| 
 | 
 | ||||||
|     public DeployAsIsInfoTO() { |     public DeployAsIsInfoTO() { | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -1771,12 +1771,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa | |||||||
|         auxVM.destroy(); |         auxVM.destroy(); | ||||||
|         String vmNameInVcenter = virtualMachineMO.getName(); |         String vmNameInVcenter = virtualMachineMO.getName(); | ||||||
|         virtualMachineMO.tearDownDevices(new Class<?>[]{VirtualDisk.class}); |         virtualMachineMO.tearDownDevices(new Class<?>[]{VirtualDisk.class}); | ||||||
|  |         s_logger.info("Changing VM datastore to " + dsMo); | ||||||
|  |         virtualMachineMO.changeDatastore(morDatastore); | ||||||
|         for (String vmdkFileBaseName : vmdkFileBaseNames) { |         for (String vmdkFileBaseName : vmdkFileBaseNames) { | ||||||
|             String newPath = null; |  | ||||||
|             if (dsMo.folderExists(String.format("[%s]", dsMo.getName()), vmNameInVcenter)) { |             if (dsMo.folderExists(String.format("[%s]", dsMo.getName()), vmNameInVcenter)) { | ||||||
|                 newPath = VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dcMo, vmNameInVcenter, dsMo, vmdkFileBaseName, null); |                 String newPath = VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dcMo, vmNameInVcenter, dsMo, vmdkFileBaseName, null); | ||||||
|  |                 s_logger.info("Attaching disk to restored VM at: " + newPath + " on datastore: " + destDatastore); | ||||||
|  |                 virtualMachineMO.attachDisk(new String[] {newPath}, morDatastore); | ||||||
|             } |             } | ||||||
|             virtualMachineMO.attachDisk(new String[] {newPath}, morDatastore); |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user