mirror of https://github.com/apache/cloudstack.git
CS-15783 On a AutoScaleVmGroup creation, the asynchronous jobs cannot be listed momentorily.
This happened because of an assert to introduce the mapping between job instance and instance id. Have done it in AsyncJobReponse. Also,updated JobInstance type in VmGroup commands.
This commit is contained in:
parent
1dc3a3910c
commit
fcb3076375
|
|
@ -65,7 +65,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
|
||||
|
|
@ -94,6 +94,6 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.AutoScalePolicy;
|
||||
return AsyncJob.Type.AutoScaleVmGroup;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,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")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.api.response;
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ public class AsyncJobResponse extends BaseResponse {
|
|||
|
||||
@SerializedName("jobresult") @Param(description="the result reason")
|
||||
private ResponseObject jobResult;
|
||||
|
||||
|
||||
@SerializedName("jobinstancetype") @Param(description="the instance/entity object related to the job")
|
||||
private String jobInstanceType;
|
||||
|
||||
|
|
@ -71,6 +71,7 @@ public class AsyncJobResponse extends BaseResponse {
|
|||
this.cmd = cmd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJobStatus(Integer jobStatus) {
|
||||
this.jobStatus = jobStatus;
|
||||
}
|
||||
|
|
@ -95,45 +96,55 @@ public class AsyncJobResponse extends BaseResponse {
|
|||
this.jobInstanceType = jobInstanceType;
|
||||
|
||||
if(jobInstanceType != null) {
|
||||
if(jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Volume.toString())) {
|
||||
this.jobInstanceId.setTableName("volumes");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Template.toString())) {
|
||||
this.jobInstanceId.setTableName("vm_template");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Iso.toString())) {
|
||||
this.jobInstanceId.setTableName("vm_template");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.VirtualMachine.toString()) || jobInstanceType.equalsIgnoreCase(AsyncJob.Type.ConsoleProxy.toString()) || jobInstanceType.equalsIgnoreCase(AsyncJob.Type.SystemVm.toString()) || jobInstanceType.equalsIgnoreCase(AsyncJob.Type.DomainRouter.toString()) ) {
|
||||
this.jobInstanceId.setTableName("vm_instance");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Snapshot.toString())) {
|
||||
this.jobInstanceId.setTableName("snapshots");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Host.toString())) {
|
||||
this.jobInstanceId.setTableName("host");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.StoragePool.toString())) {
|
||||
this.jobInstanceId.setTableName("storage_pool");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.IpAddress.toString())) {
|
||||
this.jobInstanceId.setTableName("user_ip_address");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.SecurityGroup.toString())) {
|
||||
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())) {
|
||||
if(jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Volume.toString())) {
|
||||
this.jobInstanceId.setTableName("volumes");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Template.toString())) {
|
||||
this.jobInstanceId.setTableName("vm_template");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Iso.toString())) {
|
||||
this.jobInstanceId.setTableName("vm_template");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.VirtualMachine.toString()) || jobInstanceType.equalsIgnoreCase(AsyncJob.Type.ConsoleProxy.toString()) || jobInstanceType.equalsIgnoreCase(AsyncJob.Type.SystemVm.toString()) || jobInstanceType.equalsIgnoreCase(AsyncJob.Type.DomainRouter.toString()) ) {
|
||||
this.jobInstanceId.setTableName("vm_instance");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Snapshot.toString())) {
|
||||
this.jobInstanceId.setTableName("snapshots");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Host.toString())) {
|
||||
this.jobInstanceId.setTableName("host");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.StoragePool.toString())) {
|
||||
this.jobInstanceId.setTableName("storage_pool");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.IpAddress.toString())) {
|
||||
this.jobInstanceId.setTableName("user_ip_address");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.SecurityGroup.toString())) {
|
||||
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())) {
|
||||
this.jobInstanceId.setTableName("physical_network_traffic_types");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.PhysicalNetworkServiceProvider.toString())) {
|
||||
this.jobInstanceId.setTableName("physical_network_service_providers");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.FirewallRule.toString())) {
|
||||
this.jobInstanceId.setTableName("firewall_rules");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Account.toString())) {
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.FirewallRule.toString())) {
|
||||
this.jobInstanceId.setTableName("firewall_rules");
|
||||
} else if (jobInstanceType.equalsIgnoreCase(AsyncJob.Type.Account.toString())) {
|
||||
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);
|
||||
}
|
||||
// TODO : when we hit here, we need to add instanceType -> UUID entity table mapping
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setJobInstanceId(Long jobInstanceId) {
|
||||
this.jobInstanceId.setValue(jobInstanceId);
|
||||
this.jobInstanceId.setValue(jobInstanceId);
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue