Skip to content

Commit 35e09c8

Browse files
bvbharatAlena Prokharchyk
authored andcommitted
CLOUDSTACK-5651 deployVm: customparameters param name has to be changed
Signed-off-by: Alena Prokharchyk <alena.prokharchyk@citrix.com>
1 parent db10acd commit 35e09c8

8 files changed

Lines changed: 37 additions & 40 deletions

File tree

‎api/src/org/apache/cloudstack/api/ApiConstants.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public class ApiConstants {
7171
public static final String DISPLAY_VM = "displayvm";
7272
public static final String DISPLAY_OFFERING = "displayoffering";
7373
public static final String DISPLAY_VOLUME = "displayvolume";
74-
public static final String CUSTOM_PARAMETERS = "customparameters";
7574
public static final String DNS1 = "dns1";
7675
public static final String DNS2 = "dns2";
7776
public static final String IP6_DNS1 = "ip6dns1";

‎api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd {
6363
required=true, description="the service offering ID to apply to the system vm")
6464
private Long serviceOfferingId;
6565

66-
@Parameter(name=ApiConstants.CUSTOM_PARAMETERS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpu, memory and cpunumber. example customparameters[i].name=value")
67-
private Map<String, String> customParameters;
66+
@Parameter(name=ApiConstants.DETAILS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value")
67+
private Map<String, String> details;
6868

6969
/////////////////////////////////////////////////////
7070
/////////////////// Accessors ///////////////////////
@@ -78,10 +78,10 @@ public Long getServiceOfferingId() {
7878
return serviceOfferingId;
7979
}
8080

81-
public Map<String, String> getCustomParameters() {
81+
public Map<String, String> getDetails() {
8282
Map<String,String> customparameterMap = new HashMap<String, String>();
83-
if (customParameters != null && customParameters.size() !=0){
84-
Collection parameterCollection = customParameters.values();
83+
if (details != null && details.size() !=0){
84+
Collection parameterCollection = details.values();
8585
Iterator iter = parameterCollection.iterator();
8686
while (iter.hasNext()) {
8787
HashMap<String, String> value = (HashMap<String, String>) iter.next();

‎api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public class UpgradeSystemVMCmd extends BaseCmd {
5858
required=true, description="the service offering ID to apply to the system vm")
5959
private Long serviceOfferingId;
6060

61-
@Parameter(name=ApiConstants.CUSTOM_PARAMETERS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpu, memory and cpunumber. example customparameters[i].name=value")
62-
private Map<String, String> customParameters;
61+
@Parameter(name=ApiConstants.DETAILS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value")
62+
private Map<String, String> details;
6363

6464
/////////////////////////////////////////////////////
6565
/////////////////// Accessors ///////////////////////
@@ -73,10 +73,10 @@ public Long getServiceOfferingId() {
7373
return serviceOfferingId;
7474
}
7575

76-
public Map<String, String> getCustomParameters() {
76+
public Map<String, String> getDetails() {
7777
Map<String,String> customparameterMap = new HashMap<String, String>();
78-
if (customParameters != null && customParameters.size() !=0){
79-
Collection parameterCollection = customParameters.values();
78+
if (details != null && details.size() !=0){
79+
Collection parameterCollection = details.values();
8080
Iterator iter = parameterCollection.iterator();
8181
while (iter.hasNext()) {
8282
HashMap<String, String> value = (HashMap<String, String>) iter.next();

‎api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
188188
@Parameter(name=ApiConstants.DISPLAY_VM, type=CommandType.BOOLEAN, since="4.2", description="an optional field, whether to the display the vm to the end user or not.")
189189
private Boolean displayVm;
190190

191-
@Parameter(name = ApiConstants.CUSTOM_PARAMETERS,
191+
@Parameter(name = ApiConstants.DETAILS,
192192
type = CommandType.MAP,
193193
since= "4.3",
194194
description = "used to specify the custom parameters.")
195-
private Map customParameters;
195+
private Map details;
196196

197197
/////////////////////////////////////////////////////
198198
/////////////////// Accessors ///////////////////////
@@ -221,10 +221,10 @@ public Long getDomainId() {
221221
return domainId;
222222
}
223223

224-
public Map<String, String> getCustomParameters() {
224+
public Map<String, String> getDetails() {
225225
Map<String,String> customparameterMap = new HashMap<String, String>();
226-
if (customParameters != null && customParameters.size() !=0){
227-
Collection parameterCollection = customParameters.values();
226+
if (details != null && details.size() !=0){
227+
Collection parameterCollection = details.values();
228228
Iterator iter = parameterCollection.iterator();
229229
while (iter.hasNext()) {
230230
HashMap<String, String> value = (HashMap<String, String>) iter.next();
@@ -519,14 +519,14 @@ public void create() throws ResourceAllocationException{
519519
vm =
520520
_userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name, displayName,
521521
diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard,
522-
getAffinityGroupIdList(), getCustomParameters());
522+
getAffinityGroupIdList(), getDetails());
523523
}
524524
} else {
525525
if (zone.isSecurityGroupEnabled()) {
526526
vm =
527527
_userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(), owner, name,
528528
displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm,
529-
keyboard, getAffinityGroupIdList(), getCustomParameters());
529+
keyboard, getAffinityGroupIdList(), getDetails());
530530

531531
} else {
532532
if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
@@ -535,7 +535,7 @@ displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), user
535535
vm =
536536
_userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName, diskOfferingId, size,
537537
group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList(),
538-
getCustomParameters());
538+
getDetails());
539539

540540
}
541541
}

‎api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
2626
import org.apache.cloudstack.api.response.SuccessResponse;
2727
import org.apache.cloudstack.api.response.UserVmResponse;
28-
import org.apache.cloudstack.context.CallContext;
2928

3029
import org.apache.log4j.Logger;
3130

@@ -55,8 +54,8 @@ public class ScaleVMCmd extends BaseAsyncCmd {
5554
required=true, description="the ID of the service offering for the virtual machine")
5655
private Long serviceOfferingId;
5756

58-
@Parameter(name=ApiConstants.CUSTOM_PARAMETERS,type = BaseCmd.CommandType.MAP, description = "name value pairs of custom parameters for cpu,memory and cpunumber. example customparameters[i].name=value")
59-
private Map<String, String> customParameters;
57+
@Parameter(name=ApiConstants.DETAILS,type = BaseCmd.CommandType.MAP, description = "name value pairs of custom parameters for cpu,memory and cpunumber. example details[i].name=value")
58+
private Map<String, String> details;
6059

6160
/////////////////////////////////////////////////////
6261
/////////////////// Accessors ///////////////////////
@@ -71,12 +70,12 @@ public Long getServiceOfferingId() {
7170
}
7271

7372
//instead of reading a map directly we are using collections.
74-
//it is because customParameters.values() cannot be cast to a map.
73+
//it is because details.values() cannot be cast to a map.
7574
//it gives a exception
76-
public Map<String, String> getCustomParameters() {
75+
public Map<String, String> getDetails() {
7776
Map<String,String> customparameterMap = new HashMap<String, String>();
78-
if (customParameters != null && customParameters.size() !=0){
79-
Collection parameterCollection = customParameters.values();
77+
if (details != null && details.size() !=0){
78+
Collection parameterCollection = details.values();
8079
Iterator iter = parameterCollection.iterator();
8180
while (iter.hasNext()) {
8281
HashMap<String, String> value = (HashMap<String, String>) iter.next();

‎api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public class UpgradeVMCmd extends BaseCmd {
5858
required=true, description="the service offering ID to apply to the virtual machine")
5959
private Long serviceOfferingId;
6060

61-
@Parameter(name=ApiConstants.CUSTOM_PARAMETERS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpu, memory and cpunumber. example customparameters[i].name=value")
62-
private Map<String, String> customParameters;
61+
@Parameter(name=ApiConstants.DETAILS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value")
62+
private Map<String, String> details;
6363

6464
/////////////////////////////////////////////////////
6565
/////////////////// Accessors ///////////////////////
@@ -73,10 +73,10 @@ public Long getServiceOfferingId() {
7373
return serviceOfferingId;
7474
}
7575

76-
public Map<String, String> getCustomParameters() {
76+
public Map<String, String> getDetails() {
7777
Map<String,String> customparameterMap = new HashMap<String, String>();
78-
if (customParameters != null && customParameters.size() !=0){
79-
Collection parameterCollection = customParameters.values();
78+
if (details != null && details.size() !=0){
79+
Collection parameterCollection = details.values();
8080
Iterator iter = parameterCollection.iterator();
8181
while (iter.hasNext()) {
8282
HashMap<String, String> value = (HashMap<String, String>) iter.next();

‎server/src/com/cloud/server/ManagementServerImpl.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3837,7 +3837,7 @@ public VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnava
38373837
if (vmInstance.getHypervisorType() == HypervisorType.XenServer && vmInstance.getState().equals(State.Running)) {
38383838
throw new InvalidParameterValueException("Dynamic Scaling operation is not permitted for this hypervisor on system vm");
38393839
}
3840-
boolean result = _userVmMgr.upgradeVirtualMachine(cmd.getId(), cmd.getServiceOfferingId(), cmd.getCustomParameters());
3840+
boolean result = _userVmMgr.upgradeVirtualMachine(cmd.getId(), cmd.getServiceOfferingId(), cmd.getDetails());
38413841
if(result){
38423842
VirtualMachine vm = _vmInstanceDao.findById(cmd.getId());
38433843
return vm;
@@ -3851,7 +3851,7 @@ public VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnava
38513851
public VirtualMachine upgradeSystemVM(UpgradeSystemVMCmd cmd) {
38523852
Long systemVmId = cmd.getId();
38533853
Long serviceOfferingId = cmd.getServiceOfferingId();
3854-
return upgradeStoppedSystemVm(systemVmId, serviceOfferingId, cmd.getCustomParameters());
3854+
return upgradeStoppedSystemVm(systemVmId, serviceOfferingId, cmd.getDetails());
38553855

38563856
}
38573857

‎server/src/com/cloud/vm/UserVmManagerImpl.java‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import javax.naming.ConfigurationException;
3636

3737
import com.cloud.capacity.Capacity;
38-
import com.cloud.exception.InsufficientServerCapacityException;
3938
import org.apache.commons.codec.binary.Base64;
4039
import org.apache.log4j.Logger;
4140

@@ -829,11 +828,11 @@ public UserVm upgradeVirtualMachine(UpgradeVMCmd cmd) throws ResourceAllocationE
829828
_accountMgr.checkAccess(caller, null, true, vmInstance);
830829

831830
// Check resource limits for CPU and Memory.
832-
Map<String,String> customParameters = cmd.getCustomParameters();
831+
Map<String,String> customParameters = cmd.getDetails();
833832
ServiceOfferingVO newServiceOffering = _offeringDao.findById(svcOffId);
834833
if (newServiceOffering.isDynamic()) {
835834
newServiceOffering.setDynamicFlag(true);
836-
validateCustomParameters(newServiceOffering, cmd.getCustomParameters());
835+
validateCustomParameters(newServiceOffering, cmd.getDetails());
837836
newServiceOffering = _offeringDao.getcomputeOffering(newServiceOffering, customParameters);
838837
}
839838
ServiceOfferingVO currentServiceOffering = _offeringDao.findByIdIncludingRemoved(vmInstance.getId(), vmInstance.getServiceOfferingId());
@@ -890,7 +889,7 @@ public UserVm upgradeVirtualMachine(UpgradeVMCmd cmd) throws ResourceAllocationE
890889
}
891890

892891
// Generate usage event for VM upgrade
893-
generateUsageEvent(newServiceOffering, cmd.getCustomParameters(), _vmDao.findById(vmId), EventTypes.EVENT_VM_UPGRADE);
892+
generateUsageEvent(newServiceOffering, cmd.getDetails(), _vmDao.findById(vmId), EventTypes.EVENT_VM_UPGRADE);
894893

895894
return _vmDao.findById(vmInstance.getId());
896895
}
@@ -1233,16 +1232,16 @@ public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th
12331232
Long newServiceOfferingId = cmd.getServiceOfferingId();
12341233
CallContext.current().setEventDetails("Vm Id: " + vmId);
12351234

1236-
boolean result = upgradeVirtualMachine(vmId, newServiceOfferingId, cmd.getCustomParameters());
1235+
boolean result = upgradeVirtualMachine(vmId, newServiceOfferingId, cmd.getDetails());
12371236
if(result){
12381237
UserVmVO vmInstance = _vmDao.findById(vmId);
12391238
if(vmInstance.getState().equals(State.Stopped)){
12401239
// Generate usage event for VM upgrade
1241-
generateUsageEvent(_offeringDao.findById(newServiceOfferingId), cmd.getCustomParameters(), _vmDao.findById(vmId), EventTypes.EVENT_VM_UPGRADE);
1240+
generateUsageEvent(_offeringDao.findById(newServiceOfferingId), cmd.getDetails(), _vmDao.findById(vmId), EventTypes.EVENT_VM_UPGRADE);
12421241
}
12431242
if(vmInstance.getState().equals(State.Running)){
12441243
// Generate usage event for Dynamic scaling of VM
1245-
generateUsageEvent(_offeringDao.findById(newServiceOfferingId), cmd.getCustomParameters(), _vmDao.findById(vmId), EventTypes.EVENT_VM_UPGRADE);
1244+
generateUsageEvent(_offeringDao.findById(newServiceOfferingId), cmd.getDetails(), _vmDao.findById(vmId), EventTypes.EVENT_VM_UPGRADE);
12461245
}
12471246
return vmInstance;
12481247
} else {

0 commit comments

Comments
 (0)