You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2015/08/17 15:24:52 UTC
[2/4] git commit: updated refs/heads/master to bc51a42
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index d2f6fd2..54ae382 100644
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -30,11 +30,6 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import org.apache.log4j.Logger;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
import org.apache.cloudstack.config.ApiServiceConfiguration;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
@@ -47,6 +42,7 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
+import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Answer;
@@ -141,6 +137,8 @@ import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.dao.ConsoleProxyDao;
import com.cloud.vm.dao.UserVmDetailsDao;
import com.cloud.vm.dao.VMInstanceDao;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
//
// Possible console proxy state transition cases
@@ -1330,16 +1328,16 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
for (NicProfile nic : profile.getNics()) {
int deviceId = nic.getDeviceId();
- if (nic.getIp4Address() == null) {
+ if (nic.getIPv4Address() == null) {
buf.append(" eth").append(deviceId).append("ip=").append("0.0.0.0");
buf.append(" eth").append(deviceId).append("mask=").append("0.0.0.0");
} else {
- buf.append(" eth").append(deviceId).append("ip=").append(nic.getIp4Address());
- buf.append(" eth").append(deviceId).append("mask=").append(nic.getNetmask());
+ buf.append(" eth").append(deviceId).append("ip=").append(nic.getIPv4Address());
+ buf.append(" eth").append(deviceId).append("mask=").append(nic.getIPv4Netmask());
}
if (nic.isDefaultNic()) {
- buf.append(" gateway=").append(nic.getGateway());
+ buf.append(" gateway=").append(nic.getIPv4Gateway());
}
if (nic.getTrafficType() == TrafficType.Management) {
@@ -1384,11 +1382,11 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
for (NicProfile nic : nics) {
if ((nic.getTrafficType() == TrafficType.Public && dc.getNetworkType() == NetworkType.Advanced) ||
(nic.getTrafficType() == TrafficType.Guest && (dc.getNetworkType() == NetworkType.Basic || dc.isSecurityGroupEnabled()))) {
- proxy.setPublicIpAddress(nic.getIp4Address());
- proxy.setPublicNetmask(nic.getNetmask());
+ proxy.setPublicIpAddress(nic.getIPv4Address());
+ proxy.setPublicNetmask(nic.getIPv4Netmask());
proxy.setPublicMacAddress(nic.getMacAddress());
} else if (nic.getTrafficType() == TrafficType.Management) {
- proxy.setPrivateIpAddress(nic.getIp4Address());
+ proxy.setPrivateIpAddress(nic.getIPv4Address());
proxy.setPrivateMacAddress(nic.getMacAddress());
}
}
@@ -1404,7 +1402,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
for (NicProfile nic : profile.getNics()) {
if (nic.getTrafficType() == TrafficType.Management) {
managementNic = nic;
- } else if (nic.getTrafficType() == TrafficType.Control && nic.getIp4Address() != null) {
+ } else if (nic.getTrafficType() == TrafficType.Control && nic.getIPv4Address() != null) {
controlNic = nic;
}
}
@@ -1422,7 +1420,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
controlNic = managementNic;
}
- CheckSshCommand check = new CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922);
+ CheckSshCommand check = new CheckSshCommand(profile.getInstanceName(), controlNic.getIPv4Address(), 3922);
cmds.addCommand("checkSsh", check);
return true;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
index 72c24da..fb14dc4 100644
--- a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
+++ b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
@@ -85,12 +85,12 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
to.setDeviceId(profile.getDeviceId());
to.setBroadcastType(profile.getBroadcastType());
to.setType(profile.getTrafficType());
- to.setIp(profile.getIp4Address());
- to.setNetmask(profile.getNetmask());
+ to.setIp(profile.getIPv4Address());
+ to.setNetmask(profile.getIPv4Netmask());
to.setMac(profile.getMacAddress());
- to.setDns1(profile.getDns1());
- to.setDns2(profile.getDns2());
- to.setGateway(profile.getGateway());
+ to.setDns1(profile.getIPv4Dns1());
+ to.setDns2(profile.getIPv4Dns2());
+ to.setGateway(profile.getIPv4Gateway());
to.setDefaultNic(profile.isDefaultNic());
to.setBroadcastUri(profile.getBroadCastUri());
to.setIsolationuri(profile.getIsolationUri());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/IpAddressManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java b/server/src/com/cloud/network/IpAddressManagerImpl.java
index 552e56b..e1a6825 100644
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@ -1845,7 +1845,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
boolean ipv4 = false;
if (network.getGateway() != null) {
- if (nic.getIp4Address() == null) {
+ if (nic.getIPv4Address() == null) {
ipv4 = true;
PublicIp ip = null;
@@ -1863,9 +1863,9 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
ip = assignPublicIpAddress(dc.getId(), null, vm.getOwner(), VlanType.DirectAttached, network.getId(), requestedIpv4, false);
}
- nic.setIp4Address(ip.getAddress().toString());
- nic.setGateway(ip.getGateway());
- nic.setNetmask(ip.getNetmask());
+ nic.setIPv4Address(ip.getAddress().toString());
+ nic.setIPv4Gateway(ip.getGateway());
+ nic.setIPv4Netmask(ip.getNetmask());
nic.setIsolationUri(IsolationType.Vlan.toUri(ip.getVlanTag()));
//nic.setBroadcastType(BroadcastDomainType.Vlan);
//nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(ip.getVlanTag()));
@@ -1878,18 +1878,18 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
nic.setReservationId(String.valueOf(ip.getVlanTag()));
nic.setMacAddress(ip.getMacAddress());
}
- nic.setDns1(dc.getDns1());
- nic.setDns2(dc.getDns2());
+ nic.setIPv4Dns1(dc.getDns1());
+ nic.setIPv4Dns2(dc.getDns2());
}
//FIXME - get ipv6 address from the placeholder if it's stored there
if (network.getIp6Gateway() != null) {
- if (nic.getIp6Address() == null) {
+ if (nic.getIPv6Address() == null) {
UserIpv6Address ip = _ipv6Mgr.assignDirectIp6Address(dc.getId(), vm.getOwner(), network.getId(), requestedIpv6);
Vlan vlan = _vlanDao.findById(ip.getVlanId());
- nic.setIp6Address(ip.getAddress().toString());
- nic.setIp6Gateway(vlan.getIp6Gateway());
- nic.setIp6Cidr(vlan.getIp6Cidr());
+ nic.setIPv6Address(ip.getAddress().toString());
+ nic.setIPv6Gateway(vlan.getIp6Gateway());
+ nic.setIPv6Cidr(vlan.getIp6Cidr());
if (ipv4) {
nic.setFormat(AddressFormat.DualStack);
} else {
@@ -1901,8 +1901,8 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
nic.setMacAddress(ip.getMacAddress());
}
}
- nic.setIp6Dns1(dc.getIp6Dns1());
- nic.setIp6Dns2(dc.getIp6Dns2());
+ nic.setIPv6Dns1(dc.getIp6Dns1());
+ nic.setIPv6Dns2(dc.getIp6Dns2());
}
}
});
@@ -1922,7 +1922,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
boolean ipv4 = false;
if (network.getGateway() != null) {
- if (nic.getIp4Address() == null) {
+ if (nic.getIPv4Address() == null) {
ipv4 = true;
// PublicIp ip = null;
@@ -1933,8 +1933,8 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
}
// nic ip address isn ot set here. Because the DHCP is external to cloudstack
- nic.setGateway(network.getGateway());
- nic.setNetmask(network.getCidr());
+ nic.setIPv4Gateway(network.getGateway());
+ nic.setIPv4Netmask(network.getCidr());
List<VlanVO> vlan = _vlanDao.listVlansByNetworkId(network.getId());
@@ -1951,19 +1951,19 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
nic.setMacAddress(_networkModel.getNextAvailableMacAddressInNetwork(network.getId()));
}
- nic.setDns1(dc.getDns1());
- nic.setDns2(dc.getDns2());
+ nic.setIPv4Dns1(dc.getDns1());
+ nic.setIPv4Dns2(dc.getDns2());
}
// TODO: the IPv6 logic is not changed.
//FIXME - get ipv6 address from the placeholder if it's stored there
if (network.getIp6Gateway() != null) {
- if (nic.getIp6Address() == null) {
+ if (nic.getIPv6Address() == null) {
UserIpv6Address ip = _ipv6Mgr.assignDirectIp6Address(dc.getId(), vm.getOwner(), network.getId(), requestedIpv6);
Vlan vlan = _vlanDao.findById(ip.getVlanId());
- nic.setIp6Address(ip.getAddress().toString());
- nic.setIp6Gateway(vlan.getIp6Gateway());
- nic.setIp6Cidr(vlan.getIp6Cidr());
+ nic.setIPv6Address(ip.getAddress().toString());
+ nic.setIPv6Gateway(vlan.getIp6Gateway());
+ nic.setIPv6Cidr(vlan.getIp6Cidr());
if (ipv4) {
nic.setFormat(AddressFormat.DualStack);
} else {
@@ -1975,8 +1975,8 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
nic.setMacAddress(ip.getMacAddress());
}
}
- nic.setIp6Dns1(dc.getIp6Dns1());
- nic.setIp6Dns2(dc.getIp6Dns2());
+ nic.setIPv6Dns1(dc.getIp6Dns1());
+ nic.setIPv6Dns2(dc.getIp6Dns2());
}
}
});
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/CloudZonesNetworkElement.java b/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
index c748991..5dfc127 100644
--- a/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
+++ b/server/src/com/cloud/network/element/CloudZonesNetworkElement.java
@@ -214,7 +214,7 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
Commands cmds = new Commands(Command.OnError.Continue);
if (password != null && nic.isDefaultNic()) {
- SavePasswordCommand cmd = new SavePasswordCommand(password, nic.getIp4Address(), uservm.getHostName(), _networkMgr.getExecuteInSeqNtwkElmtCmd());
+ SavePasswordCommand cmd = new SavePasswordCommand(password, nic.getIPv4Address(), uservm.getHostName(), _networkMgr.getExecuteInSeqNtwkElmtCmd());
cmds.addCommand("password", cmd);
}
String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(uservm.getServiceOfferingId()).getDisplayText();
@@ -222,7 +222,7 @@ public class CloudZonesNetworkElement extends AdapterBase implements NetworkElem
cmds.addCommand(
"vmdata",
- generateVmDataCommand(nic.getIp4Address(), userData, serviceOffering, zoneName, nic.getIp4Address(), uservm.getHostName(), uservm.getInstanceName(),
+ generateVmDataCommand(nic.getIPv4Address(), userData, serviceOffering, zoneName, nic.getIPv4Address(), uservm.getHostName(), uservm.getInstanceName(),
uservm.getId(), uservm.getUuid(), sshPublicKey));
try {
_agentManager.send(dest.getHost().getId(), cmds);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/guru/ControlNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/ControlNetworkGuru.java b/server/src/com/cloud/network/guru/ControlNetworkGuru.java
index 355842c..5e80bea 100644
--- a/server/src/com/cloud/network/guru/ControlNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ControlNetworkGuru.java
@@ -22,9 +22,8 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.log4j.Logger;
import com.cloud.configuration.Config;
import com.cloud.dc.DataCenter;
@@ -151,10 +150,10 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
// in basic mode and in VMware case, control network will be shared with guest network
String mac = _networkMgr.getNextAvailableMacAddressInNetwork(config.getId());
nic.setMacAddress(mac);
- nic.setIp4Address("0.0.0.0");
- nic.setNetmask("0.0.0.0");
+ nic.setIPv4Address("0.0.0.0");
+ nic.setIPv4Netmask("0.0.0.0");
nic.setFormat(AddressFormat.Ip4);
- nic.setGateway("0.0.0.0");
+ nic.setIPv4Gateway("0.0.0.0");
return;
}
}
@@ -163,11 +162,11 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
if (ip == null) {
throw new InsufficientAddressCapacityException("Insufficient link local address capacity", DataCenter.class, dest.getDataCenter().getId());
}
- nic.setIp4Address(ip);
+ nic.setIPv4Address(ip);
nic.setMacAddress(NetUtils.long2Mac(NetUtils.ip2Long(ip) | (14l << 40)));
- nic.setNetmask("255.255.0.0");
+ nic.setIPv4Netmask("255.255.0.0");
nic.setFormat(AddressFormat.Ip4);
- nic.setGateway(NetUtils.getLinkLocalGateway());
+ nic.setIPv4Gateway(NetUtils.getLinkLocalGateway());
}
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/guru/DirectNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/DirectNetworkGuru.java b/server/src/com/cloud/network/guru/DirectNetworkGuru.java
index 18f7641..41718fc 100644
--- a/server/src/com/cloud/network/guru/DirectNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/DirectNetworkGuru.java
@@ -21,10 +21,8 @@ import java.util.List;
import javax.ejb.Local;
import javax.inject.Inject;
-import com.cloud.utils.exception.CloudRuntimeException;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
+import org.apache.log4j.Logger;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
@@ -48,6 +46,10 @@ import com.cloud.network.NetworkProfile;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.network.dao.IPAddressVO;
+import com.cloud.network.dao.NetworkVO;
+import com.cloud.network.dao.UserIpv6AddressDao;
import com.cloud.offering.NetworkOffering;
import com.cloud.offerings.dao.NetworkOfferingDao;
import com.cloud.user.Account;
@@ -57,6 +59,7 @@ import com.cloud.utils.db.Transaction;
import com.cloud.utils.db.TransactionCallbackNoReturn;
import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
import com.cloud.utils.db.TransactionStatus;
+import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.exception.ExceptionUtil;
import com.cloud.vm.Nic;
import com.cloud.vm.Nic.ReservationStrategy;
@@ -67,10 +70,6 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.dao.NicDao;
import com.cloud.vm.dao.NicSecondaryIpDao;
-import com.cloud.network.dao.IPAddressDao;
-import com.cloud.network.dao.IPAddressVO;
-import com.cloud.network.dao.NetworkVO;
-import com.cloud.network.dao.UserIpv6AddressDao;
@Local(value = {NetworkGuru.class})
@@ -194,10 +193,10 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
public void updateNicProfile(NicProfile profile, Network network) {
DataCenter dc = _dcDao.findById(network.getDataCenterId());
if (profile != null) {
- profile.setDns1(dc.getDns1());
- profile.setDns2(dc.getDns2());
- profile.setIp6Dns1(dc.getIp6Dns1());
- profile.setIp6Dns2(dc.getIp6Dns2());
+ profile.setIPv4Dns1(dc.getDns1());
+ profile.setIPv4Dns2(dc.getDns2());
+ profile.setIPv6Dns1(dc.getIp6Dns1());
+ profile.setIPv6Dns2(dc.getIp6Dns2());
}
}
@@ -209,14 +208,14 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
if (nic == null) {
nic = new NicProfile(ReservationStrategy.Create, null, null, null, null);
- } else if (nic.getIp4Address() == null && nic.getIp6Address() == null) {
- nic.setStrategy(ReservationStrategy.Start);
+ } else if (nic.getIPv4Address() == null && nic.getIPv6Address() == null) {
+ nic.setReservationStrategy(ReservationStrategy.Start);
} else {
- nic.setStrategy(ReservationStrategy.Create);
+ nic.setReservationStrategy(ReservationStrategy.Create);
}
- allocateDirectIp(nic, network, vm, dc, nic.getRequestedIpv4(), nic.getRequestedIpv6());
- nic.setStrategy(ReservationStrategy.Create);
+ allocateDirectIp(nic, network, vm, dc, nic.getRequestedIPv4(), nic.getRequestedIPv6());
+ nic.setReservationStrategy(ReservationStrategy.Create);
if (nic.getMacAddress() == null) {
nic.setMacAddress(_networkModel.getNextAvailableMacAddressInNetwork(network.getId()));
@@ -231,9 +230,9 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
@Override
public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException {
- if (nic.getIp4Address() == null && nic.getIp6Address() == null) {
+ if (nic.getIPv4Address() == null && nic.getIPv6Address() == null) {
allocateDirectIp(nic, network, vm, dest.getDataCenter(), null, null);
- nic.setStrategy(ReservationStrategy.Create);
+ nic.setReservationStrategy(ReservationStrategy.Create);
}
}
@@ -254,9 +253,9 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
if (vm.getType() == VirtualMachine.Type.DomainRouter) {
Nic placeholderNic = _networkModel.getPlaceholderNicForRouter(network, null);
if (placeholderNic == null) {
- s_logger.debug("Saving placeholder nic with ip4 address " + nic.getIp4Address() + " and ipv6 address " + nic.getIp6Address() +
+ s_logger.debug("Saving placeholder nic with ip4 address " + nic.getIPv4Address() + " and ipv6 address " + nic.getIPv6Address() +
" for the network " + network);
- _networkMgr.savePlaceholderNic(network, nic.getIp4Address(), nic.getIp6Address(), VirtualMachine.Type.DomainRouter);
+ _networkMgr.savePlaceholderNic(network, nic.getIPv4Address(), nic.getIPv6Address(), VirtualMachine.Type.DomainRouter);
}
}
}
@@ -284,11 +283,11 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
@DB
public void deallocate(final Network network, final NicProfile nic, VirtualMachineProfile vm) {
if (s_logger.isDebugEnabled()) {
- s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
+ s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIPv4Address());
}
- if (nic.getIp4Address() != null) {
- final IPAddressVO ip = _ipAddressDao.findByIpAndSourceNetworkId(nic.getNetworkId(), nic.getIp4Address());
+ if (nic.getIPv4Address() != null) {
+ final IPAddressVO ip = _ipAddressDao.findByIpAndSourceNetworkId(nic.getNetworkId(), nic.getIPv4Address());
if (ip != null) {
Transaction.execute(new TransactionCallbackNoReturn() {
@Override
@@ -316,8 +315,8 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
}
}
- if (nic.getIp6Address() != null) {
- _ipv6Mgr.revokeDirectIpv6Address(nic.getNetworkId(), nic.getIp6Address());
+ if (nic.getIPv6Address() != null) {
+ _ipv6Mgr.revokeDirectIpv6Address(nic.getNetworkId(), nic.getIPv6Address());
}
nic.deallocate();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java b/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
index f2843c6..02292be 100644
--- a/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
@@ -21,9 +21,8 @@ import java.util.List;
import javax.ejb.Local;
import javax.inject.Inject;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
+import org.apache.log4j.Logger;
import com.cloud.configuration.ZoneConfig;
import com.cloud.dc.DataCenter;
@@ -105,16 +104,16 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
rsStrategy = ReservationStrategy.Create;
}
- if (nic != null && nic.getRequestedIpv4() != null) {
+ if (nic != null && nic.getRequestedIPv4() != null) {
throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic);
}
if (nic == null) {
nic = new NicProfile(rsStrategy, null, null, null, null);
- } else if (nic.getIp4Address() == null) {
- nic.setStrategy(ReservationStrategy.Start);
+ } else if (nic.getIPv4Address() == null) {
+ nic.setReservationStrategy(ReservationStrategy.Start);
} else {
- nic.setStrategy(ReservationStrategy.Create);
+ nic.setReservationStrategy(ReservationStrategy.Create);
}
if (rsStrategy == ReservationStrategy.Create) {
@@ -129,7 +128,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException {
- String oldIp = nic.getIp4Address();
+ String oldIp = nic.getIPv4Address();
boolean getNewIp = false;
if (oldIp == null) {
@@ -149,7 +148,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
}
});
- nic.setIp4Address(null);
+ nic.setIPv4Address(null);
getNewIp = true;
}
}
@@ -161,15 +160,15 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
}
DataCenter dc = _dcDao.findById(network.getDataCenterId());
- nic.setDns1(dc.getDns1());
- nic.setDns2(dc.getDns2());
+ nic.setIPv4Dns1(dc.getDns1());
+ nic.setIPv4Dns2(dc.getDns2());
}
@DB
protected void getIp(final NicProfile nic, final Pod pod, final VirtualMachineProfile vm, final Network network) throws InsufficientVirtualNetworkCapacityException,
InsufficientAddressCapacityException, ConcurrentOperationException {
final DataCenter dc = _dcDao.findById(pod.getDataCenterId());
- if (nic.getIp4Address() == null) {
+ if (nic.getIPv4Address() == null) {
Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientAddressCapacityException>() {
@Override
public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientAddressCapacityException {
@@ -194,10 +193,10 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
ip = _ipAddrMgr.assignPublicIpAddress(dc.getId(), pod.getId(), vm.getOwner(), VlanType.DirectAttached, network.getId(), null, false);
}
- nic.setIp4Address(ip.getAddress().toString());
+ nic.setIPv4Address(ip.getAddress().toString());
nic.setFormat(AddressFormat.Ip4);
- nic.setGateway(ip.getGateway());
- nic.setNetmask(ip.getNetmask());
+ nic.setIPv4Gateway(ip.getGateway());
+ nic.setIPv4Netmask(ip.getNetmask());
if (ip.getVlanTag() != null && ip.getVlanTag().equalsIgnoreCase(Vlan.UNTAGGED)) {
nic.setIsolationUri(IsolationType.Ec2.toUri(Vlan.UNTAGGED));
nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(Vlan.UNTAGGED));
@@ -210,15 +209,15 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
if (vm.getType() == VirtualMachine.Type.DomainRouter) {
Nic placeholderNic = _networkModel.getPlaceholderNicForRouter(network, pod.getId());
if (placeholderNic == null) {
- s_logger.debug("Saving placeholder nic with ip4 address " + nic.getIp4Address() + " for the network " + network);
- _networkMgr.savePlaceholderNic(network, nic.getIp4Address(), null, VirtualMachine.Type.DomainRouter);
+ s_logger.debug("Saving placeholder nic with ip4 address " + nic.getIPv4Address() + " for the network " + network);
+ _networkMgr.savePlaceholderNic(network, nic.getIPv4Address(), null, VirtualMachine.Type.DomainRouter);
}
}
}
});
}
- nic.setDns1(dc.getDns1());
- nic.setDns2(dc.getDns2());
+ nic.setIPv4Dns1(dc.getDns1());
+ nic.setIPv4Dns2(dc.getDns2());
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/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 d01a65b..8562ae3 100644
--- a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
@@ -21,10 +21,9 @@ import java.util.List;
import javax.ejb.Local;
import javax.inject.Inject;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
+import org.apache.log4j.Logger;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
@@ -43,15 +42,15 @@ import com.cloud.network.Network.State;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetwork.IsolationMethod;
+import com.cloud.network.dao.FirewallRulesCidrsDao;
+import com.cloud.network.dao.FirewallRulesCidrsVO;
+import com.cloud.network.dao.FirewallRulesDao;
import com.cloud.network.dao.IPAddressDao;
import com.cloud.network.dao.IPAddressVO;
import com.cloud.network.dao.NetworkDao;
import com.cloud.network.dao.NetworkVO;
-import com.cloud.network.dao.FirewallRulesCidrsDao;
-import com.cloud.network.dao.FirewallRulesDao;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.FirewallRuleVO;
-import com.cloud.network.dao.FirewallRulesCidrsVO;
import com.cloud.network.rules.PortForwardingRuleVO;
import com.cloud.network.rules.dao.PortForwardingRulesDao;
import com.cloud.offering.NetworkOffering;
@@ -250,18 +249,18 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapacityException,
InsufficientAddressCapacityException {
- if (_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(), config.getId()) && nic != null && nic.getRequestedIpv4() != null) {
+ if (_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(), config.getId()) && nic != null && nic.getRequestedIPv4() != null) {
throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic);
}
NicProfile profile = super.allocate(config, nic, vm);
if (_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(), config.getId())) {
- profile.setStrategy(ReservationStrategy.Start);
+ profile.setReservationStrategy(ReservationStrategy.Start);
/* We won't clear IP address, because router may set gateway as it IP, and it would be updated properly later */
//profile.setIp4Address(null);
- profile.setGateway(null);
- profile.setNetmask(null);
+ profile.setIPv4Gateway(null);
+ profile.setIPv4Netmask(null);
}
return profile;
@@ -273,9 +272,9 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
super.deallocate(config, nic, vm);
if (_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(), config.getId())) {
- nic.setIp4Address(null);
- nic.setGateway(null);
- nic.setNetmask(null);
+ nic.setIPv4Address(null);
+ nic.setIPv4Gateway(null);
+ nic.setIPv4Netmask(null);
nic.setBroadcastUri(null);
nic.setIsolationUri(null);
}
@@ -291,23 +290,23 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
if (_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(), config.getId())) {
nic.setBroadcastUri(config.getBroadcastUri());
nic.setIsolationUri(config.getBroadcastUri());
- nic.setDns1(dc.getDns1());
- nic.setDns2(dc.getDns2());
- nic.setNetmask(NetUtils.cidr2Netmask(config.getCidr()));
+ nic.setIPv4Dns1(dc.getDns1());
+ nic.setIPv4Dns2(dc.getDns2());
+ nic.setIPv4Netmask(NetUtils.cidr2Netmask(config.getCidr()));
long cidrAddress = NetUtils.ip2Long(config.getCidr().split("/")[0]);
int cidrSize = getGloballyConfiguredCidrSize();
- nic.setGateway(config.getGateway());
+ nic.setIPv4Gateway(config.getGateway());
- if (nic.getIp4Address() == null) {
+ if (nic.getIPv4Address() == null) {
String guestIp = _ipAddrMgr.acquireGuestIpAddress(config, null);
if (guestIp == null) {
throw new InsufficientVirtualNetworkCapacityException("Unable to acquire guest IP address for network " + config, DataCenter.class, dc.getId());
}
- nic.setIp4Address(guestIp);
+ nic.setIPv4Address(guestIp);
} else {
- long ipMask = NetUtils.ip2Long(nic.getIp4Address()) & ~(0xffffffffffffffffl << (32 - cidrSize));
- nic.setIp4Address(NetUtils.long2Ip(cidrAddress | ipMask));
+ long ipMask = NetUtils.ip2Long(nic.getIPv4Address()) & ~(0xffffffffffffffffl << (32 - cidrSize));
+ nic.setIPv4Address(NetUtils.long2Ip(cidrAddress | ipMask));
}
} else {
super.reserve(nic, config, vm, dest, context);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/guru/GuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java
index 25b1f54..92613c4 100644
--- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java
@@ -234,10 +234,10 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
public void deallocate(final Network network, final NicProfile nic, final VirtualMachineProfile vm) {
if (network.getSpecifyIpRanges()) {
if (s_logger.isDebugEnabled()) {
- s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
+ s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIPv4Address());
}
- final IPAddressVO ip = _ipAddressDao.findByIpAndSourceNetworkId(nic.getNetworkId(), nic.getIp4Address());
+ final IPAddressVO ip = _ipAddressDao.findByIpAndSourceNetworkId(nic.getNetworkId(), nic.getIPv4Address());
if (ip != null) {
Transaction.execute(new TransactionCallbackNoReturn() {
@Override
@@ -342,14 +342,14 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
final DataCenter dc = _dcDao.findById(network.getDataCenterId());
- if (nic.getIp4Address() == null) {
+ if (nic.getIPv4Address() == null) {
nic.setBroadcastUri(network.getBroadcastUri());
nic.setIsolationUri(network.getBroadcastUri());
- nic.setGateway(network.getGateway());
+ nic.setIPv4Gateway(network.getGateway());
String guestIp = null;
if (network.getSpecifyIpRanges()) {
- _ipAddrMgr.allocateDirectIp(nic, dc, vm, network, nic.getRequestedIpv4(), null);
+ _ipAddrMgr.allocateDirectIp(nic, dc, vm, network, nic.getRequestedIPv4(), null);
} else {
//if Vm is router vm and source nat is enabled in the network, set ip4 to the network gateway
boolean isGateway = false;
@@ -370,23 +370,23 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
if (isGateway) {
guestIp = network.getGateway();
} else {
- guestIp = _ipAddrMgr.acquireGuestIpAddress(network, nic.getRequestedIpv4());
+ guestIp = _ipAddrMgr.acquireGuestIpAddress(network, nic.getRequestedIPv4());
if (guestIp == null) {
throw new InsufficientVirtualNetworkCapacityException("Unable to acquire Guest IP" + " address for network " + network, DataCenter.class,
dc.getId());
}
}
- nic.setIp4Address(guestIp);
- nic.setNetmask(NetUtils.cidr2Netmask(network.getCidr()));
+ nic.setIPv4Address(guestIp);
+ nic.setIPv4Netmask(NetUtils.cidr2Netmask(network.getCidr()));
- nic.setDns1(dc.getDns1());
- nic.setDns2(dc.getDns2());
+ nic.setIPv4Dns1(dc.getDns1());
+ nic.setIPv4Dns2(dc.getDns2());
nic.setFormat(AddressFormat.Ip4);
}
}
- nic.setStrategy(ReservationStrategy.Start);
+ nic.setReservationStrategy(ReservationStrategy.Start);
if (nic.getMacAddress() == null) {
nic.setMacAddress(_networkModel.getNextAvailableMacAddressInNetwork(network.getId()));
@@ -402,8 +402,8 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
public void updateNicProfile(final NicProfile profile, final Network network) {
final DataCenter dc = _dcDao.findById(network.getDataCenterId());
if (profile != null) {
- profile.setDns1(dc.getDns1());
- profile.setDns2(dc.getDns2());
+ profile.setIPv4Dns1(dc.getDns1());
+ profile.setIPv4Dns2(dc.getDns2());
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java b/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
index 49480db..2470ea7 100644
--- a/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
@@ -103,10 +103,10 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
assert trafficType == TrafficType.Management || trafficType == TrafficType.Storage : "Well, I can't take care of this config now can I? " + config;
if (nic != null) {
- if (nic.getRequestedIpv4() != null) {
+ if (nic.getRequestedIPv4() != null) {
throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic);
}
- nic.setStrategy(nic.getIp4Address() != null ? ReservationStrategy.Create : ReservationStrategy.Start);
+ nic.setReservationStrategy(nic.getIPv4Address() != null ? ReservationStrategy.Create : ReservationStrategy.Start);
} else {
nic = new NicProfile(ReservationStrategy.Start, null, null, null, null);
}
@@ -124,12 +124,12 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
throw new InsufficientAddressCapacityException("Unable to get a management ip address", Pod.class, pod.getId());
}
- nic.setIp4Address(ip.first());
+ nic.setIPv4Address(ip.first());
nic.setMacAddress(NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ip.second())));
- nic.setGateway(pod.getGateway());
+ nic.setIPv4Gateway(pod.getGateway());
nic.setFormat(AddressFormat.Ip4);
String netmask = NetUtils.getCidrNetmask(pod.getCidrSize());
- nic.setNetmask(netmask);
+ nic.setIPv4Netmask(netmask);
nic.setBroadcastType(BroadcastDomainType.Native);
nic.setBroadcastUri(null);
nic.setIsolationUri(null);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/PrivateNetworkGuru.java b/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
index e9bde69..340c8b1 100644
--- a/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
@@ -141,12 +141,12 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
@Override
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
if (s_logger.isDebugEnabled()) {
- s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
+ s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIPv4Address());
}
- PrivateIpVO ip = _privateIpDao.findByIpAndSourceNetworkId(nic.getNetworkId(), nic.getIp4Address());
+ PrivateIpVO ip = _privateIpDao.findByIpAndSourceNetworkId(nic.getNetworkId(), nic.getIPv4Address());
if (ip != null) {
- _privateIpDao.releaseIpAddress(nic.getIp4Address(), nic.getNetworkId());
+ _privateIpDao.releaseIpAddress(nic.getIPv4Address(), nic.getNetworkId());
}
nic.deallocate();
}
@@ -173,26 +173,26 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
getIp(nic, dc, network);
- if (nic.getIp4Address() == null) {
- nic.setStrategy(ReservationStrategy.Start);
+ if (nic.getIPv4Address() == null) {
+ nic.setReservationStrategy(ReservationStrategy.Start);
} else {
- nic.setStrategy(ReservationStrategy.Create);
+ nic.setReservationStrategy(ReservationStrategy.Create);
}
return nic;
}
protected void getIp(NicProfile nic, DataCenter dc, Network network) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException {
- if (nic.getIp4Address() == null) {
+ if (nic.getIPv4Address() == null) {
PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(network.getDataCenterId(), network.getId(), null);
String vlanTag = BroadcastDomainType.getValue(network.getBroadcastUri());
String netmask = NetUtils.getCidrNetmask(network.getCidr());
PrivateIpAddress ip =
new PrivateIpAddress(ipVO, vlanTag, network.getGateway(), netmask, NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ipVO.getMacAddress())));
- nic.setIp4Address(ip.getIpAddress());
- nic.setGateway(ip.getGateway());
- nic.setNetmask(ip.getNetmask());
+ nic.setIPv4Address(ip.getIpAddress());
+ nic.setIPv4Gateway(ip.getGateway());
+ nic.setIPv4Netmask(ip.getNetmask());
nic.setIsolationUri(IsolationType.Vlan.toUri(ip.getBroadcastUri()));
nic.setBroadcastUri(IsolationType.Vlan.toUri(ip.getBroadcastUri()));
nic.setBroadcastType(BroadcastDomainType.Vlan);
@@ -201,25 +201,25 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
nic.setMacAddress(ip.getMacAddress());
}
- nic.setDns1(dc.getDns1());
- nic.setDns2(dc.getDns2());
+ nic.setIPv4Dns1(dc.getDns1());
+ nic.setIPv4Dns2(dc.getDns2());
}
@Override
public void updateNicProfile(NicProfile profile, Network network) {
DataCenter dc = _entityMgr.findById(DataCenter.class, network.getDataCenterId());
if (profile != null) {
- profile.setDns1(dc.getDns1());
- profile.setDns2(dc.getDns2());
+ profile.setIPv4Dns1(dc.getDns1());
+ profile.setIPv4Dns2(dc.getDns2());
}
}
@Override
public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException {
- if (nic.getIp4Address() == null) {
+ if (nic.getIPv4Address() == null) {
getIp(nic, _entityMgr.findById(DataCenter.class, network.getDataCenterId()), network);
- nic.setStrategy(ReservationStrategy.Create);
+ nic.setReservationStrategy(ReservationStrategy.Create);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/guru/PublicNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/PublicNetworkGuru.java b/server/src/com/cloud/network/guru/PublicNetworkGuru.java
index b1c226b..9f855ea 100644
--- a/server/src/com/cloud/network/guru/PublicNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/PublicNetworkGuru.java
@@ -19,9 +19,8 @@ package com.cloud.network.guru;
import javax.ejb.Local;
import javax.inject.Inject;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
+import org.apache.log4j.Logger;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Vlan.VlanType;
@@ -117,11 +116,11 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
protected void getIp(NicProfile nic, DataCenter dc, VirtualMachineProfile vm, Network network) throws InsufficientVirtualNetworkCapacityException,
InsufficientAddressCapacityException, ConcurrentOperationException {
- if (nic.getIp4Address() == null) {
+ if (nic.getIPv4Address() == null) {
PublicIp ip = _ipAddrMgr.assignPublicIpAddress(dc.getId(), null, vm.getOwner(), VlanType.VirtualNetwork, null, null, false);
- nic.setIp4Address(ip.getAddress().toString());
- nic.setGateway(ip.getGateway());
- nic.setNetmask(ip.getNetmask());
+ nic.setIPv4Address(ip.getAddress().toString());
+ nic.setIPv4Gateway(ip.getGateway());
+ nic.setIPv4Netmask(ip.getNetmask());
if (network.getBroadcastDomainType() == BroadcastDomainType.Vxlan) {
nic.setIsolationUri(BroadcastDomainType.Vxlan.toUri(ip.getVlanTag()));
nic.setBroadcastUri(BroadcastDomainType.Vxlan.toUri(ip.getVlanTag()));
@@ -136,16 +135,16 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
nic.setMacAddress(ip.getMacAddress());
}
- nic.setDns1(dc.getDns1());
- nic.setDns2(dc.getDns2());
+ nic.setIPv4Dns1(dc.getDns1());
+ nic.setIPv4Dns2(dc.getDns2());
}
@Override
public void updateNicProfile(NicProfile profile, Network network) {
DataCenter dc = _dcDao.findById(network.getDataCenterId());
if (profile != null) {
- profile.setDns1(dc.getDns1());
- profile.setDns2(dc.getDns2());
+ profile.setIPv4Dns1(dc.getDns1());
+ profile.setIPv4Dns2(dc.getDns2());
}
}
@@ -155,7 +154,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
DataCenter dc = _dcDao.findById(network.getDataCenterId());
- if (nic != null && nic.getRequestedIpv4() != null) {
+ if (nic != null && nic.getRequestedIPv4() != null) {
throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic);
}
@@ -165,12 +164,12 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
getIp(nic, dc, vm, network);
- if (nic.getIp4Address() == null) {
- nic.setStrategy(ReservationStrategy.Start);
+ if (nic.getIPv4Address() == null) {
+ nic.setReservationStrategy(ReservationStrategy.Start);
} else if (vm.getVirtualMachine().getType() == VirtualMachine.Type.DomainRouter) {
- nic.setStrategy(ReservationStrategy.Managed);
+ nic.setReservationStrategy(ReservationStrategy.Managed);
} else {
- nic.setStrategy(ReservationStrategy.Create);
+ nic.setReservationStrategy(ReservationStrategy.Create);
}
return nic;
@@ -179,7 +178,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
@Override
public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException {
- if (nic.getIp4Address() == null) {
+ if (nic.getIPv4Address() == null) {
getIp(nic, dest.getDataCenter(), vm, network);
}
}
@@ -199,10 +198,10 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
@DB
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
if (s_logger.isDebugEnabled()) {
- s_logger.debug("public network deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
+ s_logger.debug("public network deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIPv4Address());
}
- final IPAddressVO ip = _ipAddressDao.findByIpAndSourceNetworkId(nic.getNetworkId(), nic.getIp4Address());
+ final IPAddressVO ip = _ipAddressDao.findByIpAndSourceNetworkId(nic.getNetworkId(), nic.getIPv4Address());
if (ip != null && nic.getReservationStrategy() != ReservationStrategy.Managed) {
Transaction.execute(new TransactionCallbackNoReturn() {
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/guru/StorageNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/StorageNetworkGuru.java b/server/src/com/cloud/network/guru/StorageNetworkGuru.java
index 9df7a1b..bf21cd7 100644
--- a/server/src/com/cloud/network/guru/StorageNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/StorageNetworkGuru.java
@@ -132,12 +132,12 @@ public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
}
vlan = ip.getVlan();
- nic.setIp4Address(ip.getIpAddress());
+ nic.setIPv4Address(ip.getIpAddress());
nic.setMacAddress(NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ip.getMac())));
nic.setFormat(AddressFormat.Ip4);
- nic.setNetmask(ip.getNetmask());
+ nic.setIPv4Netmask(ip.getNetmask());
nic.setBroadcastType(BroadcastDomainType.Storage);
- nic.setGateway(ip.getGateway());
+ nic.setIPv4Gateway(ip.getGateway());
if (vlan != null) {
nic.setBroadcastUri(BroadcastDomainType.Storage.toUri(vlan));
} else {
@@ -154,8 +154,8 @@ public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
return super.release(nic, vm, reservationId);
}
- _sNwMgr.releaseIpAddress(nic.getIp4Address());
- s_logger.debug("Release an storage ip " + nic.getIp4Address());
+ _sNwMgr.releaseIpAddress(nic.getIPv4Address());
+ s_logger.debug("Release an storage ip " + nic.getIPv4Address());
nic.deallocate();
return true;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/router/CommandSetupHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/CommandSetupHelper.java b/server/src/com/cloud/network/router/CommandSetupHelper.java
index 2b701d9..30af056 100644
--- a/server/src/com/cloud/network/router/CommandSetupHelper.java
+++ b/server/src/com/cloud/network/router/CommandSetupHelper.java
@@ -921,8 +921,8 @@ public class CommandSetupHelper {
final boolean setupDns = dnsProvided || dhcpProvided;
if (setupDns) {
- defaultDns1 = guestNic.getDns1();
- defaultDns2 = guestNic.getDns2();
+ defaultDns1 = guestNic.getIPv4Dns1();
+ defaultDns2 = guestNic.getIPv4Dns2();
}
final Nic nic = _nicDao.findByNtwkIdAndInstanceId(network.getId(), router.getId());
@@ -934,7 +934,7 @@ public class CommandSetupHelper {
final SetupGuestNetworkCommand setupCmd = new SetupGuestNetworkCommand(dhcpRange, networkDomain, router.getIsRedundantRouter(), defaultDns1, defaultDns2, add, _itMgr.toNicTO(nicProfile,
router.getHypervisorType()));
- final String brd = NetUtils.long2Ip(NetUtils.ip2Long(guestNic.getIp4Address()) | ~NetUtils.ip2Long(guestNic.getNetmask()));
+ final String brd = NetUtils.long2Ip(NetUtils.ip2Long(guestNic.getIPv4Address()) | ~NetUtils.ip2Long(guestNic.getIPv4Netmask()));
setupCmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId()));
setupCmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, _routerControlHelper.getRouterIpInNetwork(network.getId(), router.getId()));
@@ -1033,8 +1033,8 @@ public class CommandSetupHelper {
String dhcpRange = null;
// setup dhcp range
if (dc.getNetworkType() == NetworkType.Basic) {
- final long cidrSize = NetUtils.getCidrSize(guestNic.getNetmask());
- final String cidr = NetUtils.getCidrSubNet(guestNic.getGateway(), cidrSize);
+ final long cidrSize = NetUtils.getCidrSize(guestNic.getIPv4Netmask());
+ final String cidr = NetUtils.getCidrSubNet(guestNic.getIPv4Gateway(), cidrSize);
if (cidr != null) {
dhcpRange = NetUtils.getIpRangeStartIpFromCidr(cidr, cidrSize);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/router/NetworkHelperImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/NetworkHelperImpl.java b/server/src/com/cloud/network/router/NetworkHelperImpl.java
index 92187e4..abaf54f 100644
--- a/server/src/com/cloud/network/router/NetworkHelperImpl.java
+++ b/server/src/com/cloud/network/router/NetworkHelperImpl.java
@@ -629,9 +629,9 @@ public class NetworkHelperImpl implements NetworkHelper {
final NicProfile defaultNic = new NicProfile();
defaultNic.setDefaultNic(true);
final PublicIp sourceNatIp = routerDeploymentDefinition.getSourceNatIP();
- defaultNic.setIp4Address(sourceNatIp.getAddress().addr());
- defaultNic.setGateway(sourceNatIp.getGateway());
- defaultNic.setNetmask(sourceNatIp.getNetmask());
+ defaultNic.setIPv4Address(sourceNatIp.getAddress().addr());
+ defaultNic.setIPv4Gateway(sourceNatIp.getGateway());
+ defaultNic.setIPv4Netmask(sourceNatIp.getNetmask());
defaultNic.setMacAddress(sourceNatIp.getMacAddress());
// get broadcast from public network
final Network pubNet = _networkDao.findById(sourceNatIp.getNetworkId());
@@ -650,7 +650,7 @@ public class NetworkHelperImpl implements NetworkHelper {
}
final NetworkOffering publicOffering = _networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemPublicNetwork).get(0);
final List<? extends Network> publicNetworks = _networkMgr.setupNetwork(s_systemAccount, publicOffering, routerDeploymentDefinition.getPlan(), null, null, false);
- final String publicIp = defaultNic.getIp4Address();
+ final String publicIp = defaultNic.getIPv4Address();
// We want to use the identical MAC address for RvR on public
// interface if possible
final NicVO peerNic = _nicDao.findByIp4AddressAndNetworkId(publicIp, publicNetworks.get(0).getId());
@@ -715,16 +715,16 @@ public class NetworkHelperImpl implements NetworkHelper {
final NicProfile gatewayNic = new NicProfile(defaultNetworkStartIp, defaultNetworkStartIpv6);
if (routerDeploymentDefinition.isPublicNetwork()) {
if (routerDeploymentDefinition.isRedundant()) {
- gatewayNic.setIp4Address(_ipAddrMgr.acquireGuestIpAddress(guestNetwork, null));
+ gatewayNic.setIPv4Address(_ipAddrMgr.acquireGuestIpAddress(guestNetwork, null));
} else {
- gatewayNic.setIp4Address(guestNetwork.getGateway());
+ gatewayNic.setIPv4Address(guestNetwork.getGateway());
}
gatewayNic.setBroadcastUri(guestNetwork.getBroadcastUri());
gatewayNic.setBroadcastType(guestNetwork.getBroadcastDomainType());
gatewayNic.setIsolationUri(guestNetwork.getBroadcastUri());
gatewayNic.setMode(guestNetwork.getMode());
final String gatewayCidr = guestNetwork.getCidr();
- gatewayNic.setNetmask(NetUtils.getCidrNetmask(gatewayCidr));
+ gatewayNic.setIPv4Netmask(NetUtils.getCidrNetmask(gatewayCidr));
} else {
gatewayNic.setDefaultNic(true);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/router/NicProfileHelperImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/NicProfileHelperImpl.java b/server/src/com/cloud/network/router/NicProfileHelperImpl.java
index aaa1f27..09e5211 100644
--- a/server/src/com/cloud/network/router/NicProfileHelperImpl.java
+++ b/server/src/com/cloud/network/router/NicProfileHelperImpl.java
@@ -81,9 +81,9 @@ public class NicProfileHelperImpl implements NicProfileHelper {
NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ipVO.getMacAddress())));
final URI netUri = BroadcastDomainType.fromString(ip.getBroadcastUri());
- privateNicProfile.setIp4Address(ip.getIpAddress());
- privateNicProfile.setGateway(ip.getGateway());
- privateNicProfile.setNetmask(ip.getNetmask());
+ privateNicProfile.setIPv4Address(ip.getIpAddress());
+ privateNicProfile.setIPv4Gateway(ip.getGateway());
+ privateNicProfile.setIPv4Netmask(ip.getNetmask());
privateNicProfile.setIsolationUri(netUri);
privateNicProfile.setBroadcastUri(netUri);
// can we solve this in setBroadcastUri()???
@@ -102,9 +102,9 @@ public class NicProfileHelperImpl implements NicProfileHelper {
final NicProfile guestNic = new NicProfile();
if (vpcRouterDeploymentDefinition.isRedundant()) {
- guestNic.setIp4Address(_ipAddrMgr.acquireGuestIpAddress(guestNetwork, null));
+ guestNic.setIPv4Address(_ipAddrMgr.acquireGuestIpAddress(guestNetwork, null));
} else {
- guestNic.setIp4Address(guestNetwork.getGateway());
+ guestNic.setIPv4Address(guestNetwork.getGateway());
}
guestNic.setBroadcastUri(guestNetwork.getBroadcastUri());
@@ -112,7 +112,7 @@ public class NicProfileHelperImpl implements NicProfileHelper {
guestNic.setIsolationUri(guestNetwork.getBroadcastUri());
guestNic.setMode(guestNetwork.getMode());
final String gatewayCidr = guestNetwork.getCidr();
- guestNic.setNetmask(NetUtils.getCidrNetmask(gatewayCidr));
+ guestNic.setIPv4Netmask(NetUtils.getCidrNetmask(gatewayCidr));
return guestNic;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 8ec7417..5ee0f57 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1376,28 +1376,28 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
for (final NicProfile nic : profile.getNics()) {
final int deviceId = nic.getDeviceId();
boolean ipv4 = false, ipv6 = false;
- if (nic.getIp4Address() != null) {
+ if (nic.getIPv4Address() != null) {
ipv4 = true;
- buf.append(" eth").append(deviceId).append("ip=").append(nic.getIp4Address());
- buf.append(" eth").append(deviceId).append("mask=").append(nic.getNetmask());
+ buf.append(" eth").append(deviceId).append("ip=").append(nic.getIPv4Address());
+ buf.append(" eth").append(deviceId).append("mask=").append(nic.getIPv4Netmask());
}
- if (nic.getIp6Address() != null) {
+ if (nic.getIPv6Address() != null) {
ipv6 = true;
- buf.append(" eth").append(deviceId).append("ip6=").append(nic.getIp6Address());
- buf.append(" eth").append(deviceId).append("ip6prelen=").append(NetUtils.getIp6CidrSize(nic.getIp6Cidr()));
+ buf.append(" eth").append(deviceId).append("ip6=").append(nic.getIPv6Address());
+ buf.append(" eth").append(deviceId).append("ip6prelen=").append(NetUtils.getIp6CidrSize(nic.getIPv6Cidr()));
}
if (nic.isDefaultNic()) {
if (ipv4) {
- buf.append(" gateway=").append(nic.getGateway());
+ buf.append(" gateway=").append(nic.getIPv4Gateway());
}
if (ipv6) {
- buf.append(" ip6gateway=").append(nic.getIp6Gateway());
+ buf.append(" ip6gateway=").append(nic.getIPv6Gateway());
}
- defaultDns1 = nic.getDns1();
- defaultDns2 = nic.getDns2();
- defaultIp6Dns1 = nic.getIp6Dns1();
- defaultIp6Dns2 = nic.getIp6Dns2();
+ defaultDns1 = nic.getIPv4Dns1();
+ defaultDns2 = nic.getIPv4Dns2();
+ defaultIp6Dns1 = nic.getIPv6Dns1();
+ defaultIp6Dns2 = nic.getIPv6Dns2();
}
if (nic.getTrafficType() == TrafficType.Management) {
@@ -1546,9 +1546,9 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
buf.append(createRedundantRouterArgs(guestNic, router));
final Network net = _networkModel.getNetwork(guestNic.getNetworkId());
buf.append(" guestgw=").append(net.getGateway());
- final String brd = NetUtils.long2Ip(NetUtils.ip2Long(guestNic.getIp4Address()) | ~NetUtils.ip2Long(guestNic.getNetmask()));
+ final String brd = NetUtils.long2Ip(NetUtils.ip2Long(guestNic.getIPv4Address()) | ~NetUtils.ip2Long(guestNic.getIPv4Netmask()));
buf.append(" guestbrd=").append(brd);
- buf.append(" guestcidrsize=").append(NetUtils.getCidrSize(guestNic.getNetmask()));
+ buf.append(" guestcidrsize=").append(NetUtils.getCidrSize(guestNic.getIPv4Netmask()));
final int advertInt = NumbersUtil.parseInt(_configDao.getValue(Config.RedundantRouterVrrpInterval.key()), 1);
buf.append(" advert_int=").append(advertInt);
@@ -1565,8 +1565,8 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
// setup dhcp range
if (dc.getNetworkType() == NetworkType.Basic) {
if (guestNic.isDefaultNic()) {
- cidrSize = NetUtils.getCidrSize(guestNic.getNetmask());
- final String cidr = NetUtils.getCidrSubNet(guestNic.getGateway(), cidrSize);
+ cidrSize = NetUtils.getCidrSize(guestNic.getIPv4Netmask());
+ final String cidr = NetUtils.getCidrSubNet(guestNic.getIPv4Gateway(), cidrSize);
if (cidr != null) {
dhcpRange = NetUtils.getIpRangeStartIpFromCidr(cidr, cidrSize);
}
@@ -1653,11 +1653,11 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
final List<NicProfile> nics = profile.getNics();
for (final NicProfile nic : nics) {
if (nic.getTrafficType() == TrafficType.Public) {
- router.setPublicIpAddress(nic.getIp4Address());
- router.setPublicNetmask(nic.getNetmask());
+ router.setPublicIpAddress(nic.getIPv4Address());
+ router.setPublicNetmask(nic.getIPv4Netmask());
router.setPublicMacAddress(nic.getMacAddress());
} else if (nic.getTrafficType() == TrafficType.Control) {
- router.setPrivateIpAddress(nic.getIp4Address());
+ router.setPrivateIpAddress(nic.getIPv4Address());
router.setPrivateMacAddress(nic.getMacAddress());
}
}
@@ -1697,7 +1697,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
final List<Long> routerGuestNtwkIds = _routerDao.getRouterNetworks(router.getId());
for (final Long guestNetworkId : routerGuestNtwkIds) {
- final AggregationControlCommand startCmd = new AggregationControlCommand(Action.Start, router.getInstanceName(), controlNic.getIp4Address(), _routerControlHelper.getRouterIpInNetwork(
+ final AggregationControlCommand startCmd = new AggregationControlCommand(Action.Start, router.getInstanceName(), controlNic.getIPv4Address(), _routerControlHelper.getRouterIpInNetwork(
guestNetworkId, router.getId()));
cmds.addCommand(startCmd);
@@ -1721,7 +1721,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
finalizeUserDataAndDhcpOnStart(cmds, router, provider, guestNetworkId);
- final AggregationControlCommand finishCmd = new AggregationControlCommand(Action.Finish, router.getInstanceName(), controlNic.getIp4Address(), _routerControlHelper.getRouterIpInNetwork(
+ final AggregationControlCommand finishCmd = new AggregationControlCommand(Action.Finish, router.getInstanceName(), controlNic.getIPv4Address(), _routerControlHelper.getRouterIpInNetwork(
guestNetworkId, router.getId()));
cmds.addCommand(finishCmd);
}
@@ -1772,7 +1772,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
throw new CloudRuntimeException("VirtualMachine " + profile.getInstanceName() + " doesn't have a control interface");
}
final SetMonitorServiceCommand command = new SetMonitorServiceCommand(servicesTO);
- command.setAccessDetail(NetworkElementCommand.ROUTER_IP, controlNic.getIp4Address());
+ command.setAccessDetail(NetworkElementCommand.ROUTER_IP, controlNic.getIPv4Address());
command.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, _routerControlHelper.getRouterIpInNetwork(networkId, router.getId()));
command.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
@@ -1790,13 +1790,13 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
// TODO this is a ugly to test hypervisor type here
// for basic network mode, we will use the guest NIC for control NIC
for (final NicProfile nic : profile.getNics()) {
- if (nic.getTrafficType() == TrafficType.Guest && nic.getIp4Address() != null) {
+ if (nic.getTrafficType() == TrafficType.Guest && nic.getIPv4Address() != null) {
controlNic = nic;
}
}
} else {
for (final NicProfile nic : profile.getNics()) {
- if (nic.getTrafficType() == TrafficType.Control && nic.getIp4Address() != null) {
+ if (nic.getTrafficType() == TrafficType.Control && nic.getIPv4Address() != null) {
controlNic = nic;
}
}
@@ -1806,18 +1806,18 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
protected void finalizeSshAndVersionAndNetworkUsageOnStart(final Commands cmds, final VirtualMachineProfile profile, final DomainRouterVO router, final NicProfile controlNic) {
final DomainRouterVO vr = _routerDao.findById(profile.getId());
- cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922));
+ cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIPv4Address(), 3922));
// Update router template/scripts version
final GetDomRVersionCmd command = new GetDomRVersionCmd();
- command.setAccessDetail(NetworkElementCommand.ROUTER_IP, controlNic.getIp4Address());
+ command.setAccessDetail(NetworkElementCommand.ROUTER_IP, controlNic.getIPv4Address());
command.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
cmds.addCommand("getDomRVersion", command);
// Network usage command to create iptables rules
final boolean forVpc = vr.getVpcId() != null;
if (!forVpc) {
- cmds.addCommand("networkUsage", new NetworkUsageCommand(controlNic.getIp4Address(), router.getHostName(), "create", forVpc));
+ cmds.addCommand("networkUsage", new NetworkUsageCommand(controlNic.getIPv4Address(), router.getHostName(), "create", forVpc));
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java b/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java
index 3d7ed5f..f6f9ec4 100644
--- a/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java
+++ b/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java
@@ -121,9 +121,9 @@ public class VpcNetworkHelperImpl extends NetworkHelperImpl {
s_logger.debug("Allocating nic for router in vlan " + publicIp.getVlanTag());
final NicProfile publicNic = new NicProfile();
publicNic.setDefaultNic(false);
- publicNic.setIp4Address(publicIp.getAddress().addr());
- publicNic.setGateway(publicIp.getGateway());
- publicNic.setNetmask(publicIp.getNetmask());
+ publicNic.setIPv4Address(publicIp.getAddress().addr());
+ publicNic.setIPv4Gateway(publicIp.getGateway());
+ publicNic.setIPv4Netmask(publicIp.getNetmask());
publicNic.setMacAddress(publicIp.getMacAddress());
publicNic.setBroadcastType(BroadcastDomainType.Vlan);
publicNic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(publicIp.getVlanTag()));
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index f10e5a1..4db1adc 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -246,8 +246,8 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
if (nic.getTrafficType() == TrafficType.Public || nic.getTrafficType() == TrafficType.Guest) {
// save dns information
if (nic.getTrafficType() == TrafficType.Public) {
- defaultDns1 = nic.getDns1();
- defaultDns2 = nic.getDns2();
+ defaultDns1 = nic.getIPv4Dns1();
+ defaultDns2 = nic.getIPv4Dns2();
}
s_logger.debug("Removing nic " + nic + " of type " + nic.getTrafficType() + " from the nics passed on vm start. " + "The nic will be plugged later");
it.remove();
@@ -433,7 +433,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
for (final Pair<Nic, Network> nicNtwk : guestNics) {
final Nic guestNic = nicNtwk.first();
- final AggregationControlCommand startCmd = new AggregationControlCommand(Action.Start, domainRouterVO.getInstanceName(), controlNic.getIp4Address(), _routerControlHelper.getRouterIpInNetwork(
+ final AggregationControlCommand startCmd = new AggregationControlCommand(Action.Start, domainRouterVO.getInstanceName(), controlNic.getIPv4Address(), _routerControlHelper.getRouterIpInNetwork(
guestNic.getNetworkId(), domainRouterVO.getId()));
cmds.addCommand(startCmd);
if (reprogramGuestNtwks) {
@@ -442,7 +442,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
}
finalizeUserDataAndDhcpOnStart(cmds, domainRouterVO, provider, guestNic.getNetworkId());
- final AggregationControlCommand finishCmd = new AggregationControlCommand(Action.Finish, domainRouterVO.getInstanceName(), controlNic.getIp4Address(), _routerControlHelper.getRouterIpInNetwork(
+ final AggregationControlCommand finishCmd = new AggregationControlCommand(Action.Finish, domainRouterVO.getInstanceName(), controlNic.getIPv4Address(), _routerControlHelper.getRouterIpInNetwork(
guestNic.getNetworkId(), domainRouterVO.getId()));
cmds.addCommand(finishCmd);
}
@@ -499,7 +499,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
protected boolean setupVpcPrivateNetwork(final VirtualRouter router, final boolean add, final NicProfile privateNic) throws ResourceUnavailableException {
if (router.getState() == State.Running) {
- final PrivateIpVO ipVO = _privateIpDao.findByIpAndSourceNetworkId(privateNic.getNetworkId(), privateNic.getIp4Address());
+ final PrivateIpVO ipVO = _privateIpDao.findByIpAndSourceNetworkId(privateNic.getNetworkId(), privateNic.getIPv4Address());
final Network network = _networkDao.findById(privateNic.getNetworkId());
final String netmask = NetUtils.getCidrNetmask(network.getCidr());
final PrivateIpAddress ip = new PrivateIpAddress(ipVO, network.getBroadcastUri().toString(), network.getGateway(), netmask, privateNic.getMacAddress());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/rules/DhcpPvlanRules.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/DhcpPvlanRules.java b/server/src/com/cloud/network/rules/DhcpPvlanRules.java
index c326aa8..eb98dce 100644
--- a/server/src/com/cloud/network/rules/DhcpPvlanRules.java
+++ b/server/src/com/cloud/network/rules/DhcpPvlanRules.java
@@ -56,7 +56,7 @@ public class DhcpPvlanRules extends RuleApplier {
NetworkModel networkModel = visitor.getVirtualNetworkApplianceFactory().getNetworkModel();
final String networkTag = networkModel.getNetworkTag(_router.getHypervisorType(), network);
- _setupCommand = PvlanSetupCommand.createDhcpSetup(op, _nic.getBroadCastUri(), networkTag, _router.getInstanceName(), _nic.getMacAddress(), _nic.getIp4Address());
+ _setupCommand = PvlanSetupCommand.createDhcpSetup(op, _nic.getBroadCastUri(), networkTag, _router.getInstanceName(), _nic.getMacAddress(), _nic.getIPv4Address());
return visitor.visit(this);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/rules/DhcpSubNetRules.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/DhcpSubNetRules.java b/server/src/com/cloud/network/rules/DhcpSubNetRules.java
index ac69479..a95ab09 100644
--- a/server/src/com/cloud/network/rules/DhcpSubNetRules.java
+++ b/server/src/com/cloud/network/rules/DhcpSubNetRules.java
@@ -92,13 +92,13 @@ public class DhcpSubNetRules extends RuleApplier {
// create one.
// This should happen only in case of Basic and Advanced SG enabled
// networks.
- if (!NetUtils.sameSubnet(domrGuestNic.getIp4Address(), _nic.getIp4Address(), _nic.getNetmask())) {
+ if (!NetUtils.sameSubnet(domrGuestNic.getIp4Address(), _nic.getIPv4Address(), _nic.getIPv4Netmask())) {
final NicIpAliasDao nicIpAliasDao = visitor.getVirtualNetworkApplianceFactory().getNicIpAliasDao();
final List<NicIpAliasVO> aliasIps = nicIpAliasDao.listByNetworkIdAndState(domrGuestNic.getNetworkId(), NicIpAlias.state.active);
boolean ipInVmsubnet = false;
for (final NicIpAliasVO alias : aliasIps) {
// check if any of the alias ips belongs to the Vm's subnet.
- if (NetUtils.sameSubnet(alias.getIp4Address(), _nic.getIp4Address(), _nic.getNetmask())) {
+ if (NetUtils.sameSubnet(alias.getIp4Address(), _nic.getIPv4Address(), _nic.getIPv4Netmask())) {
ipInVmsubnet = true;
break;
}
@@ -115,7 +115,7 @@ public class DhcpSubNetRules extends RuleApplier {
final Account caller = CallContext.current().getCallingAccount();
VlanDao vlanDao = visitor.getVirtualNetworkApplianceFactory().getVlanDao();
- final List<VlanVO> vlanList = vlanDao.listVlansByNetworkIdAndGateway(_network.getId(), _nic.getGateway());
+ final List<VlanVO> vlanList = vlanDao.listVlansByNetworkIdAndGateway(_network.getId(), _nic.getIPv4Gateway());
final List<Long> vlanDbIdList = new ArrayList<Long>();
for (final VlanVO vlan : vlanList) {
vlanDbIdList.add(vlan.getId());
@@ -138,7 +138,7 @@ public class DhcpSubNetRules extends RuleApplier {
}
// this means we did not create an IP alias on the router.
_nicAlias = new NicIpAliasVO(domrGuestNic.getId(), _routerAliasIp, _router.getId(), CallContext.current().getCallingAccountId(), _network.getDomainId(),
- _nic.getNetworkId(), _nic.getGateway(), _nic.getNetmask());
+ _nic.getNetworkId(), _nic.getIPv4Gateway(), _nic.getIPv4Netmask());
_nicAlias.setAliasCount(routerPublicIP.getIpMacAddress());
nicIpAliasDao.persist(_nicAlias);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/rules/NicPlugInOutRules.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/NicPlugInOutRules.java b/server/src/com/cloud/network/rules/NicPlugInOutRules.java
index 121be90..fa51a1b 100644
--- a/server/src/com/cloud/network/rules/NicPlugInOutRules.java
+++ b/server/src/com/cloud/network/rules/NicPlugInOutRules.java
@@ -100,9 +100,9 @@ public class NicPlugInOutRules extends RuleApplier {
if (ip.isSourceNat()) {
defaultNic.setDefaultNic(true);
}
- defaultNic.setIp4Address(ip.getAddress().addr());
- defaultNic.setGateway(ip.getGateway());
- defaultNic.setNetmask(ip.getNetmask());
+ defaultNic.setIPv4Address(ip.getAddress().addr());
+ defaultNic.setIPv4Gateway(ip.getGateway());
+ defaultNic.setIPv4Netmask(ip.getNetmask());
defaultNic.setMacAddress(ip.getMacAddress());
defaultNic.setBroadcastType(BroadcastDomainType.Vlan);
defaultNic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(ip.getVlanTag()));
@@ -125,14 +125,14 @@ public class NicPlugInOutRules extends RuleApplier {
}
// Create network usage commands. Send commands to router after
// IPAssoc
- NetworkUsageCommand netUsageCmd = new NetworkUsageCommand(_router.getPrivateIpAddress(), _router.getInstanceName(), true, defaultNic.getIp4Address(), vpc.getCidr());
+ NetworkUsageCommand netUsageCmd = new NetworkUsageCommand(_router.getPrivateIpAddress(), _router.getInstanceName(), true, defaultNic.getIPv4Address(), vpc.getCidr());
_netUsageCommands.addCommand(netUsageCmd);
UserStatisticsDao userStatsDao = visitor.getVirtualNetworkApplianceFactory().getUserStatsDao();
- UserStatisticsVO stats = userStatsDao.findBy(_router.getAccountId(), _router.getDataCenterId(), publicNtwk.getId(), publicNic.getIp4Address(), _router.getId(),
+ UserStatisticsVO stats = userStatsDao.findBy(_router.getAccountId(), _router.getDataCenterId(), publicNtwk.getId(), publicNic.getIPv4Address(), _router.getId(),
_router.getType().toString());
if (stats == null) {
- stats = new UserStatisticsVO(_router.getAccountId(), _router.getDataCenterId(), publicNic.getIp4Address(), _router.getId(), _router.getType().toString(),
+ stats = new UserStatisticsVO(_router.getAccountId(), _router.getDataCenterId(), publicNic.getIPv4Address(), _router.getId(), _router.getType().toString(),
publicNtwk.getId());
userStatsDao.persist(stats);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5db33718/server/src/com/cloud/network/rules/PrivateGatewayRules.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/PrivateGatewayRules.java b/server/src/com/cloud/network/rules/PrivateGatewayRules.java
index 476a617..17d90ea 100644
--- a/server/src/com/cloud/network/rules/PrivateGatewayRules.java
+++ b/server/src/com/cloud/network/rules/PrivateGatewayRules.java
@@ -101,7 +101,7 @@ public class PrivateGatewayRules extends RuleApplier {
}
public PrivateIpVO retrivePrivateIP(final NetworkTopologyVisitor visitor) {
- PrivateIpVO ipVO = visitor.getVirtualNetworkApplianceFactory().getPrivateIpDao().findByIpAndSourceNetworkId(_nicProfile.getNetworkId(), _nicProfile.getIp4Address());
+ PrivateIpVO ipVO = visitor.getVirtualNetworkApplianceFactory().getPrivateIpDao().findByIpAndSourceNetworkId(_nicProfile.getNetworkId(), _nicProfile.getIPv4Address());
return ipVO;
}