mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
tuna add port forwarding support
This commit is contained in:
parent
d935d3865a
commit
9c702ff388
@ -68,7 +68,7 @@ import com.cloud.vm.dao.DomainRouterDao;
|
|||||||
PortForwardingServiceProvider.class, IpDeployer.class })
|
PortForwardingServiceProvider.class, IpDeployer.class })
|
||||||
public class OvsElement extends AdapterBase implements NetworkElement,
|
public class OvsElement extends AdapterBase implements NetworkElement,
|
||||||
OvsElementService, ConnectivityProvider, ResourceStateAdapter,
|
OvsElementService, ConnectivityProvider, ResourceStateAdapter,
|
||||||
SourceNatServiceProvider, PortForwardingServiceProvider,
|
PortForwardingServiceProvider,
|
||||||
StaticNatServiceProvider, IpDeployer {
|
StaticNatServiceProvider, IpDeployer {
|
||||||
@Inject
|
@Inject
|
||||||
OvsTunnelManager _ovsTunnelMgr;
|
OvsTunnelManager _ovsTunnelMgr;
|
||||||
@ -228,12 +228,6 @@ public class OvsElement extends AdapterBase implements NetworkElement,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ((services.contains(Service.PortForwarding) || services
|
|
||||||
// .contains(Service.StaticNat))
|
|
||||||
// && !services.contains(Service.SourceNat)) {
|
|
||||||
// s_logger.warn("Unable to provide StaticNat and/or PortForwarding without the SourceNat service");
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +237,6 @@ public class OvsElement extends AdapterBase implements NetworkElement,
|
|||||||
// L2 Support : SDN provisioning
|
// L2 Support : SDN provisioning
|
||||||
capabilities.put(Service.Connectivity, null);
|
capabilities.put(Service.Connectivity, null);
|
||||||
|
|
||||||
// TODO: we need L3 support for coding L3 services in next period
|
|
||||||
// L3 Support : Generic?
|
// L3 Support : Generic?
|
||||||
// capabilities.put(Service.Gateway, null);
|
// capabilities.put(Service.Gateway, null);
|
||||||
|
|
||||||
@ -256,7 +249,7 @@ public class OvsElement extends AdapterBase implements NetworkElement,
|
|||||||
// capabilities.put(Service.SourceNat, sourceNatCapabilities);
|
// capabilities.put(Service.SourceNat, sourceNatCapabilities);
|
||||||
|
|
||||||
// L3 Support : Port Forwarding
|
// L3 Support : Port Forwarding
|
||||||
// capabilities.put(Service.PortForwarding, null);
|
capabilities.put(Service.PortForwarding, null);
|
||||||
|
|
||||||
// L3 support : StaticNat
|
// L3 support : StaticNat
|
||||||
capabilities.put(Service.StaticNat, null);
|
capabilities.put(Service.StaticNat, null);
|
||||||
@ -296,7 +289,6 @@ public class OvsElement extends AdapterBase implements NetworkElement,
|
|||||||
return new DeleteHostAnswer(true);
|
return new DeleteHostAnswer(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Adding L3 services below
|
|
||||||
@Override
|
@Override
|
||||||
public IpDeployer getIpDeployer(Network network) {
|
public IpDeployer getIpDeployer(Network network) {
|
||||||
return this;
|
return this;
|
||||||
@ -331,8 +323,7 @@ public class OvsElement extends AdapterBase implements NetworkElement,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applyStaticNats(Network network,
|
public boolean applyStaticNats(Network network, List<? extends StaticNat> rules)
|
||||||
List<? extends StaticNat> rules)
|
|
||||||
throws ResourceUnavailableException {
|
throws ResourceUnavailableException {
|
||||||
if (!canHandle(network, Service.StaticNat)) {
|
if (!canHandle(network, Service.StaticNat)) {
|
||||||
return false;
|
return false;
|
||||||
@ -351,7 +342,17 @@ public class OvsElement extends AdapterBase implements NetworkElement,
|
|||||||
@Override
|
@Override
|
||||||
public boolean applyPFRules(Network network, List<PortForwardingRule> rules)
|
public boolean applyPFRules(Network network, List<PortForwardingRule> rules)
|
||||||
throws ResourceUnavailableException {
|
throws ResourceUnavailableException {
|
||||||
// TODO Auto-generated method stub
|
if (!canHandle(network, Service.PortForwarding)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(
|
||||||
|
network.getId(), Role.VIRTUAL_ROUTER);
|
||||||
|
if (routers == null || routers.isEmpty()) {
|
||||||
|
s_logger.debug("Ovs element doesn't need to apply firewall rules on the backend; virtual "
|
||||||
|
+ "router doesn't exist in the network " + network.getId());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _routerMgr.applyFirewallRules(network, rules, routers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user