cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: updated refs/heads/4.3 to 35e09c8
Date Fri, 10 Jan 2014 17:51:50 GMT
Updated Branches:
  refs/heads/4.3 db10acd8b -> 35e09c81e


CLOUDSTACK-5651 deployVm: customparameters param name has to be changed

Signed-off-by: Alena Prokharchyk <alena.prokharchyk@citrix.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/35e09c81
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/35e09c81
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/35e09c81

Branch: refs/heads/4.3
Commit: 35e09c81e623f59ae73cc1c17f50922da8436105
Parents: db10acd
Author: Bharat Kumar <bharat.kumar@citrix.com>
Authored: Thu Jan 9 15:36:27 2014 +0530
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Fri Jan 10 09:42:33 2014 -0800

----------------------------------------------------------------------
 api/src/org/apache/cloudstack/api/ApiConstants.java |  1 -
 .../command/admin/systemvm/ScaleSystemVMCmd.java    | 10 +++++-----
 .../command/admin/systemvm/UpgradeSystemVMCmd.java  | 10 +++++-----
 .../cloudstack/api/command/user/vm/DeployVMCmd.java | 16 ++++++++--------
 .../cloudstack/api/command/user/vm/ScaleVMCmd.java  | 13 ++++++-------
 .../api/command/user/vm/UpgradeVMCmd.java           | 10 +++++-----
 .../src/com/cloud/server/ManagementServerImpl.java  |  4 ++--
 server/src/com/cloud/vm/UserVmManagerImpl.java      | 13 ++++++-------
 8 files changed, 37 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35e09c81/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index fbd3df8..449f979 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -71,7 +71,6 @@ public class ApiConstants {
     public static final String DISPLAY_VM = "displayvm";
     public static final String DISPLAY_OFFERING = "displayoffering";
     public static final String DISPLAY_VOLUME = "displayvolume";
-    public static final String CUSTOM_PARAMETERS = "customparameters";
     public static final String DNS1 = "dns1";
     public static final String DNS2 = "dns2";
     public static final String IP6_DNS1 = "ip6dns1";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35e09c81/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
index 2020622..9d2f06b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
@@ -63,8 +63,8 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd {
             required=true, description="the service offering ID to apply to the system vm")
     private Long serviceOfferingId;
 
-    @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")
-    private Map<String, String> customParameters;
+    @Parameter(name=ApiConstants.DETAILS, type = CommandType.MAP, description = "name value
pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value")
+    private Map<String, String> details;
 
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -78,10 +78,10 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd {
         return serviceOfferingId;
     }
 
-    public Map<String, String> getCustomParameters() {
+    public Map<String, String> getDetails() {
         Map<String,String> customparameterMap = new HashMap<String, String>();
-        if (customParameters != null && customParameters.size() !=0){
-            Collection parameterCollection = customParameters.values();
+        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();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35e09c81/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
index 531cddc..f44abd8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
@@ -58,8 +58,8 @@ public class UpgradeSystemVMCmd extends BaseCmd {
             required=true, description="the service offering ID to apply to the system vm")
     private Long serviceOfferingId;
 
-    @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")
-    private Map<String, String> customParameters;
+    @Parameter(name=ApiConstants.DETAILS, type = CommandType.MAP, description = "name value
pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value")
+    private Map<String, String> details;
 
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -73,10 +73,10 @@ public class UpgradeSystemVMCmd extends BaseCmd {
         return serviceOfferingId;
     }
 
-    public Map<String, String> getCustomParameters() {
+    public Map<String, String> getDetails() {
         Map<String,String> customparameterMap = new HashMap<String, String>();
-        if (customParameters != null && customParameters.size() !=0){
-            Collection parameterCollection = customParameters.values();
+        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();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35e09c81/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index a8a21ab..c9f0172 100755
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -188,11 +188,11 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
     @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.")
     private Boolean displayVm;
 
-    @Parameter(name = ApiConstants.CUSTOM_PARAMETERS,
+    @Parameter(name = ApiConstants.DETAILS,
                type = CommandType.MAP,
                since= "4.3",
                description = "used to specify the custom parameters.")
-    private  Map customParameters;
+    private  Map details;
 
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -221,10 +221,10 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
         return domainId;
     }
 
-    public Map<String, String> getCustomParameters() {
+    public Map<String, String> getDetails() {
         Map<String,String> customparameterMap = new HashMap<String, String>();
-        if (customParameters != null && customParameters.size() !=0){
-            Collection parameterCollection = customParameters.values();
+        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();
@@ -519,14 +519,14 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
                     vm =
                         _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering,
template, getSecurityGroupIdList(), owner, name, displayName,
                             diskOfferingId, size, group, getHypervisor(), getHttpMethod(),
userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard,
-                            getAffinityGroupIdList(), getCustomParameters());
+                            getAffinityGroupIdList(), getDetails());
                 }
             } else {
                 if (zone.isSecurityGroupEnabled()) {
                     vm =
                         _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering,
template, getNetworkIds(), getSecurityGroupIdList(), owner, name,
                             displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(),
userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm,
-                            keyboard, getAffinityGroupIdList(), getCustomParameters());
+                            keyboard, getAffinityGroupIdList(), getDetails());
 
                 } else {
                     if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty())
{
@@ -535,7 +535,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
                     vm =
                         _userVmService.createAdvancedVirtualMachine(zone, serviceOffering,
template, getNetworkIds(), owner, name, displayName, diskOfferingId, size,
                             group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName,
getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList(),
-                            getCustomParameters());
+                            getDetails());
 
                 }
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35e09c81/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
index 1716b61..a9cdd14 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
@@ -25,7 +25,6 @@ import org.apache.cloudstack.api.*;
 import org.apache.cloudstack.api.response.ServiceOfferingResponse;
 import org.apache.cloudstack.api.response.SuccessResponse;
 import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.context.CallContext;
 
 import org.apache.log4j.Logger;
 
@@ -55,8 +54,8 @@ public class ScaleVMCmd extends BaseAsyncCmd {
             required=true, description="the ID of the service offering for the virtual machine")
     private Long serviceOfferingId;
 
-    @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")
-    private Map<String, String> customParameters;
+    @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")
+    private Map<String, String> details;
 
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -71,12 +70,12 @@ public class ScaleVMCmd extends BaseAsyncCmd {
     }
 
     //instead of reading a map directly we are using collections.
-    //it is because customParameters.values() cannot be cast to a map.
+    //it is because details.values() cannot be cast to a map.
     //it gives a exception
-    public Map<String, String> getCustomParameters() {
+    public Map<String, String> getDetails() {
         Map<String,String> customparameterMap = new HashMap<String, String>();
-        if (customParameters != null && customParameters.size() !=0){
-            Collection parameterCollection = customParameters.values();
+        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();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35e09c81/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
index 140931e..6b87580 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
@@ -58,8 +58,8 @@ public class UpgradeVMCmd extends BaseCmd {
             required=true, description="the service offering ID to apply to the virtual machine")
     private Long serviceOfferingId;
 
-    @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")
-    private Map<String, String> customParameters;
+    @Parameter(name=ApiConstants.DETAILS, type = CommandType.MAP, description = "name value
pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value")
+    private Map<String, String> details;
 
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -73,10 +73,10 @@ public class UpgradeVMCmd extends BaseCmd {
         return serviceOfferingId;
     }
 
-    public Map<String, String> getCustomParameters() {
+    public Map<String, String> getDetails() {
         Map<String,String> customparameterMap = new HashMap<String, String>();
-        if (customParameters != null && customParameters.size() !=0){
-            Collection parameterCollection = customParameters.values();
+        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();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35e09c81/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 2237694..048e183 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -3837,7 +3837,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         if (vmInstance.getHypervisorType() == HypervisorType.XenServer && vmInstance.getState().equals(State.Running))
{
             throw new InvalidParameterValueException("Dynamic Scaling operation is not permitted
for this hypervisor on system vm");
         }
-        boolean result = _userVmMgr.upgradeVirtualMachine(cmd.getId(), cmd.getServiceOfferingId(),
cmd.getCustomParameters());
+        boolean result = _userVmMgr.upgradeVirtualMachine(cmd.getId(), cmd.getServiceOfferingId(),
cmd.getDetails());
         if(result){
             VirtualMachine vm = _vmInstanceDao.findById(cmd.getId());
             return vm;
@@ -3851,7 +3851,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
     public VirtualMachine upgradeSystemVM(UpgradeSystemVMCmd cmd) {
         Long systemVmId = cmd.getId();
         Long serviceOfferingId = cmd.getServiceOfferingId();
-        return upgradeStoppedSystemVm(systemVmId, serviceOfferingId, cmd.getCustomParameters());
+        return upgradeStoppedSystemVm(systemVmId, serviceOfferingId, cmd.getDetails());
 
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35e09c81/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 38c7863..792cf77 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -35,7 +35,6 @@ import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import com.cloud.capacity.Capacity;
-import com.cloud.exception.InsufficientServerCapacityException;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
 
@@ -829,11 +828,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         _accountMgr.checkAccess(caller, null, true, vmInstance);
 
         // Check resource limits for CPU and Memory.
-        Map<String,String> customParameters = cmd.getCustomParameters();
+        Map<String,String> customParameters = cmd.getDetails();
         ServiceOfferingVO newServiceOffering = _offeringDao.findById(svcOffId);
         if (newServiceOffering.isDynamic()) {
             newServiceOffering.setDynamicFlag(true);
-            validateCustomParameters(newServiceOffering, cmd.getCustomParameters());
+            validateCustomParameters(newServiceOffering, cmd.getDetails());
             newServiceOffering = _offeringDao.getcomputeOffering(newServiceOffering, customParameters);
         }
         ServiceOfferingVO currentServiceOffering = _offeringDao.findByIdIncludingRemoved(vmInstance.getId(),
vmInstance.getServiceOfferingId());
@@ -890,7 +889,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         }
 
         // Generate usage event for VM upgrade
-        generateUsageEvent(newServiceOffering, cmd.getCustomParameters(), _vmDao.findById(vmId),
EventTypes.EVENT_VM_UPGRADE);
+        generateUsageEvent(newServiceOffering, cmd.getDetails(), _vmDao.findById(vmId), EventTypes.EVENT_VM_UPGRADE);
 
         return _vmDao.findById(vmInstance.getId());
     }
@@ -1233,16 +1232,16 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         Long newServiceOfferingId = cmd.getServiceOfferingId();
         CallContext.current().setEventDetails("Vm Id: " + vmId);
 
-        boolean  result = upgradeVirtualMachine(vmId, newServiceOfferingId, cmd.getCustomParameters());
+        boolean  result = upgradeVirtualMachine(vmId, newServiceOfferingId, cmd.getDetails());
         if(result){
             UserVmVO vmInstance = _vmDao.findById(vmId);
             if(vmInstance.getState().equals(State.Stopped)){
                 // Generate usage event for VM upgrade
-                generateUsageEvent(_offeringDao.findById(newServiceOfferingId), cmd.getCustomParameters(),
_vmDao.findById(vmId), EventTypes.EVENT_VM_UPGRADE);
+                generateUsageEvent(_offeringDao.findById(newServiceOfferingId), cmd.getDetails(),
_vmDao.findById(vmId), EventTypes.EVENT_VM_UPGRADE);
             }
             if(vmInstance.getState().equals(State.Running)){
                 // Generate usage event for Dynamic scaling of VM
-                generateUsageEvent(_offeringDao.findById(newServiceOfferingId), cmd.getCustomParameters(),
_vmDao.findById(vmId), EventTypes.EVENT_VM_UPGRADE);
+                generateUsageEvent(_offeringDao.findById(newServiceOfferingId), cmd.getDetails(),
_vmDao.findById(vmId), EventTypes.EVENT_VM_UPGRADE);
             }
             return vmInstance;
         } else {


Mime
View raw message