cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [09/21] git commit: updated refs/heads/master to 267ff79
Date Mon, 09 Dec 2013 16:52:35 GMT
tuna


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

Branch: refs/heads/master
Commit: 9f82757eb973378cc1a7dade7e1af24bc1ca4401
Parents: 3df8b91
Author: tuna <ng.tuna@gmail.com>
Authored: Sat Sep 28 20:56:44 2013 +0700
Committer: tuna <ng.tuna@gmail.com>
Committed: Mon Dec 9 23:33:14 2013 +0700

----------------------------------------------------------------------
 .../com/cloud/network/element/OvsElement.java   |   8 -
 .../cloud/network/ovs/OvsTunnelManagerImpl.java | 162 +++++++++----------
 server/src/com/cloud/configuration/Config.java  |   8 -
 .../src/com/cloud/network/NetworkModelImpl.java |   8 +-
 .../network/element/VirtualRouterElement.java   |  12 --
 .../network/guru/ExternalGuestNetworkGuru.java  |  50 +++---
 6 files changed, 110 insertions(+), 138 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f82757e/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
index 2622bdc..93b631f 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
@@ -247,14 +247,6 @@ public class OvsElement extends AdapterBase implements NetworkElement,
 		// L2 Support : SDN provisioning
 		capabilities.put(Service.Connectivity, null);
 
-		// L3 Support : SourceNat
-		// Map<Capability, String> sourceNatCapabilities = new
-		// HashMap<Capability, String>();
-		// sourceNatCapabilities.put(Capability.SupportedSourceNatTypes,
-		// "peraccount");
-		// sourceNatCapabilities.put(Capability.RedundantRouter, "false");
-		// capabilities.put(Service.SourceNat, sourceNatCapabilities);
-
 		// L3 Support : Port Forwarding
 		 capabilities.put(Service.PortForwarding, null);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f82757e/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
index bfead90..505f57d 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
@@ -79,31 +79,30 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
 
 	// boolean _isEnabled;
 	ScheduledExecutorService _executorPool;
-    ScheduledExecutorService _cleanupExecutor;
-
-	@Inject ConfigurationDao _configDao;
-	@Inject NicDao _nicDao;
-	@Inject HostDao _hostDao;
-	@Inject PhysicalNetworkTrafficTypeDao _physNetTTDao;
-	@Inject UserVmDao _userVmDao;
-	@Inject DomainRouterDao _routerDao;
-	@Inject OvsTunnelNetworkDao _tunnelNetworkDao;
-	@Inject OvsTunnelInterfaceDao _tunnelInterfaceDao;
-	@Inject AgentManager _agentMgr;
+	ScheduledExecutorService _cleanupExecutor;
+
+	@Inject
+	ConfigurationDao _configDao;
+	@Inject
+	NicDao _nicDao;
+	@Inject
+	HostDao _hostDao;
+	@Inject
+	PhysicalNetworkTrafficTypeDao _physNetTTDao;
+	@Inject
+	UserVmDao _userVmDao;
+	@Inject
+	DomainRouterDao _routerDao;
+	@Inject
+	OvsTunnelNetworkDao _tunnelNetworkDao;
+	@Inject
+	OvsTunnelInterfaceDao _tunnelInterfaceDao;
+	@Inject
+	AgentManager _agentMgr;
 
 	@Override
 	public boolean configure(String name, Map<String, Object> params)
 			throws ConfigurationException {
-		// _isEnabled =
-		// Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()));
-		//
-		// if (_isEnabled) {
-		// _executorPool = Executors.newScheduledThreadPool(10, new
-		// NamedThreadFactory("OVS"));
-		// _cleanupExecutor = Executors.newScheduledThreadPool(1, new
-		// NamedThreadFactory("OVS-Cleanup"));
-		// }
-
 		return true;
 	}
 
@@ -112,57 +111,55 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
 		OvsTunnelNetworkVO ta = null;
 		try {
 			ta = new OvsTunnelNetworkVO(from, to, key, networkId);
-			OvsTunnelNetworkVO lock =
-					_tunnelNetworkDao.acquireInLockTable(Long.valueOf(1));
+			OvsTunnelNetworkVO lock = _tunnelNetworkDao.acquireInLockTable(Long
+					.valueOf(1));
 			if (lock == null) {
-			    s_logger.warn("Cannot lock table ovs_tunnel_account");
-			    return null;
+				s_logger.warn("Cannot lock table ovs_tunnel_account");
+				return null;
 			}
 			_tunnelNetworkDao.persist(ta);
 			_tunnelNetworkDao.releaseFromLockTable(lock.getId());
 		} catch (EntityExistsException e) {
-			s_logger.debug("A record for the tunnel from " + from +
-						   " to " + to + " already exists");
+			s_logger.debug("A record for the tunnel from " + from + " to " + to
+					+ " already exists");
 		}
 		return ta;
 	}
 
 	@DB
 	protected OvsTunnelInterfaceVO createInterfaceRecord(String ip,
-			String netmask,String mac,long hostId, String label) {
+			String netmask, String mac, long hostId, String label) {
 		OvsTunnelInterfaceVO ti = null;
 		try {
 			ti = new OvsTunnelInterfaceVO(ip, netmask, mac, hostId, label);
-			//TODO: Is locking really necessary here?
-			OvsTunnelInterfaceVO lock =
-					_tunnelInterfaceDao.acquireInLockTable(Long.valueOf(1));
+			// TODO: Is locking really necessary here?
+			OvsTunnelInterfaceVO lock = _tunnelInterfaceDao
+					.acquireInLockTable(Long.valueOf(1));
 			if (lock == null) {
-			    s_logger.warn("Cannot lock table ovs_tunnel_account");
-			    return null;
+				s_logger.warn("Cannot lock table ovs_tunnel_account");
+				return null;
 			}
 			_tunnelInterfaceDao.persist(ti);
 			_tunnelInterfaceDao.releaseFromLockTable(lock.getId());
 		} catch (EntityExistsException e) {
-			s_logger.debug("A record for the interface for network " + label +
-					       " on host id " + hostId + " already exists");
+			s_logger.debug("A record for the interface for network " + label
+					+ " on host id " + hostId + " already exists");
 		}
 		return ti;
 	}
 
-	private String handleFetchInterfaceAnswer(Answer[] answers, Long hostId){
+	private String handleFetchInterfaceAnswer(Answer[] answers, Long hostId) {
 		OvsFetchInterfaceAnswer ans = (OvsFetchInterfaceAnswer) answers[0];
 		if (ans.getResult()) {
-			if (ans.getIp() != null &&
-				!("".equals(ans.getIp()))) {
-				OvsTunnelInterfaceVO ti =
-						createInterfaceRecord(ans.getIp(), ans.getNetmask(),
-											  ans.getMac(), hostId, ans.getLabel());
+			if (ans.getIp() != null && !("".equals(ans.getIp()))) {
+				OvsTunnelInterfaceVO ti = createInterfaceRecord(ans.getIp(),
+						ans.getNetmask(), ans.getMac(), hostId, ans.getLabel());
 				return ti.getIp();
 			}
 		}
 		// Fetch interface failed!
-	    s_logger.warn("Unable to fetch the IP address for the GRE tunnel endpoint" +
-	    			  ans.getDetails());
+		s_logger.warn("Unable to fetch the IP address for the GRE tunnel endpoint"
+				+ ans.getDetails());
 		return null;
 	}
 
@@ -240,20 +237,19 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
             					  from, to, networkId));
 		}
 		if (!r.getResult()) {
-		    tunnel.setState("FAILED");
-			s_logger.warn("Create GRE tunnel failed due to " +
-					r.getDetails() + s);
+			tunnel.setState("FAILED");
+			s_logger.warn("Create GRE tunnel failed due to " + r.getDetails()
+					+ s);
 		} else {
-		    tunnel.setState("SUCCESS");
-		    tunnel.setPortName(r.getInPortName());
-		    s_logger.warn("Create GRE tunnel " +
-		    		r.getDetails() + s);
+			tunnel.setState("SUCCESS");
+			tunnel.setPortName(r.getInPortName());
+			s_logger.warn("Create GRE tunnel " + r.getDetails() + s);
 		}
 		_tunnelNetworkDao.update(tunnel.getId(), tunnel);
 	}
 
-	private String getGreEndpointIP(Host host, Network nw) throws
-		AgentUnavailableException, OperationTimedoutException {
+	private String getGreEndpointIP(Host host, Network nw)
+			throws AgentUnavailableException, OperationTimedoutException {
 		String endpointIp = null;
 		// Fetch fefault name for network label from configuration
 		String physNetLabel = _configDao.getValue(Config.OvsTunnelNetworkDefaultLabel.key());
@@ -317,12 +313,12 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
     		key = Integer.valueOf(keyStr);
     		return key;
 		} catch (NumberFormatException e) {
-			s_logger.debug("Well well, how did '" + key +
-					       "' end up in the broadcast URI for the network?");
-			throw new CloudRuntimeException(
-					String.format("Invalid GRE key parsed from" +
-							"network broadcast URI (%s)",
-							network.getBroadcastUri().toString()));
+			s_logger.debug("Well well, how did '" + key
+					+ "' end up in the broadcast URI for the network?");
+			throw new CloudRuntimeException(String.format(
+					"Invalid GRE key parsed from"
+							+ "network broadcast URI (%s)", network
+							.getBroadcastUri().toString()));
 		}
 	}
 
@@ -332,8 +328,8 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
 		s_logger.debug("Creating tunnels with OVS tunnel manager");
 		if (instance.getType() != VirtualMachine.Type.User
 				&& instance.getType() != VirtualMachine.Type.DomainRouter) {
-			s_logger.debug("Will not work if you're not" +
-						   "an instance or a virtual router");
+			s_logger.debug("Will not work if you're not"
+					+ "an instance or a virtual router");
 			return;
 		}
 
@@ -341,11 +337,11 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
 		int key = getGreKey(nw);
 		// Find active VMs with a NIC on the target network
 		List<UserVmVO> vms = _userVmDao.listByNetworkIdAndStates(nw.getId(),
-							  State.Running, State.Starting,
-							  State.Stopping, State.Unknown, State.Migrating);
+				State.Running, State.Starting, State.Stopping, State.Unknown,
+				State.Migrating);
 		// Find routers for the network
 		List<DomainRouterVO> routers = _routerDao.findByNetwork(nw.getId());
-		List<VMInstanceVO>ins = new ArrayList<VMInstanceVO>();
+		List<VMInstanceVO> ins = new ArrayList<VMInstanceVO>();
 		if (vms != null) {
 			ins.addAll(vms);
 		}
@@ -395,45 +391,45 @@ public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManage
 			for (Long i : toHostIds) {
 				HostVO rHost = _hostDao.findById(i);
 				String otherIp = getGreEndpointIP(rHost, nw);
-	            if (otherIp == null)
-	            	throw new GreTunnelException("Unable to retrieve the remote " +
-	            								 "endpoint for the GRE tunnel." +
-	            								 "Failure is on host:" + rHost.getId());
+				if (otherIp == null)
+					throw new GreTunnelException(
+							"Unable to retrieve the remote "
+									+ "endpoint for the GRE tunnel."
+									+ "Failure is on host:" + rHost.getId());
 				Commands cmds = new Commands(
 						new OvsCreateTunnelCommand(otherIp, key,
 								Long.valueOf(hostId), i, nw.getId(), myIp));
-				s_logger.debug("Ask host " + hostId +
-						" to create gre tunnel to " + i);
+				s_logger.debug("Ask host " + hostId
+						+ " to create gre tunnel to " + i);
 				Answer[] answers = _agentMgr.send(hostId, cmds);
 				handleCreateTunnelAnswer(answers);
 				noHost = false;
 			}
 
 			for (Long i : fromHostIds) {
-			    HostVO rHost = _hostDao.findById(i);
-			    String otherIp = getGreEndpointIP(rHost, nw);
-				Commands cmds = new Commands(
-				        new OvsCreateTunnelCommand(myIp, key, i,
-				        						   Long.valueOf(hostId),
-				        		                   nw.getId(), otherIp));
-				s_logger.debug("Ask host " + i +
-						" to create gre tunnel to " + hostId);
+				HostVO rHost = _hostDao.findById(i);
+				String otherIp = getGreEndpointIP(rHost, nw);
+				Commands cmds = new Commands(new OvsCreateTunnelCommand(myIp,
+						key, i, Long.valueOf(hostId), nw.getId(), otherIp));
+				s_logger.debug("Ask host " + i + " to create gre tunnel to "
+						+ hostId);
 				Answer[] answers = _agentMgr.send(i, cmds);
 				handleCreateTunnelAnswer(answers);
 				noHost = false;
 			}
-			// If no tunnels have been configured, perform the bridge setup anyway
+			// If no tunnels have been configured, perform the bridge setup
+			// anyway
 			// This will ensure VIF rules will be triggered
 			if (noHost) {
-				Commands cmds = new Commands(
-						new OvsSetupBridgeCommand(key, hostId, nw.getId()));
-				s_logger.debug("Ask host " + hostId +
-						" to configure bridge for network:" + nw.getId());
+				Commands cmds = new Commands(new OvsSetupBridgeCommand(key,
+						hostId, nw.getId()));
+				s_logger.debug("Ask host " + hostId
+						+ " to configure bridge for network:" + nw.getId());
 				Answer[] answers = _agentMgr.send(hostId, cmds);
 				handleSetupBridgeAnswer(answers);
 			}
 		} catch (Exception e) {
-		    // I really thing we should do a better handling of these exceptions
+			// I really thing we should do a better handling of these exceptions
 			s_logger.warn("Ovs Tunnel network created tunnel failed", e);
 		}
 	}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f82757e/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 1490926..afc09d6 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -295,14 +295,6 @@ public enum Config {
             "false",
             "Direct Network Dhcp Server should not send a default route",
             "true/false"),
-    OvsTunnelNetwork(
-            "Network",
-            ManagementServer.class,
-            Boolean.class,
-            "sdn.ovs.controller",
-            "false",
-            "Enable/Disable Open vSwitch SDN controller for L2-in-L3 overlay networks",
-            null),
     OvsTunnelNetworkDefaultLabel(
             "Network",
             ManagementServer.class,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f82757e/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index 2a38ac1..7568da0 100755
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -435,13 +435,7 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel
{
         if (oldElement instanceof IpDeployingRequester && newElement instanceof IpDeployingRequester)
{
         	IpDeployer oldIpDeployer = ((IpDeployingRequester)oldElement).getIpDeployer(network);
         	IpDeployer newIpDeployer = ((IpDeployingRequester)newElement).getIpDeployer(network);
-			// if
-			// (!oldIpDeployer.getProvider().getName().equals(newIpDeployer.getProvider().getName()))
-			// {
-			// throw new
-			// InvalidParameterException("There would be multiple providers for IP "
-			// + publicIp.getAddress() + "!");
-			// }
+			// FIXME: I ignored this check
         } else {
             throw new InvalidParameterException("Ip cannot be applied for new provider!");
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f82757e/server/src/com/cloud/network/element/VirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java b/server/src/com/cloud/network/element/VirtualRouterElement.java
index 923094b..7ceb9a4 100755
--- a/server/src/com/cloud/network/element/VirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VirtualRouterElement.java
@@ -993,18 +993,6 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
 
     @Override
     public boolean verifyServicesCombination(Set<Service> services) {
-//        if (!services.contains(Service.SourceNat)) {
-//            if (services.contains(Service.StaticNat) || services.contains(Service.Firewall)
|| services.contains(Service.Lb) ||
-//                    services.contains(Service.PortForwarding) || services.contains(Service.Vpn))
{
-//                String servicesList = "[";
-//                for (Service service : services) {
-//                    servicesList += service.getName() + " ";
-//                }
-//                servicesList += "]";
-//                s_logger.warn("Virtual router can't enable services " + servicesList +
" without source NAT service");
-//                return false;
-//            }
-//        }
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f82757e/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
index cb7bbe1..207f159 100644
--- a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
@@ -99,9 +99,11 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
     @Override
     public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified,
Account owner) {
 
-        if (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()))) {
-            return null;
-        }
+		// if
+		// (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key())))
+		// {
+		// return null;
+		// }
 
         NetworkVO config = (NetworkVO)super.design(offering, plan, userSpecified, owner);
         if (config == null) {
@@ -119,9 +121,11 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
         throws InsufficientVirtualNetworkCapcityException {
         assert (config.getState() == State.Implementing) : "Why are we implementing " + config;
 
-        if (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()))) {
-            return null;
-        }
+		// if
+		// (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key())))
+		// {
+		// return null;
+		// }
 
         if (!_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(),
config.getId())) {
             return super.implement(config, offering, dest, context);
@@ -225,10 +229,11 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
 
         NicProfile profile = super.allocate(config, nic, vm);
 
-        boolean _isEnabled = Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()));
-        if (_isEnabled) {
-            return null;
-        }
+		// boolean _isEnabled =
+		// Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()));
+		// if (_isEnabled) {
+		// return null;
+		// }
 
         if (_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(),
config.getId())) {
             profile.setStrategy(ReservationStrategy.Start);
@@ -246,9 +251,11 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
     public void deallocate(Network config, NicProfile nic, VirtualMachineProfile vm) {
         super.deallocate(config, nic, vm);
 
-        if (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()))) {
-            return;
-        }
+		// if
+		// (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key())))
+		// {
+		// return;
+		// }
 
         if (_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(),
config.getId())) {
             nic.setIp4Address(null);
@@ -263,10 +270,11 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
     public void reserve(NicProfile nic, Network config, VirtualMachineProfile vm, DeployDestination
dest, ReservationContext context)
         throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException
{
         assert (nic.getReservationStrategy() == ReservationStrategy.Start) : "What can I
do for nics that are not allocated at start? ";
-        boolean _isEnabled = Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()));
-        if (_isEnabled) {
-            return;
-        }
+		// boolean _isEnabled =
+		// Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()));
+		// if (_isEnabled) {
+		// return;
+		// }
 
         DataCenter dc = _dcDao.findById(config.getDataCenterId());
 
@@ -299,9 +307,11 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
     @Override
     public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId)
{
 
-        if (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()))) {
-            return true;
-        }
+		// if
+		// (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key())))
+		// {
+		// return true;
+		// }
 
         NetworkVO network = _networkDao.findById(nic.getNetworkId());
 


Mime
View raw message