You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2012/09/11 18:10:39 UTC

git commit: CS-15783: Creating mapping between job ids and autoscale entity ids

Updated Branches:
  refs/heads/autoscale 4458e4076 -> fe72590fc


CS-15783: Creating mapping between job ids and autoscale entity ids


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

Branch: refs/heads/autoscale
Commit: fe72590fcdefa392c6d94605c9c6f7dae7617c8e
Parents: 4458e40
Author: Vijay Venkatachalam <vi...@citrix.com>
Authored: Tue Sep 11 21:40:09 2012 +0530
Committer: Pranav Saxena <pr...@citrix.com>
Committed: Tue Sep 11 21:40:09 2012 +0530

----------------------------------------------------------------------
 .../api/commands/DeleteAutoScaleVmGroupCmd.java    |    4 ++--
 .../api/commands/DisableAutoScaleVmGroupCmd.java   |    7 +++++++
 .../api/commands/EnableAutoScaleVmGroupCmd.java    |    6 ++++++
 .../api/commands/ListAutoScalePoliciesCmd.java     |    2 +-
 .../com/cloud/api/response/AsyncJobResponse.java   |   15 +++++++++++++--
 5 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe72590f/api/src/com/cloud/api/commands/DeleteAutoScaleVmGroupCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteAutoScaleVmGroupCmd.java b/api/src/com/cloud/api/commands/DeleteAutoScaleVmGroupCmd.java
index b97d734..0acc09f 100644
--- a/api/src/com/cloud/api/commands/DeleteAutoScaleVmGroupCmd.java
+++ b/api/src/com/cloud/api/commands/DeleteAutoScaleVmGroupCmd.java
@@ -69,7 +69,7 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd {
         }
 
         return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are
-// tracked
+        // tracked
     }
 
     @Override
@@ -98,6 +98,6 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd {
 
     @Override
     public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.AutoScalePolicy;
+        return AsyncJob.Type.AutoScaleVmGroup;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe72590f/api/src/com/cloud/api/commands/DisableAutoScaleVmGroupCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DisableAutoScaleVmGroupCmd.java b/api/src/com/cloud/api/commands/DisableAutoScaleVmGroupCmd.java
index fa90fff..bd37d0a 100644
--- a/api/src/com/cloud/api/commands/DisableAutoScaleVmGroupCmd.java
+++ b/api/src/com/cloud/api/commands/DisableAutoScaleVmGroupCmd.java
@@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
 import com.cloud.api.Parameter;
 import com.cloud.api.ServerApiException;
 import com.cloud.api.response.AutoScaleVmGroupResponse;
+import com.cloud.async.AsyncJob;
 import com.cloud.event.EventTypes;
 import com.cloud.network.as.AutoScaleVmGroup;
 import com.cloud.user.Account;
@@ -92,4 +93,10 @@ public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd {
     public String getEventDescription() {
         return "Disabling AutoScale Vm Group. Vm Group Id: " + getId();
     }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.AutoScaleVmGroup;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe72590f/api/src/com/cloud/api/commands/EnableAutoScaleVmGroupCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/EnableAutoScaleVmGroupCmd.java b/api/src/com/cloud/api/commands/EnableAutoScaleVmGroupCmd.java
index 4b4d1c3..dee1d27 100644
--- a/api/src/com/cloud/api/commands/EnableAutoScaleVmGroupCmd.java
+++ b/api/src/com/cloud/api/commands/EnableAutoScaleVmGroupCmd.java
@@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
 import com.cloud.api.Parameter;
 import com.cloud.api.ServerApiException;
 import com.cloud.api.response.AutoScaleVmGroupResponse;
+import com.cloud.async.AsyncJob;
 import com.cloud.event.EventTypes;
 import com.cloud.network.as.AutoScaleVmGroup;
 import com.cloud.user.Account;
@@ -93,4 +94,9 @@ public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd {
         return "Enabling AutoScale Vm Group. Vm Group Id: "+getId();
     }
 
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.AutoScaleVmGroup;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe72590f/api/src/com/cloud/api/commands/ListAutoScalePoliciesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListAutoScalePoliciesCmd.java b/api/src/com/cloud/api/commands/ListAutoScalePoliciesCmd.java
index 1d61641..edab908 100644
--- a/api/src/com/cloud/api/commands/ListAutoScalePoliciesCmd.java
+++ b/api/src/com/cloud/api/commands/ListAutoScalePoliciesCmd.java
@@ -48,7 +48,7 @@ public class ListAutoScalePoliciesCmd extends BaseListAccountResourcesCmd {
     @Parameter(name = ApiConstants.CONDITION_ID, type = CommandType.LONG, description = "the ID of the condition of the policy")
     private Long conditionId;
 
-    @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, required = true, description = "the action to be executed if all the conditions evaluate to true for the specified duration.")
+    @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "the action to be executed if all the conditions evaluate to true for the specified duration.")
     private String action;
 
     @IdentityMapper(entityTableName="autoscale_vmgroups")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fe72590f/api/src/com/cloud/api/response/AsyncJobResponse.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/response/AsyncJobResponse.java b/api/src/com/cloud/api/response/AsyncJobResponse.java
index 3644595..8cfe3f0 100644
--- a/api/src/com/cloud/api/response/AsyncJobResponse.java
+++ b/api/src/com/cloud/api/response/AsyncJobResponse.java
@@ -5,7 +5,7 @@
 // to you under the Apache License, Version 2.0 (the
 // "License"); you may not use this file except in compliance
 // with the License.  You may obtain a copy of the License at
-//
+// 
 //   http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing,
@@ -75,6 +75,7 @@ public class AsyncJobResponse extends BaseResponse {
         this.cmd = cmd;
     }
 
+    @Override
     public void setJobStatus(Integer jobStatus) {
         this.jobStatus = jobStatus;
     }
@@ -119,7 +120,7 @@ public class AsyncJobResponse extends BaseResponse {
         		this.jobInstanceId.setTableName("security_group");
         	} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.PhysicalNetwork.toString())) {
         		this.jobInstanceId.setTableName("physical_network");
-            } else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.TrafficType.toString())) {
+        	} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.TrafficType.toString())) {
                 this.jobInstanceId.setTableName("physical_network_traffic_types");
             } else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.PhysicalNetworkServiceProvider.toString())) {
                 this.jobInstanceId.setTableName("physical_network_service_providers");
@@ -129,6 +130,16 @@ public class AsyncJobResponse extends BaseResponse {
                 this.jobInstanceId.setTableName("account");
             } else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.User.toString())) {
                 this.jobInstanceId.setTableName("user");
+            }else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Counter.toString())) {
+                this.jobInstanceId.setTableName("counter");
+            } else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Condition.toString())) {
+                this.jobInstanceId.setTableName("conditions");
+            } else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.AutoScalePolicy.toString())) {
+                this.jobInstanceId.setTableName("autoscale_policies");
+            } else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.AutoScaleVmProfile.toString())) {
+                this.jobInstanceId.setTableName("autoscale_vmprofiles");
+            } else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.AutoScaleVmGroup.toString())) {
+                this.jobInstanceId.setTableName("autoscale_vmgroups");
             } else if (!jobInstanceType.equalsIgnoreCase(AsyncJob.Type.None.toString())){
         		// TODO : when we hit here, we need to add instanceType -> UUID entity table mapping
         		assert(false);