From b82fac179a5d3cde5bb4642d3bff37bbcdc9126b Mon Sep 17 00:00:00 2001 From: kishan Date: Mon, 6 Jun 2011 13:32:46 +0530 Subject: [PATCH] bug 9785: Added Vlan Assign Release events status 9785: resolved fixed --- api/src/com/cloud/event/EventTypes.java | 3 +++ server/src/com/cloud/network/guru/GuestNetworkGuru.java | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java index 4c1d5c76622..096c56c6601 100755 --- a/api/src/com/cloud/event/EventTypes.java +++ b/api/src/com/cloud/event/EventTypes.java @@ -196,4 +196,7 @@ public class EventTypes { public static final String EVENT_ENABLE_STATIC_NAT = "STATICNAT.ENABLE"; public static final String EVENT_DISABLE_STATIC_NAT = "STATICNAT.DISABLE"; + public static final String EVENT_ZONE_VLAN_ASSIGN = "ZONE.VLAN.ASSIGN"; + public static final String EVENT_ZONE_VLAN_RELEASE = "ZONE.VLAN.RELEASE"; + } diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java index de9dd38cebd..bd290290863 100644 --- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java +++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java @@ -32,6 +32,9 @@ import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.VlanDao; import com.cloud.deploy.DeployDestination; import com.cloud.deploy.DeploymentPlan; +import com.cloud.event.EventTypes; +import com.cloud.event.EventUtils; +import com.cloud.event.EventVO; import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.InsufficientVirtualNetworkCapcityException; import com.cloud.exception.InvalidParameterValueException; @@ -48,6 +51,7 @@ import com.cloud.network.Networks.TrafficType; import com.cloud.network.dao.NetworkDao; import com.cloud.offering.NetworkOffering; import com.cloud.user.Account; +import com.cloud.user.UserContext; import com.cloud.utils.component.AdapterBase; import com.cloud.utils.component.Inject; import com.cloud.utils.db.DB; @@ -155,6 +159,7 @@ public class GuestNetworkGuru extends AdapterBase implements NetworkGuru { throw new InsufficientVirtualNetworkCapcityException("Unable to allocate vnet as a part of network " + network + " implement ", DataCenter.class, dcId); } implemented.setBroadcastUri(BroadcastDomainType.Vlan.toUri(vnet)); + EventUtils.saveEvent(UserContext.current().getCallerUserId(), network.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_ZONE_VLAN_ASSIGN, "Assignbed Zone Vlan: "+vnet+ " Network Id: "+network.getId(), 0); } else { implemented.setBroadcastUri(network.getBroadcastUri()); } @@ -166,7 +171,6 @@ public class GuestNetworkGuru extends AdapterBase implements NetworkGuru { if (network.getCidr() != null) { implemented.setCidr(network.getCidr()); } - return implemented; } @@ -261,6 +265,8 @@ public class GuestNetworkGuru extends AdapterBase implements NetworkGuru { s_logger.debug("Releasing vnet for the network id=" + profile.getId()); if (profile.getBroadcastUri() != null) { _dcDao.releaseVnet(profile.getBroadcastUri().getHost(), profile.getDataCenterId(), profile.getAccountId(), profile.getReservationId()); + EventUtils.saveEvent(UserContext.current().getCallerUserId(), profile.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_ZONE_VLAN_RELEASE, "Released Zone Vlan: " + +profile.getBroadcastUri().getHost()+" for Network: "+profile.getId(), 0); profile.setBroadcastUri(null); } }