mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-17 02:53:18 +01:00
Added action events for Ip and net rules
This commit is contained in:
parent
577fdd2c26
commit
5bedf10cbf
@ -137,7 +137,8 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Por
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return ("Creating an ipforwarding 1:1 NAT rule for "+ipAddressId+" with virtual machine:"+ getVirtualMachineId());
|
IpAddress ip = _networkService.getIp(ipAddressId);
|
||||||
|
return ("Applying an ipforwarding 1:1 NAT rule for Ip: "+ip.getAddress()+" with virtual machine:"+ getVirtualMachineId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -214,7 +214,8 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEventDescription() {
|
public String getEventDescription() {
|
||||||
return ("Creating an port forwarding rule for "+ipAddressId+" with virtual machine:"+virtualMachineId);
|
IpAddress ip = _networkService.getIp(ipAddressId);
|
||||||
|
return ("Applying port forwarding rule for Ip: "+ip.getAddress()+" with virtual machine:"+virtualMachineId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -65,6 +65,7 @@ import com.cloud.deploy.DeployDestination;
|
|||||||
import com.cloud.deploy.DeploymentPlan;
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
import com.cloud.domain.Domain;
|
import com.cloud.domain.Domain;
|
||||||
import com.cloud.domain.dao.DomainDao;
|
import com.cloud.domain.dao.DomainDao;
|
||||||
|
import com.cloud.event.ActionEvent;
|
||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
import com.cloud.event.UsageEventVO;
|
import com.cloud.event.UsageEventVO;
|
||||||
import com.cloud.event.dao.EventDao;
|
import com.cloud.event.dao.EventDao;
|
||||||
@ -484,8 +485,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
return _networksDao.listBy(owner.getId(), zoneId, GuestIpType.Virtual);
|
return _networksDao.listBy(owner.getId(), zoneId, GuestIpType.Virtual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @DB @ActionEvent (eventType=EventTypes.EVENT_NET_IP_ASSIGN, eventDescription="allocating Ip", create=true)
|
||||||
@DB
|
|
||||||
public IpAddress allocateIP(AssociateIPAddrCmd cmd) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
|
public IpAddress allocateIP(AssociateIPAddrCmd cmd) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||||
String accountName = cmd.getAccountName();
|
String accountName = cmd.getAccountName();
|
||||||
long domainId = cmd.getDomainId();
|
long domainId = cmd.getDomainId();
|
||||||
@ -558,7 +558,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @DB @ActionEvent (eventType=EventTypes.EVENT_NET_IP_ASSIGN, eventDescription="associating Ip", async=true)
|
||||||
public IpAddress associateIP(AssociateIPAddrCmd cmd) throws ResourceAllocationException, ResourceUnavailableException, InsufficientAddressCapacityException, ConcurrentOperationException {
|
public IpAddress associateIP(AssociateIPAddrCmd cmd) throws ResourceAllocationException, ResourceUnavailableException, InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||||
Account caller = UserContext.current().getCaller();
|
Account caller = UserContext.current().getCaller();
|
||||||
Account owner = null;
|
Account owner = null;
|
||||||
@ -1196,8 +1196,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
return profiles;
|
return profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @DB @ActionEvent (eventType=EventTypes.EVENT_NET_IP_RELEASE, eventDescription="disassociating Ip")
|
||||||
@DB
|
|
||||||
public boolean disassociateIpAddress(DisassociateIPAddrCmd cmd) throws PermissionDeniedException, IllegalArgumentException {
|
public boolean disassociateIpAddress(DisassociateIPAddrCmd cmd) throws PermissionDeniedException, IllegalArgumentException {
|
||||||
|
|
||||||
Long userId = UserContext.current().getCallerUserId();
|
Long userId = UserContext.current().getCallerUserId();
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
import com.cloud.agent.api.to.PortForwardingRuleTO;
|
import com.cloud.agent.api.to.PortForwardingRuleTO;
|
||||||
import com.cloud.api.commands.ListPortForwardingRulesCmd;
|
import com.cloud.api.commands.ListPortForwardingRulesCmd;
|
||||||
|
import com.cloud.event.ActionEvent;
|
||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
import com.cloud.event.UsageEventVO;
|
import com.cloud.event.UsageEventVO;
|
||||||
import com.cloud.event.dao.EventDao;
|
import com.cloud.event.dao.EventDao;
|
||||||
@ -170,7 +171,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override @DB
|
@Override @DB @ActionEvent (eventType=EventTypes.EVENT_NET_RULE_ADD, eventDescription="creating forwarding rule", create=true)
|
||||||
public PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, boolean isNat) throws NetworkRuleConflictException {
|
public PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, boolean isNat) throws NetworkRuleConflictException {
|
||||||
UserContext ctx = UserContext.current();
|
UserContext ctx = UserContext.current();
|
||||||
Account caller = ctx.getCaller();
|
Account caller = ctx.getCaller();
|
||||||
@ -347,7 +348,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
|
|||||||
txn.commit();
|
txn.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @ActionEvent (eventType=EventTypes.EVENT_NET_RULE_DELETE, eventDescription="revoking forwarding rule", async=true)
|
||||||
public boolean revokePortForwardingRule(long ruleId, boolean apply) {
|
public boolean revokePortForwardingRule(long ruleId, boolean apply) {
|
||||||
UserContext ctx = UserContext.current();
|
UserContext ctx = UserContext.current();
|
||||||
Account caller = ctx.getCaller();
|
Account caller = ctx.getCaller();
|
||||||
@ -511,7 +512,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
|
|||||||
return _forwardingDao.searchNatRules(ipId, id, vmId, start, size);
|
return _forwardingDao.searchNatRules(ipId, id, vmId, start, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @ActionEvent (eventType=EventTypes.EVENT_NET_RULE_ADD, eventDescription="applying forwarding rule", async=true)
|
||||||
public boolean applyPortForwardingRules(long ipId, Account caller) throws ResourceUnavailableException {
|
public boolean applyPortForwardingRules(long ipId, Account caller) throws ResourceUnavailableException {
|
||||||
return applyPortForwardingRules(ipId, false, caller);
|
return applyPortForwardingRules(ipId, false, caller);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user