diff --git a/api/src/com/cloud/api/commands/AddNetworkServiceProviderCmd.java b/api/src/com/cloud/api/commands/AddNetworkServiceProviderCmd.java index 131f6673a70..88bb755937b 100644 --- a/api/src/com/cloud/api/commands/AddNetworkServiceProviderCmd.java +++ b/api/src/com/cloud/api/commands/AddNetworkServiceProviderCmd.java @@ -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; + } } diff --git a/api/src/com/cloud/api/commands/AddTrafficTypeCmd.java b/api/src/com/cloud/api/commands/AddTrafficTypeCmd.java index 41117b59650..747800835e9 100644 --- a/api/src/com/cloud/api/commands/AddTrafficTypeCmd.java +++ b/api/src/com/cloud/api/commands/AddTrafficTypeCmd.java @@ -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; + } } diff --git a/api/src/com/cloud/api/commands/DeleteNetworkServiceProviderCmd.java b/api/src/com/cloud/api/commands/DeleteNetworkServiceProviderCmd.java index 1c03653940f..60d0d191c75 100644 --- a/api/src/com/cloud/api/commands/DeleteNetworkServiceProviderCmd.java +++ b/api/src/com/cloud/api/commands/DeleteNetworkServiceProviderCmd.java @@ -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; + } } diff --git a/api/src/com/cloud/api/commands/DeleteTrafficTypeCmd.java b/api/src/com/cloud/api/commands/DeleteTrafficTypeCmd.java index f1bc2bebaac..81bc8bb22dc 100644 --- a/api/src/com/cloud/api/commands/DeleteTrafficTypeCmd.java +++ b/api/src/com/cloud/api/commands/DeleteTrafficTypeCmd.java @@ -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; + } } diff --git a/api/src/com/cloud/api/commands/UpdateNetworkServiceProviderCmd.java b/api/src/com/cloud/api/commands/UpdateNetworkServiceProviderCmd.java index 8ad3e5b9e9b..f98a2fc6362 100644 --- a/api/src/com/cloud/api/commands/UpdateNetworkServiceProviderCmd.java +++ b/api/src/com/cloud/api/commands/UpdateNetworkServiceProviderCmd.java @@ -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; + } } diff --git a/api/src/com/cloud/api/commands/UpdateTrafficTypeCmd.java b/api/src/com/cloud/api/commands/UpdateTrafficTypeCmd.java index d93654ea9a3..299aef0f429 100644 --- a/api/src/com/cloud/api/commands/UpdateTrafficTypeCmd.java +++ b/api/src/com/cloud/api/commands/UpdateTrafficTypeCmd.java @@ -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; + } } diff --git a/api/src/com/cloud/api/response/AsyncJobResponse.java b/api/src/com/cloud/api/response/AsyncJobResponse.java index 40d9a2c4548..6719542a47b 100644 --- a/api/src/com/cloud/api/response/AsyncJobResponse.java +++ b/api/src/com/cloud/api/response/AsyncJobResponse.java @@ -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); } diff --git a/api/src/com/cloud/async/AsyncJob.java b/api/src/com/cloud/async/AsyncJob.java index 8004c84b042..b462eaf3fd4 100644 --- a/api/src/com/cloud/async/AsyncJob.java +++ b/api/src/com/cloud/async/AsyncJob.java @@ -36,7 +36,9 @@ public interface AsyncJob extends Identity { StoragePool, IpAddress, SecurityGroup, - PhysicalNetwork + PhysicalNetwork, + TrafficType, + PhysicalNetworkServiceProvider } Long getId();