mirror of https://github.com/apache/cloudstack.git
Fix issue in scale VM to dynamic service offering
This reverts commit9c4162ac7fand16baa1289bBefore 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…
Reference in New Issue