incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pran...@apache.org
Subject [2/50] git commit: Autoscale:Sending the Counter params as list
Date Fri, 16 Nov 2012 10:00:31 GMT
Autoscale:Sending the Counter params as list

Conflicts:

	server/src/com/cloud/api/ApiResponseHelper.java


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

Branch: refs/heads/master
Commit: aea87da4103dd9ac2017f6b3ac6a39049d8da903
Parents: 8d5c78e
Author: Vijay Venkatachalam <vijay.venkatachalam@citrix.com>
Authored: Wed Nov 14 15:33:38 2012 +0530
Committer: Vijay Venkatachalam <vijay.venkatachalam@citrix.com>
Committed: Fri Nov 16 11:07:24 2012 +0530

----------------------------------------------------------------------
 .../com/cloud/api/response/ConditionResponse.java  |    8 +-
 server/src/com/cloud/api/ApiResponseHelper.java    |   80 +++++++-------
 2 files changed, 45 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/aea87da4/api/src/com/cloud/api/response/ConditionResponse.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/response/ConditionResponse.java b/api/src/com/cloud/api/response/ConditionResponse.java
index 0ed8f3d..a68e179 100644
--- a/api/src/com/cloud/api/response/ConditionResponse.java
+++ b/api/src/com/cloud/api/response/ConditionResponse.java
@@ -17,6 +17,8 @@
 
 package com.cloud.api.response;
 
+import java.util.List;
+
 import com.cloud.api.ApiConstants;
 import com.cloud.serializer.Param;
 import com.cloud.utils.IdentityProxy;
@@ -38,7 +40,7 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR
 
     @SerializedName("counter")
     @Param(description = "Details of the Counter.")
-    private CounterResponse counter;
+    private List<CounterResponse> counterResponse;
 
     @SerializedName(ApiConstants.DOMAIN_ID)
     @Param(description = "the domain id of the Condition owner")
@@ -80,8 +82,8 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR
         this.relationalOperator = relationalOperator;
     }
 
-    public void setCounter(CounterResponse counter) {
-        this.counter = counter;
+    public void setCounterResponse(List<CounterResponse> counterResponse) {
+        this.counterResponse = counterResponse;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/aea87da4/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index bd54f47..ebe8415 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -1071,28 +1071,28 @@ public class ApiResponseHelper implements ResponseGenerator {
 
         volResponse.setVolumeType(volume.getVolumeType().toString());
         volResponse.setDeviceId(volume.getDeviceId());
-
-        Long instanceId = volume.getInstanceId();
-        if (instanceId != null && volume.getState() != Volume.State.Destroy) {
-            VMInstanceVO vm = ApiDBUtils.findVMInstanceById(instanceId);
-            if (vm != null) {
-                volResponse.setVirtualMachineId(vm.getId());
-                volResponse.setVirtualMachineName(vm.getHostName());
-                UserVm userVm = ApiDBUtils.findUserVmById(vm.getId());
-                if (userVm != null) {
-                    if (userVm.getDisplayName() != null) {
-                        volResponse.setVirtualMachineDisplayName(userVm.getDisplayName());
-                    } else {
-                        volResponse.setVirtualMachineDisplayName(userVm.getHostName());
-                    }
-                    volResponse.setVirtualMachineState(vm.getState().toString());
-                } else {
-                    s_logger.error("User Vm with Id: " + instanceId + " does not exist for
volume " + volume.getId());
-                }
-            } else {
-                s_logger.error("Vm with Id: " + instanceId + " does not exist for volume
" + volume.getId());
-            }
-        }
+        
+        	Long instanceId = volume.getInstanceId();
+	        if (instanceId != null && volume.getState() != Volume.State.Destroy) {
+	            VMInstanceVO vm = ApiDBUtils.findVMInstanceById(instanceId);
+	            if (vm != null) {
+	                volResponse.setVirtualMachineId(vm.getId());
+	                volResponse.setVirtualMachineName(vm.getHostName());
+	                UserVm userVm = ApiDBUtils.findUserVmById(vm.getId());
+	                if (userVm != null) {
+	                    if (userVm.getDisplayName() != null) {
+	                        volResponse.setVirtualMachineDisplayName(userVm.getDisplayName());
+	                    } else {
+	                        volResponse.setVirtualMachineDisplayName(userVm.getHostName());
+	                    }
+	                    volResponse.setVirtualMachineState(vm.getState().toString());
+	                } else {
+	                    s_logger.error("User Vm with Id: " + instanceId + " does not exist for
volume " + volume.getId());
+	                }
+	            } else {
+	                s_logger.error("Vm with Id: " + instanceId + " does not exist for volume
" + volume.getId());
+	            }
+	        }
 
         // Show the virtual size of the volume
         volResponse.setSize(volume.getSize());
@@ -1166,22 +1166,22 @@ public class ApiResponseHelper implements ResponseGenerator {
 
         volResponse.setAttached(volume.getAttached());
         volResponse.setDestroyed(volume.getState() == Volume.State.Destroy);
-        boolean isExtractable = true;
-        if (volume.getVolumeType() != Volume.Type.DATADISK) { // Datadisk dont have any template
dependence.
-            VMTemplateVO template = ApiDBUtils.findTemplateById(volume.getTemplateId());
+	        boolean isExtractable = true;
+	        if (volume.getVolumeType() != Volume.Type.DATADISK) { // Datadisk dont have any
template dependence.
+	            VMTemplateVO template = ApiDBUtils.findTemplateById(volume.getTemplateId());
             if (template != null) { // For ISO based volumes template = null and we allow
extraction of all ISO based volumes
-                isExtractable = template.isExtractable() && template.getTemplateType()
!= Storage.TemplateType.SYSTEM;
-            }
-        }
-
-        //set tag information
-        List<? extends ResourceTag> tags = ApiDBUtils.listByResourceTypeAndId(TaggedResourceType.Volume,
volume.getId());
-        List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
-        for (ResourceTag tag : tags) {
-            ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
-            tagResponses.add(tagResponse);
-        }
-        volResponse.setTags(tagResponses);
+	                isExtractable = template.isExtractable() && template.getTemplateType()
!= Storage.TemplateType.SYSTEM;
+	            }
+	        }
+	
+	        //set tag information
+	        List<? extends ResourceTag> tags = ApiDBUtils.listByResourceTypeAndId(TaggedResourceType.Volume,
volume.getId());
+	        List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
+	        for (ResourceTag tag : tags) {
+	            ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
+	            tagResponses.add(tagResponse);
+	        }
+	        volResponse.setTags(tagResponses);
 
         volResponse.setExtractable(isExtractable);
         volResponse.setObjectName("volume");
@@ -3841,9 +3841,9 @@ public class ApiResponseHelper implements ResponseGenerator {
     public ConditionResponse createConditionResponse(Condition condition) {
         ConditionResponse response = new ConditionResponse();
         response.setId(condition.getId());
-        CounterResponse counter;
-        counter = createCounterResponse(ApiDBUtils.getCounter(condition.getCounterid()));
-        response.setCounter(counter);
+        List<CounterResponse> counterResponseList = new ArrayList<CounterResponse>();
+        counterResponseList.add(createCounterResponse(ApiDBUtils.getCounter(condition.getCounterid())));
+        response.setCounterResponse(counterResponseList);
         response.setRelationalOperator(condition.getRelationalOperator().toString());
         response.setThreshold(condition.getThreshold());
         response.setObjectName("condition");


Mime
View raw message