mirror of https://github.com/apache/cloudstack.git
VPC: reduced visability for some vpc related methods
This commit is contained in:
parent
0320fc1b65
commit
6826dd16b5
|
|
@ -26,7 +26,6 @@ import com.cloud.exception.ResourceUnavailableException;
|
|||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.Site2SiteVpnGateway;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
|
|
@ -125,8 +124,9 @@ public interface VpcService {
|
|||
* @throws ResourceUnavailableException
|
||||
* @throws ConcurrentOperationException
|
||||
*/
|
||||
boolean startVpc(long vpcId, boolean destroyOnFailure) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
boolean startVpc(long vpcId, boolean destroyOnFailure) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
* @param vpcId
|
||||
* @return
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import com.cloud.network.rules.FirewallRule;
|
|||
import com.cloud.network.vpc.PrivateGateway;
|
||||
import com.cloud.network.vpc.StaticRouteProfile;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.network.vpc.VpcGateway;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.vm.DomainRouterVO;
|
||||
import com.cloud.vm.VirtualMachineProfile.Param;
|
||||
|
|
|
|||
|
|
@ -695,7 +695,8 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
return sendCommandsToRouter(router, cmds);
|
||||
}
|
||||
|
||||
private void createNetworkACLsCommands(List<? extends FirewallRule> rules, VirtualRouter router, Commands cmds, long guestNetworkId) {
|
||||
private void createNetworkACLsCommands(List<? extends FirewallRule> rules, VirtualRouter router, Commands cmds,
|
||||
long guestNetworkId) {
|
||||
List<NetworkACLTO> rulesTO = null;
|
||||
String guestVlan = null;
|
||||
Network guestNtwk = _networkDao.findById(guestNetworkId);
|
||||
|
|
@ -723,7 +724,8 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
cmds.addCommand(cmd);
|
||||
}
|
||||
|
||||
protected void finalizeSshAndVersionOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DomainRouterVO router, NicProfile controlNic) {
|
||||
protected void finalizeSshAndVersionOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile,
|
||||
DomainRouterVO router, NicProfile controlNic) {
|
||||
cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922));
|
||||
|
||||
// Update router template/scripts version
|
||||
|
|
@ -794,7 +796,8 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
}
|
||||
}
|
||||
|
||||
PlugNicCommand plugNicCmd = new PlugNicCommand(getNicTO(router, publicNic.getNetworkId(), publicNic.getBroadcastUri().toString()), router.getInstanceName());
|
||||
PlugNicCommand plugNicCmd = new PlugNicCommand(getNicTO(router, publicNic.getNetworkId(),
|
||||
publicNic.getBroadcastUri().toString()), router.getInstanceName());
|
||||
cmds.addCommand(plugNicCmd);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,8 @@ public class NetworkACLManagerImpl implements Manager,NetworkACLManager{
|
|||
}
|
||||
|
||||
if (network.getTrafficType() != Networks.TrafficType.Guest) {
|
||||
throw new InvalidParameterValueException("Network ACL can be created just for networks of type " + Networks.TrafficType.Guest, null);
|
||||
throw new InvalidParameterValueException("Network ACL can be created just for networks of type "
|
||||
+ Networks.TrafficType.Guest, null);
|
||||
}
|
||||
|
||||
// Verify that the network guru supports the protocol specified
|
||||
|
|
@ -212,6 +213,7 @@ public class NetworkACLManagerImpl implements Manager,NetworkACLManager{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected void detectNetworkACLConflict(FirewallRuleVO newRule) throws NetworkRuleConflictException {
|
||||
if (newRule.getPurpose() != Purpose.NetworkACL) {
|
||||
return;
|
||||
|
|
@ -249,7 +251,8 @@ public class NetworkACLManagerImpl implements Manager,NetworkACLManager{
|
|||
}
|
||||
}
|
||||
|
||||
if (newRule.getProtocol().equalsIgnoreCase(NetUtils.ICMP_PROTO) && newRule.getProtocol().equalsIgnoreCase(rule.getProtocol())) {
|
||||
if (newRule.getProtocol().equalsIgnoreCase(NetUtils.ICMP_PROTO)
|
||||
&& newRule.getProtocol().equalsIgnoreCase(rule.getProtocol())) {
|
||||
if (newRule.getIcmpCode().longValue() == rule.getIcmpCode().longValue()
|
||||
&& newRule.getIcmpType().longValue() == rule.getIcmpType().longValue()
|
||||
&& newRule.getProtocol().equalsIgnoreCase(rule.getProtocol()) && duplicatedCidrs) {
|
||||
|
|
@ -264,10 +267,14 @@ public class NetworkACLManagerImpl implements Manager,NetworkACLManager{
|
|||
if (!notNullPorts) {
|
||||
continue;
|
||||
} else if (duplicatedCidrs
|
||||
&& ((rule.getSourcePortStart().intValue() <= newRule.getSourcePortStart().intValue() && rule.getSourcePortEnd().intValue() >= newRule.getSourcePortStart().intValue())
|
||||
|| (rule.getSourcePortStart().intValue() <= newRule.getSourcePortEnd().intValue() && rule.getSourcePortEnd().intValue() >= newRule.getSourcePortEnd().intValue())
|
||||
|| (newRule.getSourcePortStart().intValue() <= rule.getSourcePortStart().intValue() && newRule.getSourcePortEnd().intValue() >= rule.getSourcePortStart().intValue())
|
||||
|| (newRule.getSourcePortStart().intValue() <= rule.getSourcePortEnd().intValue() && newRule.getSourcePortEnd().intValue() >= rule.getSourcePortEnd().intValue()))) {
|
||||
&& ((rule.getSourcePortStart().intValue() <= newRule.getSourcePortStart().intValue()
|
||||
&& rule.getSourcePortEnd().intValue() >= newRule.getSourcePortStart().intValue())
|
||||
|| (rule.getSourcePortStart().intValue() <= newRule.getSourcePortEnd().intValue()
|
||||
&& rule.getSourcePortEnd().intValue() >= newRule.getSourcePortEnd().intValue())
|
||||
|| (newRule.getSourcePortStart().intValue() <= rule.getSourcePortStart().intValue()
|
||||
&& newRule.getSourcePortEnd().intValue() >= rule.getSourcePortStart().intValue())
|
||||
|| (newRule.getSourcePortStart().intValue() <= rule.getSourcePortEnd().intValue()
|
||||
&& newRule.getSourcePortEnd().intValue() >= rule.getSourcePortEnd().intValue()))) {
|
||||
|
||||
throw new NetworkRuleConflictException("The range specified, " + newRule.getSourcePortStart() + "-"
|
||||
+ newRule.getSourcePortEnd() + ", conflicts with rule " + rule.getId()
|
||||
|
|
@ -277,7 +284,8 @@ public class NetworkACLManagerImpl implements Manager,NetworkACLManager{
|
|||
}
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("No network rule conflicts detected for " + newRule + " against " + (rules.size() - 1) + " existing network ACLs");
|
||||
s_logger.debug("No network rule conflicts detected for " + newRule + " against " + (rules.size() - 1)
|
||||
+ " existing network ACLs");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -312,6 +320,7 @@ public class NetworkACLManagerImpl implements Manager,NetworkACLManager{
|
|||
return success;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FirewallRule getNetworkACL(long ACLId) {
|
||||
FirewallRule rule = _firewallDao.findById(ACLId);
|
||||
|
|
@ -321,6 +330,7 @@ public class NetworkACLManagerImpl implements Manager,NetworkACLManager{
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<? extends FirewallRule> listNetworkACLs(ListNetworkACLsCmd cmd) {
|
||||
Long networkId = cmd.getNetworkId();
|
||||
|
|
@ -396,6 +406,7 @@ public class NetworkACLManagerImpl implements Manager,NetworkACLManager{
|
|||
return _firewallDao.listByNetworkAndPurpose(guestNtwkId, Purpose.NetworkACL);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean revokeAllNetworkACLsForNetwork(long networkId, long userId, Account caller) throws ResourceUnavailableException {
|
||||
|
||||
|
|
@ -422,7 +433,8 @@ public class NetworkACLManagerImpl implements Manager,NetworkACLManager{
|
|||
boolean success = _firewallMgr.applyFirewallRules(ACLsToRevoke, false, caller);
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Successfully released Network ACLs for network id=" + networkId + " and # of rules now = " + ACLs.size());
|
||||
s_logger.debug("Successfully released Network ACLs for network id=" + networkId + " and # of rules now = "
|
||||
+ ACLs.size());
|
||||
}
|
||||
|
||||
return success;
|
||||
|
|
|
|||
|
|
@ -13,15 +13,9 @@
|
|||
package com.cloud.network.vpc;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.element.VpcProvider;
|
||||
import com.cloud.network.vpc.VpcOffering.State;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.vm.DomainRouterVO;
|
||||
|
|
@ -32,38 +26,6 @@ import com.cloud.vm.DomainRouterVO;
|
|||
*/
|
||||
public interface VpcManager extends VpcService{
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param displayText
|
||||
* @param svcProviderMap
|
||||
* @param isDefault
|
||||
* @param state TODO
|
||||
* @return
|
||||
*/
|
||||
VpcOffering createVpcOffering(String name, String displayText, Map<Service, Set<Provider>> svcProviderMap,
|
||||
boolean isDefault, State state);
|
||||
|
||||
/**
|
||||
* @param vpcOffId
|
||||
* @param services
|
||||
* @return
|
||||
*/
|
||||
boolean areServicesSupportedByVpcOffering(long vpcOffId, Service[] services);
|
||||
|
||||
/**
|
||||
* @param zoneId
|
||||
* @param vpcOffId
|
||||
* @param vpcOwner
|
||||
* @param vpcName
|
||||
* @param displayText
|
||||
* @param cidr
|
||||
* @param networkDomain TODO
|
||||
* @return
|
||||
*/
|
||||
Vpc createVpc(long zoneId, long vpcOffId, Account vpcOwner, String vpcName, String displayText, String cidr, String networkDomain);
|
||||
|
||||
List<Service> getSupportedServices();
|
||||
|
||||
/**
|
||||
* @param guestNtwkOff
|
||||
* @param cidr
|
||||
|
|
@ -77,10 +39,6 @@ public interface VpcManager extends VpcService{
|
|||
void validateGuestNtkwForVpc(NetworkOffering guestNtwkOff, String cidr, String networkDomain, Account networkOwner,
|
||||
Vpc vpc, Long networkId, String gateway);
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
VpcProvider getVpcElement();
|
||||
|
||||
List<? extends Vpc> getVpcsForAccount(long accountId);
|
||||
|
||||
|
|
@ -110,8 +68,4 @@ public interface VpcManager extends VpcService{
|
|||
*/
|
||||
VpcGateway getPrivateGatewayForVpc(long vpcId);
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
int getMaxNetworksPerVpc();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,9 +270,8 @@ public class VpcManagerImpl implements VpcManager, Manager{
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public VpcOffering createVpcOffering(String name, String displayText, Map<Network.Service,
|
||||
protected VpcOffering createVpcOffering(String name, String displayText, Map<Network.Service,
|
||||
Set<Network.Provider>> svcProviderMap, boolean isDefault, State state) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
|
@ -405,8 +404,7 @@ public class VpcManagerImpl implements VpcManager, Manager{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areServicesSupportedByVpcOffering(long vpcOffId, Service... services) {
|
||||
protected boolean areServicesSupportedByVpcOffering(long vpcOffId, Service... services) {
|
||||
return (_vpcOffSvcMapDao.areServicesSupportedByNetworkOffering(vpcOffId, services));
|
||||
}
|
||||
|
||||
|
|
@ -539,8 +537,7 @@ public class VpcManagerImpl implements VpcManager, Manager{
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vpc createVpc(long zoneId, long vpcOffId, Account vpcOwner, String vpcName, String displayText, String cidr,
|
||||
protected Vpc createVpc(long zoneId, long vpcOffId, Account vpcOwner, String vpcName, String displayText, String cidr,
|
||||
String networkDomain) {
|
||||
|
||||
if (!vpcProviderEnabledInZone(zoneId)) {
|
||||
|
|
@ -802,8 +799,8 @@ public class VpcManagerImpl implements VpcManager, Manager{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Service> getSupportedServices() {
|
||||
|
||||
protected List<Service> getSupportedServices() {
|
||||
List<Service> services = new ArrayList<Service>();
|
||||
services.add(Network.Service.Dhcp);
|
||||
services.add(Network.Service.Dns);
|
||||
|
|
@ -894,7 +891,7 @@ public class VpcManagerImpl implements VpcManager, Manager{
|
|||
//shutdown provider
|
||||
boolean success = getVpcElement().shutdownVpc(vpc);
|
||||
|
||||
//FIXME - once more features are added to vpc (gateway/firewall rules, etc - cleanup them here)
|
||||
//TODO - cleanup all vpc resources here (ACLs, gateways, etc)
|
||||
if (success) {
|
||||
s_logger.debug("Vpc " + vpc + " has been shutdown succesfully");
|
||||
} else {
|
||||
|
|
@ -1038,8 +1035,8 @@ public class VpcManagerImpl implements VpcManager, Manager{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VpcProvider getVpcElement() {
|
||||
|
||||
protected VpcProvider getVpcElement() {
|
||||
if (vpcElement == null) {
|
||||
vpcElement = ((VpcProvider)_ntwkMgr.getElementImplementingProvider(Provider.VPCVirtualRouter.getName()));
|
||||
}
|
||||
|
|
@ -1681,9 +1678,4 @@ public class VpcManagerImpl implements VpcManager, Manager{
|
|||
return _vpcGatewayDao.getPrivateGatewayForVpc(vpcId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxNetworksPerVpc() {
|
||||
return _maxNetworks;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue