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

This commit is contained in:
Vijay Venkatachalam 2012-09-11 21:40:09 +05:30
parent 8c681746b9
commit acb963f1ee
5 changed files with 29 additions and 5 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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")

View File

@ -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);