mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Fix issue in scale VM to dynamic service offering
This reverts commit 9c4162ac7f451fc3e2155418dcfff224c8c08a4a and 16baa1289b7de383e98d0070717b3f1873fa2db3 Before change: exception when change compute offering (to dynamic service offering) on UI After change: succeed
This commit is contained in:
		
							parent
							
								
									451ae2bab8
								
							
						
					
					
						commit
						ef3dfbbd34
					
				| @ -16,6 +16,9 @@ | ||||
| // under the License. | ||||
| package org.apache.cloudstack.api.command.user.vm; | ||||
| 
 | ||||
| import java.util.Collection; | ||||
| import java.util.HashMap; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| @ -78,8 +81,22 @@ public class ScaleVMCmd extends BaseAsyncCmd { | ||||
|         return serviceOfferingId; | ||||
|     } | ||||
| 
 | ||||
|     //instead of reading a map directly we are using collections. | ||||
|     //it is because details.values() cannot be cast to a map. | ||||
|     //it gives a exception | ||||
|     public Map<String, String> getDetails() { | ||||
|         return details; | ||||
|         Map<String, String> customparameterMap = new HashMap<String, String>(); | ||||
|         if (details != null && details.size() != 0) { | ||||
|             Collection parameterCollection = details.values(); | ||||
|             Iterator iter = parameterCollection.iterator(); | ||||
|             while (iter.hasNext()) { | ||||
|                 HashMap<String, String> value = (HashMap<String, String>)iter.next(); | ||||
|                 for (String key : value.keySet()) { | ||||
|                     customparameterMap.put(key, value.get(key)); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return customparameterMap; | ||||
|     } | ||||
| 
 | ||||
|     ///////////////////////////////////////////////////// | ||||
| @ -142,4 +159,4 @@ public class ScaleVMCmd extends BaseAsyncCmd { | ||||
|             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
| @ -16,6 +16,9 @@ | ||||
| // under the License. | ||||
| package org.apache.cloudstack.api.command.user.vm; | ||||
| 
 | ||||
| import java.util.Collection; | ||||
| import java.util.HashMap; | ||||
| import java.util.Iterator; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| import org.apache.log4j.Logger; | ||||
| @ -77,7 +80,18 @@ public class UpgradeVMCmd extends BaseCmd { | ||||
|     } | ||||
| 
 | ||||
|     public Map<String, String> getDetails() { | ||||
|         return details; | ||||
|         Map<String, String> customparameterMap = new HashMap<String, String>(); | ||||
|         if (details != null && details.size() != 0) { | ||||
|             Collection parameterCollection = details.values(); | ||||
|             Iterator iter = parameterCollection.iterator(); | ||||
|             while (iter.hasNext()) { | ||||
|                 HashMap<String, String> value = (HashMap<String, String>)iter.next(); | ||||
|                 for (String key : value.keySet()) { | ||||
|                     customparameterMap.put(key, value.get(key)); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return customparameterMap; | ||||
|     } | ||||
| 
 | ||||
|     ///////////////////////////////////////////////////// | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user