Added instanceType to some async commands related to physical network

Reviewed-By: Alena Prokharchyk
This commit is contained in:
prachi 2012-02-14 15:44:22 -08:00
parent 5c7424fb0e
commit a210d450d0
8 changed files with 42 additions and 5 deletions

View File

@ -30,6 +30,7 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ProviderResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.PhysicalNetworkServiceProvider;
@ -131,4 +132,9 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
public String getEventDescription() {
return "Adding physical network ServiceProvider: " + getEntityId();
}
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.PhysicalNetworkServiceProvider;
}
}

View File

@ -28,6 +28,7 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.TrafficTypeResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.PhysicalNetworkTrafficType;
@ -151,4 +152,9 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
public String getEventDescription() {
return "Adding physical network traffic type: " + getEntityId();
}
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.TrafficType;
}
}

View File

@ -28,6 +28,7 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ResourceUnavailableException;
@ -101,4 +102,9 @@ public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "Deleting Physical network ServiceProvider: " + getId();
}
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.PhysicalNetworkServiceProvider;
}
}

View File

@ -28,6 +28,7 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@ -88,5 +89,9 @@ public class DeleteTrafficTypeCmd extends BaseAsyncCmd {
return EventTypes.EVENT_TRAFFIC_TYPE_DELETE;
}
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.TrafficType;
}
}

View File

@ -30,6 +30,7 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ProviderResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.user.Account;
@ -103,5 +104,10 @@ public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd {
public String getEventDescription() {
return "Updating physical network ServiceProvider: " + getId();
}
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.PhysicalNetworkServiceProvider;
}
}

View File

@ -28,6 +28,7 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.TrafficTypeResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.user.Account;
@ -111,5 +112,8 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd {
return EventTypes.EVENT_TRAFFIC_TYPE_UPDATE;
}
@Override
public AsyncJob.Type getInstanceType() {
return AsyncJob.Type.TrafficType;
}
}

View File

@ -19,8 +19,6 @@ package com.cloud.api.response;
import java.util.Date;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.IdentityProxy;
import com.cloud.api.ResponseObject;
@ -119,7 +117,11 @@ 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.None.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");
} else if (!jobInstanceType.equalsIgnoreCase(AsyncJob.Type.None.toString())){
// TODO : when we hit here, we need to add instanceType -> UUID entity table mapping
assert(false);
}

View File

@ -36,7 +36,9 @@ public interface AsyncJob extends Identity {
StoragePool,
IpAddress,
SecurityGroup,
PhysicalNetwork
PhysicalNetwork,
TrafficType,
PhysicalNetworkServiceProvider
}
Long getId();