|
37 | 37 | import javax.inject.Inject; |
38 | 38 | import javax.naming.ConfigurationException; |
39 | 39 |
|
40 | | -import com.cloud.network.Networks; |
41 | | - |
42 | | -import org.apache.log4j.Logger; |
43 | 40 | import org.apache.cloudstack.acl.ControlledEntity.ACLType; |
44 | 41 | import org.apache.cloudstack.context.CallContext; |
45 | 42 | import org.apache.cloudstack.engine.cloud.entity.api.db.VMNetworkMapVO; |
46 | 43 | import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMNetworkMapDao; |
47 | 44 | import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; |
48 | 45 | import org.apache.cloudstack.framework.config.ConfigDepot; |
49 | 46 | import org.apache.cloudstack.framework.config.ConfigKey; |
50 | | -import org.apache.cloudstack.framework.config.Configurable; |
51 | 47 | import org.apache.cloudstack.framework.config.ConfigKey.Scope; |
| 48 | +import org.apache.cloudstack.framework.config.Configurable; |
52 | 49 | import org.apache.cloudstack.framework.config.dao.ConfigurationDao; |
53 | 50 | import org.apache.cloudstack.framework.messagebus.MessageBus; |
54 | 51 | import org.apache.cloudstack.framework.messagebus.PublishScope; |
55 | 52 | import org.apache.cloudstack.managed.context.ManagedContextRunnable; |
56 | 53 | import org.apache.cloudstack.region.PortableIpDao; |
| 54 | +import org.apache.log4j.Logger; |
57 | 55 |
|
58 | 56 | import com.cloud.agent.AgentManager; |
59 | 57 | import com.cloud.agent.Listener; |
|
111 | 109 | import com.cloud.network.NetworkModel; |
112 | 110 | import com.cloud.network.NetworkProfile; |
113 | 111 | import com.cloud.network.NetworkStateListener; |
| 112 | +import com.cloud.network.Networks; |
114 | 113 | import com.cloud.network.Networks.BroadcastDomainType; |
115 | 114 | import com.cloud.network.Networks.TrafficType; |
116 | 115 | import com.cloud.network.PhysicalNetwork; |
@@ -839,16 +838,16 @@ protected Integer applyProfileToNic(NicVO vo, NicProfile profile, Integer device |
839 | 838 |
|
840 | 839 | vo.setDefaultNic(profile.isDefaultNic()); |
841 | 840 |
|
842 | | - vo.setIp4Address(profile.getIp4Address()); |
| 841 | + vo.setIp4Address(profile.getIPv4Address()); |
843 | 842 | vo.setAddressFormat(profile.getFormat()); |
844 | 843 |
|
845 | 844 | if (profile.getMacAddress() != null) { |
846 | 845 | vo.setMacAddress(profile.getMacAddress()); |
847 | 846 | } |
848 | 847 |
|
849 | 848 | vo.setMode(profile.getMode()); |
850 | | - vo.setNetmask(profile.getNetmask()); |
851 | | - vo.setGateway(profile.getGateway()); |
| 849 | + vo.setNetmask(profile.getIPv4Netmask()); |
| 850 | + vo.setGateway(profile.getIPv4Gateway()); |
852 | 851 |
|
853 | 852 | if (profile.getBroadCastUri() != null) { |
854 | 853 | vo.setBroadcastUri(profile.getBroadCastUri()); |
@@ -860,25 +859,25 @@ protected Integer applyProfileToNic(NicVO vo, NicProfile profile, Integer device |
860 | 859 |
|
861 | 860 | vo.setState(Nic.State.Allocated); |
862 | 861 |
|
863 | | - vo.setIp6Address(profile.getIp6Address()); |
864 | | - vo.setIp6Gateway(profile.getIp6Gateway()); |
865 | | - vo.setIp6Cidr(profile.getIp6Cidr()); |
| 862 | + vo.setIp6Address(profile.getIPv6Address()); |
| 863 | + vo.setIp6Gateway(profile.getIPv6Gateway()); |
| 864 | + vo.setIp6Cidr(profile.getIPv6Cidr()); |
866 | 865 |
|
867 | 866 | return deviceId; |
868 | 867 | } |
869 | 868 |
|
870 | 869 | protected void applyProfileToNicForRelease(NicVO vo, NicProfile profile) { |
871 | | - vo.setGateway(profile.getGateway()); |
| 870 | + vo.setGateway(profile.getIPv4Gateway()); |
872 | 871 | vo.setAddressFormat(profile.getFormat()); |
873 | | - vo.setIp4Address(profile.getIp4Address()); |
874 | | - vo.setIp6Address(profile.getIp6Address()); |
| 872 | + vo.setIp4Address(profile.getIPv4Address()); |
| 873 | + vo.setIp6Address(profile.getIPv6Address()); |
875 | 874 | vo.setMacAddress(profile.getMacAddress()); |
876 | 875 | if (profile.getReservationStrategy() != null) { |
877 | 876 | vo.setReservationStrategy(profile.getReservationStrategy()); |
878 | 877 | } |
879 | 878 | vo.setBroadcastUri(profile.getBroadCastUri()); |
880 | 879 | vo.setIsolationUri(profile.getIsolationUri()); |
881 | | - vo.setNetmask(profile.getNetmask()); |
| 880 | + vo.setNetmask(profile.getIPv4Netmask()); |
882 | 881 | } |
883 | 882 |
|
884 | 883 | protected void applyProfileToNetwork(NetworkVO network, NetworkProfile profile) { |
@@ -896,8 +895,8 @@ protected NicTO toNicTO(NicVO nic, NicProfile profile, NetworkVO config) { |
896 | 895 | to.setIp(nic.getIp4Address()); |
897 | 896 | to.setNetmask(nic.getNetmask()); |
898 | 897 | to.setMac(nic.getMacAddress()); |
899 | | - to.setDns1(profile.getDns1()); |
900 | | - to.setDns2(profile.getDns2()); |
| 898 | + to.setDns1(profile.getIPv4Dns1()); |
| 899 | + to.setDns2(profile.getIPv4Dns2()); |
901 | 900 | if (nic.getGateway() != null) { |
902 | 901 | to.setGateway(nic.getGateway()); |
903 | 902 | } else { |
@@ -910,8 +909,8 @@ protected NicTO toNicTO(NicVO nic, NicProfile profile, NetworkVO config) { |
910 | 909 | to.setBroadcastUri(nic.getBroadcastUri()); |
911 | 910 | to.setIsolationuri(nic.getIsolationUri()); |
912 | 911 | if (profile != null) { |
913 | | - to.setDns1(profile.getDns1()); |
914 | | - to.setDns2(profile.getDns2()); |
| 912 | + to.setDns1(profile.getIPv4Dns1()); |
| 913 | + to.setDns2(profile.getIPv4Dns2()); |
915 | 914 | } |
916 | 915 |
|
917 | 916 | Integer networkRate = _networkModel.getNetworkRate(config.getId(), null); |
@@ -1240,7 +1239,7 @@ protected boolean prepareElement(NetworkElement element, Network network, NicPro |
1240 | 1239 | DhcpServiceProvider sp = (DhcpServiceProvider)element; |
1241 | 1240 | Map<Capability, String> dhcpCapabilities = element.getCapabilities().get(Service.Dhcp); |
1242 | 1241 | String supportsMultipleSubnets = dhcpCapabilities.get(Capability.DhcpAccrossMultipleSubnets); |
1243 | | - if ((supportsMultipleSubnets != null && Boolean.valueOf(supportsMultipleSubnets)) && profile.getIp6Address() == null) { |
| 1242 | + if ((supportsMultipleSubnets != null && Boolean.valueOf(supportsMultipleSubnets)) && profile.getIPv6Address() == null) { |
1244 | 1243 | if (!sp.configDhcpSupportForSubnet(network, profile, vmProfile, dest, context)) { |
1245 | 1244 | return false; |
1246 | 1245 | } |
@@ -1333,19 +1332,19 @@ public NicProfile prepareNic(VirtualMachineProfile vmProfile, DeployDestination |
1333 | 1332 |
|
1334 | 1333 | networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network)); |
1335 | 1334 | guru.reserve(profile, network, vmProfile, dest, context); |
1336 | | - nic.setIp4Address(profile.getIp4Address()); |
| 1335 | + nic.setIp4Address(profile.getIPv4Address()); |
1337 | 1336 | nic.setAddressFormat(profile.getFormat()); |
1338 | | - nic.setIp6Address(profile.getIp6Address()); |
| 1337 | + nic.setIp6Address(profile.getIPv6Address()); |
1339 | 1338 | nic.setMacAddress(profile.getMacAddress()); |
1340 | 1339 | nic.setIsolationUri(profile.getIsolationUri()); |
1341 | 1340 | nic.setBroadcastUri(profile.getBroadCastUri()); |
1342 | 1341 | nic.setReserver(guru.getName()); |
1343 | 1342 | nic.setState(Nic.State.Reserved); |
1344 | | - nic.setNetmask(profile.getNetmask()); |
1345 | | - nic.setGateway(profile.getGateway()); |
| 1343 | + nic.setNetmask(profile.getIPv4Netmask()); |
| 1344 | + nic.setGateway(profile.getIPv4Gateway()); |
1346 | 1345 |
|
1347 | | - if (profile.getStrategy() != null) { |
1348 | | - nic.setReservationStrategy(profile.getStrategy()); |
| 1346 | + if (profile.getReservationStrategy() != null) { |
| 1347 | + nic.setReservationStrategy(profile.getReservationStrategy()); |
1349 | 1348 | } |
1350 | 1349 |
|
1351 | 1350 | updateNic(nic, network.getId(), 1); |
@@ -1478,9 +1477,9 @@ public void prepareAllNicsForMigration(VirtualMachineProfile vm, DeployDestinati |
1478 | 1477 | NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName()); |
1479 | 1478 | NicProfile profile = new NicProfile(); |
1480 | 1479 | profile.setDeviceId(255); //dummyId |
1481 | | - profile.setIp4Address(userIp.getAddress().toString()); |
1482 | | - profile.setNetmask(publicIp.getNetmask()); |
1483 | | - profile.setGateway(publicIp.getGateway()); |
| 1480 | + profile.setIPv4Address(userIp.getAddress().toString()); |
| 1481 | + profile.setIPv4Netmask(publicIp.getNetmask()); |
| 1482 | + profile.setIPv4Gateway(publicIp.getGateway()); |
1484 | 1483 | profile.setMacAddress(publicIp.getMacAddress()); |
1485 | 1484 | profile.setBroadcastType(network.getBroadcastDomainType()); |
1486 | 1485 | profile.setTrafficType(network.getTrafficType()); |
@@ -3116,7 +3115,7 @@ protected NicProfile getNicProfileForVm(Network network, NicProfile requested, V |
3116 | 3115 | NicProfile nic = null; |
3117 | 3116 | if (requested != null && requested.getBroadCastUri() != null) { |
3118 | 3117 | String broadcastUri = requested.getBroadCastUri().toString(); |
3119 | | - String ipAddress = requested.getIp4Address(); |
| 3118 | + String ipAddress = requested.getIPv4Address(); |
3120 | 3119 | NicVO nicVO = _nicDao.findByNetworkIdInstanceIdAndBroadcastUri(network.getId(), vm.getId(), broadcastUri); |
3121 | 3120 | if (nicVO != null) { |
3122 | 3121 | if (ipAddress == null || nicVO.getIp4Address().equals(ipAddress)) { |
|