VPC: fixed getEntityOwnerId() in AssociateIpAddress command to return vpc owner 
if vpcId is passed in. Added action events for create/delete 
privateGateway/staticRoutes


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/1140f081
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/1140f081
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/1140f081

Branch: refs/heads/vpc
Commit: 1140f081df15c8efbb04d1ed8d2277cc835e342d
Parents: a78fced
Author: Alena Prokharchyk <[email protected]>
Authored: Tue Jun 26 14:07:25 2012 -0700
Committer: Alena Prokharchyk <[email protected]>
Committed: Thu Jun 28 10:13:36 2012 -0700

----------------------------------------------------------------------
 .../com/cloud/api/commands/AssociateIPAddrCmd.java |    7 ++++++-
 .../src/com/cloud/network/vpc/VpcManagerImpl.java  |    8 ++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1140f081/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java 
b/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java
index 7b8e41d..75044cc 100644
--- a/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java
+++ b/api/src/com/cloud/api/commands/AssociateIPAddrCmd.java
@@ -175,10 +175,15 @@ public class AssociateIPAddrCmd extends 
BaseAsyncCreateCmd {
        if (accountName != null && domainId != null) {
                Account account = _accountService.finalizeOwner(caller, 
accountName, domainId, projectId);
                return account.getId();
-       } else {
+       } else if (getNetworkId() != null){
                Network network = _networkService.getNetwork(getNetworkId());
             return network.getAccountId();
+       } else if (vpcId != null) {
+           Vpc vpc = _vpcService.getVpc(getVpcId());
+           return vpc.getAccountId();
        }
+       
+       throw new InvalidParameterValueException("Failed to determine ip 
owner");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1140f081/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java 
b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index 0eeb47a..210fcb7 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -175,7 +175,7 @@ public class VpcManagerImpl implements VpcManager, Manager{
     }
 
     @Override
-    @ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_CREATE, 
eventDescription = "creating vpc offering")
+    @ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_CREATE, 
eventDescription = "creating vpc offering", create=true)
     public VpcOffering createVpcOffering(String name, String displayText, 
List<String> supportedServices) {
         Map<Network.Service, Set<Network.Provider>> svcProviderMap = new 
HashMap<Network.Service, Set<Network.Provider>>();
         Set<Network.Provider> defaultProviders = new 
HashSet<Network.Provider>();
@@ -428,7 +428,7 @@ public class VpcManagerImpl implements VpcManager, Manager{
     }
 
     @Override
-    @ActionEvent(eventType = EventTypes.EVENT_VPC_CREATE, eventDescription = 
"creating vpc")
+    @ActionEvent(eventType = EventTypes.EVENT_VPC_CREATE, eventDescription = 
"creating vpc", create=true)
     public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String 
vpcName, String displayText, String cidr, 
             String networkDomain) {
         Account caller = UserContext.current().getCaller();
@@ -952,6 +952,7 @@ public class VpcManagerImpl implements VpcManager, Manager{
 
     @Override
     @DB
+    @ActionEvent(eventType = EventTypes.EVENT_PRIVATE_GATEWAY_CREATE, 
eventDescription = "creating vpc private gateway", create=true)
     public PrivateGateway createVpcPrivateGateway(long vpcId, Long 
physicalNetworkId, String vlan, String ipAddress, 
             String gateway, String netmask, long gatewayOwnerId) throws 
ResourceAllocationException, 
             ConcurrentOperationException, InsufficientCapacityException {
@@ -1011,6 +1012,7 @@ public class VpcManagerImpl implements VpcManager, 
Manager{
     }
 
     @Override
+    @ActionEvent(eventType = EventTypes.EVENT_PRIVATE_GATEWAY_DELETE, 
eventDescription = "deleting private gateway")
     public boolean deleteVpcPrivateGateway(Long gatewayId) throws 
ConcurrentOperationException, ResourceUnavailableException {
         VpcGatewayVO gatewayVO = _vpcGatewayDao.findById(gatewayId);
         if (gatewayVO == null || gatewayVO.getType() != 
VpcGateway.Type.Private) {
@@ -1165,6 +1167,7 @@ public class VpcManagerImpl implements VpcManager, 
Manager{
     }
 
     @Override
+    @ActionEvent(eventType = EventTypes.EVENT_STATIC_ROUTE_DELETE, 
eventDescription = "deleting static route")
     public boolean revokeStaticRoute(long routeId) throws 
ResourceUnavailableException {
         Account caller = UserContext.current().getCaller();
         
@@ -1183,6 +1186,7 @@ public class VpcManagerImpl implements VpcManager, 
Manager{
 
     @Override
     @DB
+    @ActionEvent(eventType = EventTypes.EVENT_STATIC_ROUTE_CREATE, 
eventDescription = "creating static route", create=true)
     public StaticRoute createStaticRoute(long gatewayId, String cidr) throws 
NetworkRuleConflictException {
         Account caller = UserContext.current().getCaller();
         

Reply via email to