incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mlsoren...@apache.org
Subject [2/50] [abbrv] git commit: Network-refactor: some clean up of the NetworkService interface - remove unused public apis - remove unused members - change visibility of methods to protected if they do not implement a method in the interface
Date Fri, 18 Jan 2013 22:23:45 GMT
Network-refactor: some clean up of the NetworkService interface
- remove unused public apis
- remove unused members
- change visibility of methods to protected if they do not implement a method in the interface

Signed-off-by: Chiradeep Vittal <chiradeep@apache.org>


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

Branch: refs/heads/add_remove_nics
Commit: 745fae93f6d7a704a6095049902c611efd803f1e
Parents: 05a85c7
Author: Chiradeep Vittal <chiradeep@apache.org>
Authored: Wed Jan 9 17:53:40 2013 -0800
Committer: Chiradeep Vittal <chiradeep@apache.org>
Committed: Wed Jan 9 18:36:23 2013 -0800

----------------------------------------------------------------------
 api/src/com/cloud/network/NetworkService.java      |    7 +-
 .../src/com/cloud/network/NetworkServiceImpl.java  |   68 +++------------
 2 files changed, 16 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/745fae93/api/src/com/cloud/network/NetworkService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index 94a08d2..b93be6f 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -33,6 +33,11 @@ import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.utils.Pair;
 
+/**
+ * The NetworkService interface is the "public" api to entities that make requests to the
orchestration engine
+ * Such entities are usually the admin and end-user API.
+ *
+ */
 public interface NetworkService {
 
     List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account
owner);
@@ -60,8 +65,6 @@ public interface NetworkService {
     IpAddress getIp(long id);
 
 
-    boolean isNetworkAvailableInDomain(long networkId, long domainId);
-
     Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount,
User callerUser,
             String domainSuffix, Long networkOfferingId, Boolean changeCidr);
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/745fae93/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 1d2db3e..be719c2 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -231,18 +231,13 @@ public class NetworkServiceImpl implements  NetworkService, Manager
{
 
     private final HashMap<String, NetworkOfferingVO> _systemNetworks = new HashMap<String,
NetworkOfferingVO>(5);
 
-    String _networkDomain;
     int _cidrLimit;
     boolean _allowSubdomainNetworkAccess;
 
     private Map<String, String> _configs;
 
-    
-   
-
     /* Get a list of IPs, classify them by service */
-    //@Override
-    public Map<PublicIp, Set<Service>> getIpToServices(List<PublicIp> publicIps,
boolean rulesRevoked, boolean includingFirewall) {
+    protected Map<PublicIp, Set<Service>> getIpToServices(List<PublicIp>
publicIps, boolean rulesRevoked, boolean includingFirewall) {
         Map<PublicIp, Set<Service>> ipToServices = new HashMap<PublicIp, Set<Service>>();
 
         if (publicIps != null && !publicIps.isEmpty()) {
@@ -333,7 +328,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         return ipToServices;
     }
 
-    public boolean canIpUsedForNonConserveService(PublicIp ip, Service service) {
+    protected boolean canIpUsedForNonConserveService(PublicIp ip, Service service) {
         // If it's non-conserve mode, then the new ip should not be used by any other services
         List<PublicIp> ipList = new ArrayList<PublicIp>();
         ipList.add(ip);
@@ -464,7 +459,6 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
     protected IpAddress allocateIP(Account ipOwner, boolean isSystem, long zoneId) 
             throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException
{
         Account caller = UserContext.current().getCaller();
-        long callerUserId = UserContext.current().getCallerUserId();
         // check permissions
         _accountMgr.checkAccess(caller, null, false, ipOwner);
         
@@ -481,11 +475,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
     @DB
     public boolean configure(final String name, final Map<String, Object> params) throws
ConfigurationException {
         _name = name;
-
-        
-
         _configs = _configDao.getConfiguration("Network", params);
-        _networkDomain = _configs.get(Config.GuestDomainSuffix.key());
 
         _cidrLimit = NumbersUtil.parseInt(_configs.get(Config.NetworkGuestCidrLimit.key()),
22);
 
@@ -506,13 +496,9 @@ public class NetworkServiceImpl implements  NetworkService, Manager {
         privateGatewayNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(privateGatewayNetworkOffering);
         _systemNetworks.put(NetworkOfferingVO.SystemPrivateGatewayNetworkOffering, privateGatewayNetworkOffering);
 
-
-        
-
-
         _allowSubdomainNetworkAccess = Boolean.valueOf(_configs.get(Config.SubDomainNetworkAccess.key()));
 
-        s_logger.info("Network Manager is configured.");
+        s_logger.info("Network Service is configured.");
 
         return true;
     }
@@ -1408,7 +1394,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager
{
 
    
 
-    //@Override
+    
     protected Map<Capability, String> getNetworkOfferingServiceCapabilities(NetworkOffering
offering, Service service) {
 
         if (!areServicesSupportedByNetworkOffering(offering.getId(), service)) {
@@ -1476,12 +1462,12 @@ public class NetworkServiceImpl implements  NetworkService, Manager
{
         return false;
     }
 
-    //@Override
+    
     protected boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service...
services) {
         return (_ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(networkOfferingId,
services));
     }
 
-    //@Override
+    
     protected boolean areServicesSupportedInNetwork(long networkId, Service... services)
{
         return (_ntwkSrvcDao.areServicesSupportedInNetwork(networkId, services));
     }
@@ -1490,39 +1476,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager
{
         
    
 
-    @Override
-    public boolean isNetworkAvailableInDomain(long networkId, long domainId) {
-        Long networkDomainId = null;
-        Network network = getNetwork(networkId);
-        if (network.getGuestType() != Network.GuestType.Shared) {
-            s_logger.trace("Network id=" + networkId + " is not shared");
-            return false;
-        }
-
-        NetworkDomainVO networkDomainMap = _networkDomainDao.getDomainNetworkMapByNetworkId(networkId);
-        if (networkDomainMap == null) {
-            s_logger.trace("Network id=" + networkId + " is shared, but not domain specific");
-            return true;
-        } else {
-            networkDomainId = networkDomainMap.getDomainId();
-        }
-
-        if (domainId == networkDomainId.longValue()) {
-            return true;
-        }
-
-        if (networkDomainMap.subdomainAccess) {
-            Set<Long> parentDomains = _domainMgr.getDomainParentIds(domainId);
-
-            if (parentDomains.contains(domainId)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-  
+    
 
     private boolean checkForNonStoppedVmInNetwork(long networkId) {
         List<UserVmVO> vms = _userVmDao.listByNetworkIdAndStates(networkId, VirtualMachine.State.Starting,

@@ -2222,7 +2176,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager
{
     }
 
     @DB
-    private void checkIfPhysicalNetworkIsDeletable(Long physicalNetworkId) {
+    protected void checkIfPhysicalNetworkIsDeletable(Long physicalNetworkId) {
         List<List<String>> tablesToCheck = new ArrayList<List<String>>();
 
         List<String> vnet = new ArrayList<String>();
@@ -2771,7 +2725,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager
{
 
 
 
-    @Override //TODO: duplicated in NetworkMgr
+    @Override //TODO: duplicated in NetworkModel
     public NetworkVO getExclusiveGuestNetwork(long zoneId) {
         List<NetworkVO> networks = _networksDao.listBy(Account.ACCOUNT_ID_SYSTEM, zoneId,
GuestType.Shared, TrafficType.Guest);
         if (networks == null || networks.isEmpty()) {
@@ -2821,7 +2775,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager
{
         return nsp;
     }
 
-    //@Override
+    
     protected boolean isNetworkSystem(Network network) {
         NetworkOffering no = _networkOfferingDao.findByIdIncludingRemoved(network.getNetworkOfferingId());
         if (no.isSystemOnly()) {
@@ -2832,7 +2786,7 @@ public class NetworkServiceImpl implements  NetworkService, Manager
{
     }
 
     
-    //@Override
+    
     private boolean getAllowSubdomainAccessGlobal() {
         return _allowSubdomainNetworkAccess;
     }


Mime
View raw message