cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [1/3] git commit: updated refs/heads/internallb to f4c2b53
Date Thu, 11 Apr 2013 21:00:07 GMT
Updated Branches:
  refs/heads/internallb 3f2a62c7f -> f4c2b53c2


Removed unused methods doing ipAllocation from GuestNetworkGuru and NetworkServiceImpl. The
correct method is located in NetworkModelImpl


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

Branch: refs/heads/internallb
Commit: 915e39fbaa9a6b6898e2aa13cbf8ef60a7b9d70e
Parents: 3f2a62c
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Thu Apr 11 10:19:18 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Thu Apr 11 10:19:18 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/network/NetworkServiceImpl.java  |   30 ----------
 .../com/cloud/network/guru/GuestNetworkGuru.java   |   43 +--------------
 .../lb/ApplicationLoadBalancerManagerImpl.java     |    3 +-
 3 files changed, 3 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/915e39fb/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index 2436967..60b700f 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -30,7 +30,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.TreeSet;
 import java.util.UUID;
 
 import javax.ejb.Local;
@@ -2069,35 +2068,6 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService
{
         return getNetwork(network.getId());
     }
 
-
-
-
-    protected Set<Long> getAvailableIps(Network network, String requestedIp) {
-        String[] cidr = network.getCidr().split("/");
-        List<String> ips = _nicDao.listIpAddressInNetwork(network.getId());
-        Set<Long> allPossibleIps = NetUtils.getAllIpsFromCidr(cidr[0], Integer.parseInt(cidr[1]));
-        Set<Long> usedIps = new TreeSet<Long>(); 
-        
-        for (String ip : ips) {
-            if (requestedIp != null && requestedIp.equals(ip)) {
-                s_logger.warn("Requested ip address " + requestedIp + " is already in use
in network" + network);
-                return null;
-            }
-
-            usedIps.add(NetUtils.ip2Long(ip));
-        }
-        if (usedIps.size() != 0) {
-            allPossibleIps.removeAll(usedIps);
-        }
-
-        String gateway = network.getGateway();
-        if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway))))
-            allPossibleIps.remove(NetUtils.ip2Long(gateway));
-
-        return allPossibleIps;
-    }
-
-
   
     protected boolean canUpgrade(Network network, long oldNetworkOfferingId, long newNetworkOfferingId)
{
         NetworkOffering oldNetworkOffering = _networkOfferingDao.findByIdIncludingRemoved(oldNetworkOfferingId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/915e39fb/server/src/com/cloud/network/guru/GuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java
index 9c0205a..f1cacb5 100755
--- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java
@@ -222,48 +222,7 @@ public abstract class GuestNetworkGuru extends AdapterBase implements
NetworkGur
             nic.deallocate();
         }
     }
-
-    public Ip4Address acquireIp4Address(Network network, Ip4Address requestedIp, String reservationId)
{
-        List<String> ips = _nicDao.listIpAddressInNetwork(network.getId());
-        String[] cidr = network.getCidr().split("/");
-        SortedSet<Long> usedIps = new TreeSet<Long>();
-
-        if (requestedIp != null && requestedIp.equals(network.getGateway())) {
-            s_logger.warn("Requested ip address " + requestedIp + " is used as a gateway
address in network " + network);
-            return null;
-        }
-
-        for (String ip : ips) {
-            usedIps.add(NetUtils.ip2Long(ip));
-        }
-
-        if (network.getGateway() != null) {
-            usedIps.add(NetUtils.ip2Long(network.getGateway()));
-        }
-
-        if (requestedIp != null) {
-            if (usedIps.contains(requestedIp.toLong())) {
-                s_logger.warn("Requested ip address " + requestedIp + " is already in used
in " + network);
-                return null;
-            }
-            //check that requested ip has the same cidr
-            boolean isSameCidr = NetUtils.sameSubnetCIDR(requestedIp.ip4(), cidr[0], Integer.parseInt(cidr[1]));
-            if (!isSameCidr) {
-                s_logger.warn("Requested ip address " + requestedIp + " doesn't belong to
the network " + network + " cidr");
-                return null;
-            }
-
-            return requestedIp;
-        }
-
-        long ip = NetUtils.getRandomIpFromCidr(cidr[0], Integer.parseInt(cidr[1]), usedIps);
-        if (ip == -1) {
-            s_logger.warn("Unable to allocate any more ip address in " + network);
-            return null;
-        }
-
-        return new Ip4Address(ip);
-    }
+    
 
     public int getVlanOffset(long physicalNetworkId, int vlanTag) {
         PhysicalNetworkVO pNetwork = _physicalNetworkDao.findById(physicalNetworkId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/915e39fb/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
index 4f446ed..d48ce77 100644
--- a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
+++ b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
@@ -29,6 +29,7 @@ import org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDao;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
+import com.cloud.event.ActionEvent;
 import com.cloud.event.EventTypes;
 import com.cloud.event.UsageEventUtils;
 import com.cloud.exception.InsufficientAddressCapacityException;
@@ -76,8 +77,8 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements
A
     @Inject ResourceTagDao _resourceTagDao;
     
     
-    //TODO - add action even annotation here; test it as well
     @Override
+    @ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_CREATE, eventDescription = "creating
load balancer")
     public ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String
description, Scheme scheme, long sourceIpNetworkId, String sourceIp,
             int sourcePort, int instancePort, String algorithm, long networkId, long lbOwnerId)
throws InsufficientAddressCapacityException,
             NetworkRuleConflictException {


Mime
View raw message