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/acb963f1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/acb963f1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/acb963f1 Branch: refs/heads/master Commit: acb963f1eedff2e5c48695f5d731f906275844f2 Parents: 8c68174 Author: Vijay Venkatachalam <[email protected]> Authored: Tue Sep 11 21:40:09 2012 +0530 Committer: Vijay Venkatachalam <[email protected]> Committed: Fri Nov 16 10:56:56 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/acb963f1/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/acb963f1/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/acb963f1/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/acb963f1/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/acb963f1/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 9f18f65..45aee12 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, @@ -73,6 +73,7 @@ public class AsyncJobResponse extends BaseResponse { this.cmd = cmd; } + @Override public void setJobStatus(Integer jobStatus) { this.jobStatus = jobStatus; } @@ -117,7 +118,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"); @@ -131,6 +132,16 @@ public class AsyncJobResponse extends BaseResponse { this.jobInstanceId.setTableName("static_routes"); } else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.PrivateGateway.toString())) { this.jobInstanceId.setTableName("vpc_gateways"); + }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);
