|
18 | 18 |
|
19 | 19 | import com.cloud.dc.VlanDetailsVO; |
20 | 20 | import com.cloud.dc.dao.VlanDetailsDao; |
| 21 | +import com.cloud.deploy.DeploymentPlan; |
21 | 22 | import com.cloud.exception.ConcurrentOperationException; |
22 | 23 | import com.cloud.exception.InsufficientAddressCapacityException; |
23 | 24 | import com.cloud.exception.InsufficientVirtualNetworkCapacityException; |
24 | 25 | import com.cloud.network.Network; |
| 26 | +import com.cloud.network.Networks; |
25 | 27 | import com.cloud.network.dao.IPAddressVO; |
| 28 | +import com.cloud.network.dao.NetworkVO; |
26 | 29 | import com.cloud.network.guru.PublicNetworkGuru; |
27 | 30 | import com.cloud.network.vpc.VpcVO; |
28 | 31 | import com.cloud.network.vpc.dao.VpcDao; |
29 | 32 | import com.cloud.network.vpc.dao.VpcOfferingServiceMapDao; |
| 33 | +import com.cloud.offering.NetworkOffering; |
| 34 | +import com.cloud.user.Account; |
30 | 35 | import com.cloud.utils.exception.CloudRuntimeException; |
31 | 36 | import com.cloud.vm.NicProfile; |
32 | 37 | import com.cloud.vm.VirtualMachineProfile; |
@@ -58,6 +63,26 @@ public NsxPublicNetworkGuru() { |
58 | 63 | super(); |
59 | 64 | } |
60 | 65 |
|
| 66 | + protected boolean canHandle(NetworkOffering offering) { |
| 67 | + return isMyTrafficType(offering.getTrafficType()) && offering.isSystemOnly() && offering.isForNsx(); |
| 68 | + } |
| 69 | + |
| 70 | + @Override |
| 71 | + public Network design(NetworkOffering offering, DeploymentPlan plan, Network network, String name, Long vpcId, Account owner) { |
| 72 | + if (!canHandle(offering)) { |
| 73 | + return null; |
| 74 | + } |
| 75 | + |
| 76 | + if (offering.getTrafficType() == Networks.TrafficType.Public) { |
| 77 | + NetworkVO ntwk = |
| 78 | + new NetworkVO(offering.getTrafficType(), Networks.Mode.Static, network.getBroadcastDomainType(), offering.getId(), Network.State.Setup, plan.getDataCenterId(), |
| 79 | + plan.getPhysicalNetworkId(), offering.isRedundantRouter()); |
| 80 | + return ntwk; |
| 81 | + } else { |
| 82 | + return null; |
| 83 | + } |
| 84 | + } |
| 85 | + |
61 | 86 | @Override |
62 | 87 | public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException { |
63 | 88 | s_logger.debug("NSX Public network guru: allocate"); |
|
0 commit comments