mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Refactored NicProfile.java for readability.
See issue CLOUDSTACK-8736 for ongoing effort to clean up network code.
This commit is contained in:
parent
caa524b01b
commit
5db3371840
@ -33,214 +33,64 @@ public class NicProfile implements InternalIdentity, Serializable {
|
||||
|
||||
long id;
|
||||
long networkId;
|
||||
BroadcastDomainType broadcastType;
|
||||
Mode mode;
|
||||
long vmId;
|
||||
String gateway;
|
||||
AddressFormat format;
|
||||
TrafficType trafficType;
|
||||
String ip4Address;
|
||||
String ip6Address;
|
||||
String ip6Gateway;
|
||||
String ip6Cidr;
|
||||
String macAddress;
|
||||
URI isolationUri;
|
||||
String netmask;
|
||||
URI broadcastUri;
|
||||
ReservationStrategy strategy;
|
||||
String reservationId;
|
||||
boolean defaultNic;
|
||||
Integer deviceId;
|
||||
String dns1;
|
||||
String dns2;
|
||||
String ip6Dns1;
|
||||
String ip6Dns2;
|
||||
Integer networkRate;
|
||||
boolean isSecurityGroupEnabled;
|
||||
|
||||
String name;
|
||||
String requestedIpv4;
|
||||
String requestedIpv6;
|
||||
String uuid;
|
||||
|
||||
public String getDns1() {
|
||||
return dns1;
|
||||
}
|
||||
String macAddress;
|
||||
BroadcastDomainType broadcastType;
|
||||
Mode mode;
|
||||
AddressFormat format;
|
||||
TrafficType trafficType;
|
||||
URI isolationUri;
|
||||
URI broadcastUri;
|
||||
ReservationStrategy strategy;
|
||||
boolean defaultNic;
|
||||
Integer networkRate;
|
||||
boolean isSecurityGroupEnabled;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
// IPv4
|
||||
String ipv4Address;
|
||||
String ipv4Netmask;
|
||||
String ipv4Gateway;
|
||||
String ipv4Dns1;
|
||||
String ipv4Dns2;
|
||||
String requestedIPv4;
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
// IPv6
|
||||
String ipv6Address;
|
||||
String ipv6Gateway;
|
||||
String ipv6Cidr;
|
||||
String ipv6Dns1;
|
||||
String ipv6Dns2;
|
||||
String requestedIPv6;
|
||||
|
||||
public String getDns2() {
|
||||
return dns2;
|
||||
}
|
||||
//
|
||||
// CONSTRUCTORS
|
||||
//
|
||||
|
||||
public void setDns1(String dns1) {
|
||||
this.dns1 = dns1;
|
||||
}
|
||||
|
||||
public void setDns2(String dns2) {
|
||||
this.dns2 = dns2;
|
||||
}
|
||||
|
||||
public boolean isDefaultNic() {
|
||||
return defaultNic;
|
||||
}
|
||||
|
||||
public String getNetmask() {
|
||||
return netmask;
|
||||
}
|
||||
|
||||
public void setNetmask(String netmask) {
|
||||
this.netmask = netmask;
|
||||
}
|
||||
|
||||
public void setBroadcastUri(URI broadcastUri) {
|
||||
this.broadcastUri = broadcastUri;
|
||||
}
|
||||
|
||||
public URI getBroadCastUri() {
|
||||
return broadcastUri;
|
||||
}
|
||||
|
||||
public void setIsolationUri(URI isolationUri) {
|
||||
this.isolationUri = isolationUri;
|
||||
}
|
||||
|
||||
public URI getIsolationUri() {
|
||||
return isolationUri;
|
||||
}
|
||||
|
||||
public void setStrategy(ReservationStrategy strategy) {
|
||||
this.strategy = strategy;
|
||||
}
|
||||
|
||||
public BroadcastDomainType getType() {
|
||||
return broadcastType;
|
||||
}
|
||||
|
||||
public void setBroadcastType(BroadcastDomainType broadcastType) {
|
||||
this.broadcastType = broadcastType;
|
||||
}
|
||||
|
||||
public void setMode(Mode mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public void setDeviceId(int deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public void setDefaultNic(boolean defaultNic) {
|
||||
this.defaultNic = defaultNic;
|
||||
}
|
||||
|
||||
public Integer getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setGateway(String gateway) {
|
||||
this.gateway = gateway;
|
||||
}
|
||||
|
||||
public void setFormat(AddressFormat format) {
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public void setTrafficType(TrafficType trafficType) {
|
||||
this.trafficType = trafficType;
|
||||
}
|
||||
|
||||
public void setIp6Address(String ip6Address) {
|
||||
this.ip6Address = ip6Address;
|
||||
}
|
||||
|
||||
public Mode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public long getVirtualMachineId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public BroadcastDomainType getBroadcastType() {
|
||||
return broadcastType;
|
||||
}
|
||||
|
||||
public void setMacAddress(String macAddress) {
|
||||
this.macAddress = macAddress;
|
||||
}
|
||||
|
||||
public long getVmId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
public String getGateway() {
|
||||
return gateway;
|
||||
}
|
||||
|
||||
public AddressFormat getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public TrafficType getTrafficType() {
|
||||
return trafficType;
|
||||
}
|
||||
|
||||
public String getIp4Address() {
|
||||
return ip4Address;
|
||||
}
|
||||
|
||||
public String getIp6Address() {
|
||||
return ip6Address;
|
||||
}
|
||||
|
||||
public String getMacAddress() {
|
||||
return macAddress;
|
||||
}
|
||||
|
||||
public void setIp4Address(String ip4Address) {
|
||||
this.ip4Address = ip4Address;
|
||||
}
|
||||
|
||||
public Integer getNetworkRate() {
|
||||
return networkRate;
|
||||
}
|
||||
|
||||
public ReservationStrategy getStrategy() {
|
||||
return strategy;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
public NicProfile() {
|
||||
}
|
||||
|
||||
public NicProfile(Nic nic, Network network, URI broadcastUri, URI isolationUri, Integer networkRate, boolean isSecurityGroupEnabled, String name) {
|
||||
id = nic.getId();
|
||||
networkId = network.getId();
|
||||
gateway = nic.getGateway();
|
||||
mode = network.getMode();
|
||||
broadcastType = network.getBroadcastDomainType();
|
||||
trafficType = network.getTrafficType();
|
||||
ip4Address = nic.getIp4Address();
|
||||
format = nic.getAddressFormat();
|
||||
ip6Address = nic.getIp6Address();
|
||||
|
||||
ipv4Address = nic.getIp4Address();
|
||||
ipv4Netmask = nic.getNetmask();
|
||||
ipv4Gateway = nic.getGateway();
|
||||
|
||||
ipv6Address = nic.getIp6Address();
|
||||
ipv6Gateway = nic.getIp6Gateway();
|
||||
ipv6Cidr = nic.getIp6Cidr();
|
||||
|
||||
macAddress = nic.getMacAddress();
|
||||
reservationId = nic.getReservationId();
|
||||
strategy = nic.getReservationStrategy();
|
||||
@ -248,12 +98,10 @@ public class NicProfile implements InternalIdentity, Serializable {
|
||||
defaultNic = nic.isDefaultNic();
|
||||
this.broadcastUri = broadcastUri;
|
||||
this.isolationUri = isolationUri;
|
||||
netmask = nic.getNetmask();
|
||||
|
||||
this.isSecurityGroupEnabled = isSecurityGroupEnabled;
|
||||
vmId = nic.getInstanceId();
|
||||
this.name = name;
|
||||
ip6Cidr = nic.getIp6Cidr();
|
||||
ip6Gateway = nic.getIp6Gateway();
|
||||
uuid = nic.getUuid();
|
||||
|
||||
if (networkRate != null) {
|
||||
@ -261,25 +109,47 @@ public class NicProfile implements InternalIdentity, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public NicProfile(ReservationStrategy strategy, String ip4Address, String macAddress, String gateway, String netmask) {
|
||||
public NicProfile(String requestedIPv4, String requestedIPv6) {
|
||||
this.requestedIPv4 = requestedIPv4;
|
||||
this.requestedIPv6 = requestedIPv6;
|
||||
}
|
||||
|
||||
public NicProfile(ReservationStrategy strategy, String ipv4Address, String macAddress, String gateway, String netmask) {
|
||||
format = AddressFormat.Ip4;
|
||||
this.ip4Address = ip4Address;
|
||||
this.ipv4Address = ipv4Address;
|
||||
this.ipv4Gateway = gateway;
|
||||
this.ipv4Netmask = netmask;
|
||||
this.macAddress = macAddress;
|
||||
this.gateway = gateway;
|
||||
this.netmask = netmask;
|
||||
this.strategy = strategy;
|
||||
}
|
||||
|
||||
public NicProfile(String requestedIpv4, String requestedIpv6) {
|
||||
this.requestedIpv4 = requestedIpv4;
|
||||
this.requestedIpv6 = requestedIpv6;
|
||||
//
|
||||
// GET & SET GENERAL
|
||||
//
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public NicProfile() {
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ReservationStrategy getReservationStrategy() {
|
||||
return strategy;
|
||||
public long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public void setNetworId(long networkId){
|
||||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
public long getVirtualMachineId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
public void setVirtualMachineId(long virtualMachineId) {
|
||||
this.vmId = virtualMachineId;
|
||||
}
|
||||
|
||||
public String getReservationId() {
|
||||
@ -290,6 +160,110 @@ public class NicProfile implements InternalIdentity, Serializable {
|
||||
this.reservationId = reservationId;
|
||||
}
|
||||
|
||||
public Integer getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(int deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getMacAddress() {
|
||||
return macAddress;
|
||||
}
|
||||
|
||||
public void setMacAddress(String macAddress) {
|
||||
this.macAddress = macAddress;
|
||||
}
|
||||
|
||||
public BroadcastDomainType getBroadcastType() {
|
||||
return broadcastType;
|
||||
}
|
||||
|
||||
public void setBroadcastType(BroadcastDomainType broadcastType) {
|
||||
this.broadcastType = broadcastType;
|
||||
}
|
||||
|
||||
public Mode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public void setMode(Mode mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public AddressFormat getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public void setFormat(AddressFormat format) {
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
public TrafficType getTrafficType() {
|
||||
return trafficType;
|
||||
}
|
||||
|
||||
public void setTrafficType(TrafficType trafficType) {
|
||||
this.trafficType = trafficType;
|
||||
}
|
||||
|
||||
public URI getIsolationUri() {
|
||||
return isolationUri;
|
||||
}
|
||||
|
||||
public void setIsolationUri(URI isolationUri) {
|
||||
this.isolationUri = isolationUri;
|
||||
}
|
||||
|
||||
public URI getBroadCastUri() {
|
||||
return broadcastUri;
|
||||
}
|
||||
|
||||
public void setBroadcastUri(URI broadcastUri) {
|
||||
this.broadcastUri = broadcastUri;
|
||||
}
|
||||
|
||||
public ReservationStrategy getReservationStrategy() {
|
||||
return strategy;
|
||||
}
|
||||
|
||||
public void setReservationStrategy(ReservationStrategy strategy) {
|
||||
this.strategy = strategy;
|
||||
}
|
||||
|
||||
public boolean isDefaultNic() {
|
||||
return defaultNic;
|
||||
}
|
||||
|
||||
public void setDefaultNic(boolean defaultNic) {
|
||||
this.defaultNic = defaultNic;
|
||||
}
|
||||
|
||||
public Integer getNetworkRate() {
|
||||
return networkRate;
|
||||
}
|
||||
|
||||
public void setNetworkRate(Integer networkRate) {
|
||||
this.networkRate = networkRate;
|
||||
}
|
||||
|
||||
public boolean isSecurityGroupEnabled() {
|
||||
return isSecurityGroupEnabled;
|
||||
}
|
||||
@ -298,27 +272,139 @@ public class NicProfile implements InternalIdentity, Serializable {
|
||||
isSecurityGroupEnabled = enabled;
|
||||
}
|
||||
|
||||
public String getRequestedIpv4() {
|
||||
return requestedIpv4;
|
||||
//
|
||||
// GET & SET IPv4
|
||||
//
|
||||
|
||||
public String getIPv4Address() {
|
||||
return ipv4Address;
|
||||
}
|
||||
|
||||
public void setIPv4Address(String ipv4Address) {
|
||||
this.ipv4Address = ipv4Address;
|
||||
}
|
||||
|
||||
public String getIPv4Netmask() {
|
||||
return ipv4Netmask;
|
||||
}
|
||||
|
||||
public void setIPv4Netmask(String ipv4Netmask) {
|
||||
this.ipv4Netmask = ipv4Netmask;
|
||||
}
|
||||
|
||||
public String getIPv4Gateway() {
|
||||
return ipv4Gateway;
|
||||
}
|
||||
|
||||
public void setIPv4Gateway(String ipv4Gateway) {
|
||||
this.ipv4Gateway = ipv4Gateway;
|
||||
}
|
||||
|
||||
public String getIPv4Dns1() {
|
||||
return ipv4Dns1;
|
||||
}
|
||||
|
||||
public void setIPv4Dns1(String ipv4Dns1) {
|
||||
this.ipv4Dns1 = ipv4Dns1;
|
||||
}
|
||||
|
||||
public String getIPv4Dns2() {
|
||||
return ipv4Dns2;
|
||||
}
|
||||
|
||||
public void setIPv4Dns2(String ipv4Dns2) {
|
||||
this.ipv4Dns2 = ipv4Dns2;
|
||||
}
|
||||
|
||||
public String getRequestedIPv4() {
|
||||
return requestedIPv4;
|
||||
}
|
||||
|
||||
public void setRequestedIPv4(String requestedIPv4) {
|
||||
this.requestedIPv4 = requestedIPv4;
|
||||
}
|
||||
|
||||
//
|
||||
// GET & SET IPv6
|
||||
//
|
||||
|
||||
public String getIPv6Address() {
|
||||
return ipv6Address;
|
||||
}
|
||||
|
||||
public void setIPv6Address(String ipv6Address) {
|
||||
this.ipv6Address = ipv6Address;
|
||||
}
|
||||
|
||||
public String getIPv6Gateway() {
|
||||
return ipv6Gateway;
|
||||
}
|
||||
|
||||
public void setIPv6Gateway(String ipv6Gateway) {
|
||||
this.ipv6Gateway = ipv6Gateway;
|
||||
}
|
||||
|
||||
public String getIPv6Cidr() {
|
||||
return ipv6Cidr;
|
||||
}
|
||||
|
||||
public void setIPv6Cidr(String ipv6Cidr) {
|
||||
this.ipv6Cidr = ipv6Cidr;
|
||||
}
|
||||
|
||||
public String getIPv6Dns1() {
|
||||
return ipv6Dns1;
|
||||
}
|
||||
|
||||
public void setIPv6Dns1(String ipv6Dns1) {
|
||||
this.ipv6Dns1 = ipv6Dns1;
|
||||
}
|
||||
|
||||
public String getIPv6Dns2() {
|
||||
return ipv6Dns2;
|
||||
}
|
||||
|
||||
public void setIPv6Dns2(String ipv6Dns2) {
|
||||
this.ipv6Dns2 = ipv6Dns2;
|
||||
}
|
||||
|
||||
public String getRequestedIPv6() {
|
||||
return requestedIPv6;
|
||||
}
|
||||
|
||||
public void setRequestedIPv6(String requestedIPv6) {
|
||||
this.requestedIPv6 = requestedIPv6;
|
||||
}
|
||||
|
||||
//
|
||||
// OTHER METHODS
|
||||
//
|
||||
|
||||
public void deallocate() {
|
||||
gateway = null;
|
||||
mode = null;
|
||||
format = null;
|
||||
broadcastType = null;
|
||||
trafficType = null;
|
||||
ip4Address = null;
|
||||
ip6Address = null;
|
||||
|
||||
ipv4Address = null;
|
||||
ipv4Netmask = null;
|
||||
ipv4Gateway = null;
|
||||
ipv4Dns1 = null;
|
||||
ipv4Dns2 = null;
|
||||
|
||||
ipv6Address = null;
|
||||
ipv6Gateway = null;
|
||||
ipv6Cidr = null;
|
||||
ipv6Dns1 = null;
|
||||
ipv6Dns2 = null;
|
||||
|
||||
macAddress = null;
|
||||
reservationId = null;
|
||||
strategy = null;
|
||||
deviceId = null;
|
||||
broadcastUri = null;
|
||||
isolationUri = null;
|
||||
netmask = null;
|
||||
dns1 = null;
|
||||
dns2 = null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -329,54 +415,9 @@ public class NicProfile implements InternalIdentity, Serializable {
|
||||
.append("-")
|
||||
.append(reservationId)
|
||||
.append("-")
|
||||
.append(ip4Address)
|
||||
.append(ipv4Address)
|
||||
.append("-")
|
||||
.append(broadcastUri)
|
||||
.toString();
|
||||
}
|
||||
|
||||
public String getIp6Gateway() {
|
||||
return ip6Gateway;
|
||||
}
|
||||
|
||||
public void setIp6Gateway(String ip6Gateway) {
|
||||
this.ip6Gateway = ip6Gateway;
|
||||
}
|
||||
|
||||
public String getIp6Cidr() {
|
||||
return ip6Cidr;
|
||||
}
|
||||
|
||||
public void setIp6Cidr(String ip6Cidr) {
|
||||
this.ip6Cidr = ip6Cidr;
|
||||
}
|
||||
|
||||
public String getRequestedIpv6() {
|
||||
return requestedIpv6;
|
||||
}
|
||||
|
||||
public void setRequestedIpv6(String requestedIpv6) {
|
||||
this.requestedIpv6 = requestedIpv6;
|
||||
}
|
||||
|
||||
public String getIp6Dns1() {
|
||||
return ip6Dns1;
|
||||
}
|
||||
|
||||
public void setIp6Dns1(String ip6Dns1) {
|
||||
this.ip6Dns1 = ip6Dns1;
|
||||
}
|
||||
|
||||
public String getIp6Dns2() {
|
||||
return ip6Dns2;
|
||||
}
|
||||
|
||||
public void setIp6Dns2(String ip6Dns2) {
|
||||
this.ip6Dns2 = ip6Dns2;
|
||||
}
|
||||
|
||||
public void setNetworId(long networkId){
|
||||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -37,9 +37,6 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.network.Networks;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.db.VMNetworkMapVO;
|
||||
@ -47,13 +44,14 @@ import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMNetworkMapDao;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
import org.apache.cloudstack.framework.config.ConfigDepot;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey.Scope;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.framework.messagebus.MessageBus;
|
||||
import org.apache.cloudstack.framework.messagebus.PublishScope;
|
||||
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
||||
import org.apache.cloudstack.region.PortableIpDao;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.Listener;
|
||||
@ -111,6 +109,7 @@ import com.cloud.network.NetworkMigrationResponder;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.NetworkProfile;
|
||||
import com.cloud.network.NetworkStateListener;
|
||||
import com.cloud.network.Networks;
|
||||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.PhysicalNetwork;
|
||||
@ -839,7 +838,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
|
||||
vo.setDefaultNic(profile.isDefaultNic());
|
||||
|
||||
vo.setIp4Address(profile.getIp4Address());
|
||||
vo.setIp4Address(profile.getIPv4Address());
|
||||
vo.setAddressFormat(profile.getFormat());
|
||||
|
||||
if (profile.getMacAddress() != null) {
|
||||
@ -847,8 +846,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
}
|
||||
|
||||
vo.setMode(profile.getMode());
|
||||
vo.setNetmask(profile.getNetmask());
|
||||
vo.setGateway(profile.getGateway());
|
||||
vo.setNetmask(profile.getIPv4Netmask());
|
||||
vo.setGateway(profile.getIPv4Gateway());
|
||||
|
||||
if (profile.getBroadCastUri() != null) {
|
||||
vo.setBroadcastUri(profile.getBroadCastUri());
|
||||
@ -860,25 +859,25 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
|
||||
vo.setState(Nic.State.Allocated);
|
||||
|
||||
vo.setIp6Address(profile.getIp6Address());
|
||||
vo.setIp6Gateway(profile.getIp6Gateway());
|
||||
vo.setIp6Cidr(profile.getIp6Cidr());
|
||||
vo.setIp6Address(profile.getIPv6Address());
|
||||
vo.setIp6Gateway(profile.getIPv6Gateway());
|
||||
vo.setIp6Cidr(profile.getIPv6Cidr());
|
||||
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
protected void applyProfileToNicForRelease(NicVO vo, NicProfile profile) {
|
||||
vo.setGateway(profile.getGateway());
|
||||
vo.setGateway(profile.getIPv4Gateway());
|
||||
vo.setAddressFormat(profile.getFormat());
|
||||
vo.setIp4Address(profile.getIp4Address());
|
||||
vo.setIp6Address(profile.getIp6Address());
|
||||
vo.setIp4Address(profile.getIPv4Address());
|
||||
vo.setIp6Address(profile.getIPv6Address());
|
||||
vo.setMacAddress(profile.getMacAddress());
|
||||
if (profile.getReservationStrategy() != null) {
|
||||
vo.setReservationStrategy(profile.getReservationStrategy());
|
||||
}
|
||||
vo.setBroadcastUri(profile.getBroadCastUri());
|
||||
vo.setIsolationUri(profile.getIsolationUri());
|
||||
vo.setNetmask(profile.getNetmask());
|
||||
vo.setNetmask(profile.getIPv4Netmask());
|
||||
}
|
||||
|
||||
protected void applyProfileToNetwork(NetworkVO network, NetworkProfile profile) {
|
||||
@ -896,8 +895,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
to.setIp(nic.getIp4Address());
|
||||
to.setNetmask(nic.getNetmask());
|
||||
to.setMac(nic.getMacAddress());
|
||||
to.setDns1(profile.getDns1());
|
||||
to.setDns2(profile.getDns2());
|
||||
to.setDns1(profile.getIPv4Dns1());
|
||||
to.setDns2(profile.getIPv4Dns2());
|
||||
if (nic.getGateway() != null) {
|
||||
to.setGateway(nic.getGateway());
|
||||
} else {
|
||||
@ -910,8 +909,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
to.setBroadcastUri(nic.getBroadcastUri());
|
||||
to.setIsolationuri(nic.getIsolationUri());
|
||||
if (profile != null) {
|
||||
to.setDns1(profile.getDns1());
|
||||
to.setDns2(profile.getDns2());
|
||||
to.setDns1(profile.getIPv4Dns1());
|
||||
to.setDns2(profile.getIPv4Dns2());
|
||||
}
|
||||
|
||||
Integer networkRate = _networkModel.getNetworkRate(config.getId(), null);
|
||||
@ -1240,7 +1239,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
DhcpServiceProvider sp = (DhcpServiceProvider)element;
|
||||
Map<Capability, String> dhcpCapabilities = element.getCapabilities().get(Service.Dhcp);
|
||||
String supportsMultipleSubnets = dhcpCapabilities.get(Capability.DhcpAccrossMultipleSubnets);
|
||||
if ((supportsMultipleSubnets != null && Boolean.valueOf(supportsMultipleSubnets)) && profile.getIp6Address() == null) {
|
||||
if ((supportsMultipleSubnets != null && Boolean.valueOf(supportsMultipleSubnets)) && profile.getIPv6Address() == null) {
|
||||
if (!sp.configDhcpSupportForSubnet(network, profile, vmProfile, dest, context)) {
|
||||
return false;
|
||||
}
|
||||
@ -1333,19 +1332,19 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
|
||||
networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
|
||||
guru.reserve(profile, network, vmProfile, dest, context);
|
||||
nic.setIp4Address(profile.getIp4Address());
|
||||
nic.setIp4Address(profile.getIPv4Address());
|
||||
nic.setAddressFormat(profile.getFormat());
|
||||
nic.setIp6Address(profile.getIp6Address());
|
||||
nic.setIp6Address(profile.getIPv6Address());
|
||||
nic.setMacAddress(profile.getMacAddress());
|
||||
nic.setIsolationUri(profile.getIsolationUri());
|
||||
nic.setBroadcastUri(profile.getBroadCastUri());
|
||||
nic.setReserver(guru.getName());
|
||||
nic.setState(Nic.State.Reserved);
|
||||
nic.setNetmask(profile.getNetmask());
|
||||
nic.setGateway(profile.getGateway());
|
||||
nic.setNetmask(profile.getIPv4Netmask());
|
||||
nic.setGateway(profile.getIPv4Gateway());
|
||||
|
||||
if (profile.getStrategy() != null) {
|
||||
nic.setReservationStrategy(profile.getStrategy());
|
||||
if (profile.getReservationStrategy() != null) {
|
||||
nic.setReservationStrategy(profile.getReservationStrategy());
|
||||
}
|
||||
|
||||
updateNic(nic, network.getId(), 1);
|
||||
@ -1478,9 +1477,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName());
|
||||
NicProfile profile = new NicProfile();
|
||||
profile.setDeviceId(255); //dummyId
|
||||
profile.setIp4Address(userIp.getAddress().toString());
|
||||
profile.setNetmask(publicIp.getNetmask());
|
||||
profile.setGateway(publicIp.getGateway());
|
||||
profile.setIPv4Address(userIp.getAddress().toString());
|
||||
profile.setIPv4Netmask(publicIp.getNetmask());
|
||||
profile.setIPv4Gateway(publicIp.getGateway());
|
||||
profile.setMacAddress(publicIp.getMacAddress());
|
||||
profile.setBroadcastType(network.getBroadcastDomainType());
|
||||
profile.setTrafficType(network.getTrafficType());
|
||||
@ -3116,7 +3115,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
NicProfile nic = null;
|
||||
if (requested != null && requested.getBroadCastUri() != null) {
|
||||
String broadcastUri = requested.getBroadCastUri().toString();
|
||||
String ipAddress = requested.getIp4Address();
|
||||
String ipAddress = requested.getIPv4Address();
|
||||
NicVO nicVO = _nicDao.findByNetworkIdInstanceIdAndBroadcastUri(network.getId(), vm.getId(), broadcastUri);
|
||||
if (nicVO != null) {
|
||||
if (ipAddress == null || nicVO.getIp4Address().equals(ipAddress)) {
|
||||
|
||||
@ -30,19 +30,17 @@ import java.util.Map;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.network.Network;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.AddBaremetalPxeCmd;
|
||||
import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
|
||||
import org.apache.cloudstack.api.ListBaremetalPxeServersCmd;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.baremetal.IpmISetBootDevCommand;
|
||||
import com.cloud.agent.api.baremetal.IpmISetBootDevCommand.BootDev;
|
||||
import com.cloud.agent.api.baremetal.PrepareCreateTemplateCommand;
|
||||
import com.cloud.agent.api.baremetal.PreparePxeServerAnswer;
|
||||
import com.cloud.agent.api.baremetal.PreparePxeServerCommand;
|
||||
import com.cloud.agent.api.baremetal.PrepareCreateTemplateCommand;
|
||||
import com.cloud.baremetal.database.BaremetalPxeDao;
|
||||
import com.cloud.baremetal.database.BaremetalPxeVO;
|
||||
import com.cloud.baremetal.networkservice.BaremetalPxeManager.BaremetalPxeType;
|
||||
@ -52,6 +50,7 @@ import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.dao.HostDetailsDao;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.PhysicalNetworkServiceProvider;
|
||||
import com.cloud.network.dao.PhysicalNetworkDao;
|
||||
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
|
||||
@ -95,12 +94,12 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
|
||||
long pxeServerId = pxeVo.getHostId();
|
||||
|
||||
String mac = pxeNic.getMacAddress();
|
||||
String ip = pxeNic.getIp4Address();
|
||||
String gateway = pxeNic.getGateway();
|
||||
String mask = pxeNic.getNetmask();
|
||||
String dns = pxeNic.getDns1();
|
||||
String ip = pxeNic.getIPv4Address();
|
||||
String gateway = pxeNic.getIPv4Gateway();
|
||||
String mask = pxeNic.getIPv4Netmask();
|
||||
String dns = pxeNic.getIPv4Dns1();
|
||||
if (dns == null) {
|
||||
dns = pxeNic.getDns2();
|
||||
dns = pxeNic.getIPv4Dns2();
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@ -18,6 +18,13 @@
|
||||
// Automatically generated by addcopyright.py at 01/29/2013
|
||||
package com.cloud.baremetal.networkservice;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.dc.PodVlanMapVO;
|
||||
@ -50,12 +57,6 @@ import com.cloud.utils.db.TransactionStatus;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
@Local(value = {NetworkGuru.class})
|
||||
public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
|
||||
@ -93,7 +94,7 @@ public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
|
||||
return;
|
||||
}
|
||||
|
||||
String oldIp = nic.getIp4Address();
|
||||
String oldIp = nic.getIPv4Address();
|
||||
boolean getNewIp = false;
|
||||
if (oldIp == null) {
|
||||
getNewIp = true;
|
||||
@ -113,7 +114,7 @@ public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
|
||||
}
|
||||
});
|
||||
|
||||
nic.setIp4Address(null);
|
||||
nic.setIPv4Address(null);
|
||||
getNewIp = true;
|
||||
}
|
||||
}
|
||||
@ -127,8 +128,8 @@ public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
|
||||
}
|
||||
|
||||
DataCenter dc = _dcDao.findById(network.getDataCenterId());
|
||||
nic.setDns1(dc.getDns1());
|
||||
nic.setDns2(dc.getDns2());
|
||||
nic.setIPv4Dns1(dc.getDns1());
|
||||
nic.setIPv4Dns2(dc.getDns2());
|
||||
|
||||
/*
|
||||
* Pod pod = dest.getPod(); Pair<String, Long> ip =
|
||||
@ -154,13 +155,13 @@ public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
|
||||
private void getBaremetalIp(NicProfile nic, Pod pod, VirtualMachineProfile vm, Network network, String requiredIp) throws
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||
DataCenter dc = _dcDao.findById(pod.getDataCenterId());
|
||||
if (nic.getIp4Address() == null) {
|
||||
s_logger.debug(String.format("Requiring ip address: %s", nic.getIp4Address()));
|
||||
if (nic.getIPv4Address() == null) {
|
||||
s_logger.debug(String.format("Requiring ip address: %s", nic.getIPv4Address()));
|
||||
PublicIp ip = _ipAddrMgr.assignPublicIpAddress(dc.getId(), pod.getId(), vm.getOwner(), VlanType.DirectAttached, network.getId(), requiredIp, 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));
|
||||
@ -169,7 +170,7 @@ public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,20 @@
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.baremetal.networkservice;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.api.AddBaremetalDhcpCmd;
|
||||
import org.apache.cloudstack.api.ListBaremetalDhcpCmd;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
@ -60,18 +74,6 @@ import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
import org.apache.cloudstack.api.AddBaremetalDhcpCmd;
|
||||
import org.apache.cloudstack.api.ListBaremetalDhcpCmd;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Local(value = {BaremetalDhcpManager.class})
|
||||
public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDhcpManager, ResourceStateAdapter {
|
||||
@ -141,22 +143,22 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDh
|
||||
}
|
||||
|
||||
HostVO h = hosts.get(0);
|
||||
String dns = nic.getDns1();
|
||||
String dns = nic.getIPv4Dns1();
|
||||
if (dns == null) {
|
||||
dns = nic.getDns2();
|
||||
dns = nic.getIPv4Dns2();
|
||||
}
|
||||
DhcpEntryCommand dhcpCommand =
|
||||
new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), profile.getVirtualMachine().getHostName(), null, dns, nic.getGateway(), null,
|
||||
new DhcpEntryCommand(nic.getMacAddress(), nic.getIPv4Address(), profile.getVirtualMachine().getHostName(), null, dns, nic.getIPv4Gateway(), null,
|
||||
_ntwkModel.getExecuteInSeqNtwkElmtCmd());
|
||||
String errMsg =
|
||||
String.format("Set dhcp entry on external DHCP %1$s failed(ip=%2$s, mac=%3$s, vmname=%4$s)", h.getPrivateIpAddress(), nic.getIp4Address(),
|
||||
String.format("Set dhcp entry on external DHCP %1$s failed(ip=%2$s, mac=%3$s, vmname=%4$s)", h.getPrivateIpAddress(), nic.getIPv4Address(),
|
||||
nic.getMacAddress(), profile.getVirtualMachine().getHostName());
|
||||
// prepareBareMetalDhcpEntry(nic, dhcpCommand);
|
||||
try {
|
||||
Answer ans = _agentMgr.send(h.getId(), dhcpCommand);
|
||||
if (ans.getResult()) {
|
||||
s_logger.debug(String.format("Set dhcp entry on external DHCP %1$s successfully(ip=%2$s, mac=%3$s, vmname=%4$s)", h.getPrivateIpAddress(),
|
||||
nic.getIp4Address(), nic.getMacAddress(), profile.getVirtualMachine().getHostName()));
|
||||
nic.getIPv4Address(), nic.getMacAddress(), profile.getVirtualMachine().getHostName()));
|
||||
return true;
|
||||
} else {
|
||||
s_logger.debug(errMsg + " " + ans.getDetails());
|
||||
|
||||
@ -30,14 +30,12 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.network.Network;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd;
|
||||
import org.apache.cloudstack.api.AddBaremetalPxeCmd;
|
||||
import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
|
||||
import org.apache.cloudstack.api.ListBaremetalPxeServersCmd;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
@ -50,6 +48,7 @@ import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.dao.PhysicalNetworkDao;
|
||||
import com.cloud.network.dao.PhysicalNetworkVO;
|
||||
@ -199,9 +198,9 @@ public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxe
|
||||
cmd.addVmData("userdata", "user-data", vm.getUserData());
|
||||
cmd.addVmData("metadata", "service-offering", StringUtils.unicodeEscape(serviceOffering));
|
||||
cmd.addVmData("metadata", "availability-zone", StringUtils.unicodeEscape(zoneName));
|
||||
cmd.addVmData("metadata", "local-ipv4", nic.getIp4Address());
|
||||
cmd.addVmData("metadata", "local-ipv4", nic.getIPv4Address());
|
||||
cmd.addVmData("metadata", "local-hostname", StringUtils.unicodeEscape(vm.getInstanceName()));
|
||||
cmd.addVmData("metadata", "public-ipv4", nic.getIp4Address());
|
||||
cmd.addVmData("metadata", "public-ipv4", nic.getIPv4Address());
|
||||
cmd.addVmData("metadata", "public-hostname", StringUtils.unicodeEscape(vm.getInstanceName()));
|
||||
cmd.addVmData("metadata", "instance-id", String.valueOf(vm.getId()));
|
||||
cmd.addVmData("metadata", "vm-id", String.valueOf(vm.getInstanceName()));
|
||||
|
||||
@ -27,18 +27,18 @@ import javax.inject.Inject;
|
||||
|
||||
import com.cloud.agent.api.to.NicTO;
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.hypervisor.HypervisorGuru;
|
||||
import com.cloud.hypervisor.HypervisorGuruBase;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.dao.GuestOSDao;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.hypervisor.hyperv.manager.HypervManager;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.dao.NetworkVO;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.dao.GuestOSDao;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
@ -129,10 +129,10 @@ public class HypervGuru extends HypervisorGuruBase implements HypervisorGuru {
|
||||
} catch (InsufficientAddressCapacityException e) {
|
||||
throw new CloudRuntimeException("unable to allocate mac address on network: " + networkId);
|
||||
}
|
||||
nicTo.setDns1(profile.getDns1());
|
||||
nicTo.setDns2(profile.getDns2());
|
||||
if (publicNicProfile != null && publicNicProfile.getGateway() != null) {
|
||||
nicTo.setGateway(publicNicProfile.getGateway());
|
||||
nicTo.setDns1(profile.getIPv4Dns1());
|
||||
nicTo.setDns2(profile.getIPv4Dns2());
|
||||
if (publicNicProfile != null && publicNicProfile.getIPv4Gateway() != null) {
|
||||
nicTo.setGateway(publicNicProfile.getIPv4Gateway());
|
||||
} else {
|
||||
nicTo.setGateway(network.getGateway());
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
|
||||
String hostname = dest.getHost().getName();
|
||||
String nicId = nic.getUuid();
|
||||
Integer vlan = Integer.valueOf(BroadcastDomainType.getValue(nic.getIsolationUri()));
|
||||
String ipv4 = nic.getIp4Address();
|
||||
String ipv4 = nic.getIPv4Address();
|
||||
String mac = nic.getMacAddress();
|
||||
long zoneId = network.getDataCenterId();
|
||||
String vmwareVswitchLabel = _networkModel.getDefaultGuestTrafficLabel(zoneId, HypervisorType.VMware);
|
||||
|
||||
@ -387,7 +387,7 @@ public class BigSwitchBcfGuestNetworkGuru extends GuestNetworkGuru implements Ne
|
||||
|
||||
String nicId = nic.getUuid();
|
||||
Integer vlan = Integer.valueOf(BroadcastDomainType.getValue(nic.getIsolationUri()));
|
||||
String ipv4 = nic.getIp4Address();
|
||||
String ipv4 = nic.getIPv4Address();
|
||||
String mac = nic.getMacAddress();
|
||||
|
||||
CreateBcfAttachmentCommand cmd = new CreateBcfAttachmentCommand(tenantId,
|
||||
|
||||
@ -73,8 +73,8 @@ public class DnsNotifier extends AdapterBase implements NetworkElement {
|
||||
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
||||
// signal to the dns server that this vm is up and running and set the ip address to hostname mapping.
|
||||
vm.getHostName();
|
||||
nic.getIp4Address();
|
||||
nic.getIp6Address();
|
||||
nic.getIPv4Address();
|
||||
nic.getIPv6Address();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -82,8 +82,8 @@ public class DnsNotifier extends AdapterBase implements NetworkElement {
|
||||
public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException {
|
||||
vm.getHostName();
|
||||
nic.getIp4Address();
|
||||
nic.getIp6Address();
|
||||
nic.getIPv4Address();
|
||||
nic.getIPv6Address();
|
||||
// signal to the dns server that the vm is being shutdown and remove the mapping.
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -434,12 +434,12 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast
|
||||
|
||||
for (NicProfile nic : profile.getNics()) {
|
||||
int deviceId = nic.getDeviceId();
|
||||
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());
|
||||
defaultDns1 = nic.getDns1();
|
||||
defaultDns2 = nic.getDns2();
|
||||
buf.append(" gateway=").append(nic.getIPv4Gateway());
|
||||
defaultDns1 = nic.getIPv4Dns1();
|
||||
defaultDns2 = nic.getIPv4Dns2();
|
||||
}
|
||||
if (nic.getTrafficType() == TrafficType.Management) {
|
||||
buf.append(" localgw=").append(dest.getPod().getGateway());
|
||||
@ -497,11 +497,11 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast
|
||||
List<NicProfile> nics = profile.getNics();
|
||||
for (NicProfile nic : nics) {
|
||||
if (nic.getTrafficType() == TrafficType.Public) {
|
||||
elbVm.setPublicIpAddress(nic.getIp4Address());
|
||||
elbVm.setPublicNetmask(nic.getNetmask());
|
||||
elbVm.setPublicIpAddress(nic.getIPv4Address());
|
||||
elbVm.setPublicNetmask(nic.getIPv4Netmask());
|
||||
elbVm.setPublicMacAddress(nic.getMacAddress());
|
||||
} else if (nic.getTrafficType() == TrafficType.Control) {
|
||||
elbVm.setPrivateIpAddress(nic.getIp4Address());
|
||||
elbVm.setPrivateIpAddress(nic.getIPv4Address());
|
||||
elbVm.setPrivateMacAddress(nic.getMacAddress());
|
||||
}
|
||||
}
|
||||
@ -534,14 +534,14 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast
|
||||
// TODO this is a ugly to test hypervisor type here
|
||||
// for basic network mode, we will use the guest NIC for control NIC
|
||||
for (NicProfile nic : profile.getNics()) {
|
||||
if (nic.getTrafficType() == TrafficType.Guest && nic.getIp4Address() != null) {
|
||||
if (nic.getTrafficType() == TrafficType.Guest && nic.getIPv4Address() != null) {
|
||||
controlNic = nic;
|
||||
guestNetworkId = nic.getNetworkId();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (NicProfile nic : profile.getNics()) {
|
||||
if (nic.getTrafficType() == TrafficType.Control && nic.getIp4Address() != null) {
|
||||
if (nic.getTrafficType() == TrafficType.Control && nic.getIPv4Address() != null) {
|
||||
controlNic = nic;
|
||||
} else if (nic.getTrafficType() == TrafficType.Guest) {
|
||||
guestNetworkId = nic.getNetworkId();
|
||||
@ -554,7 +554,7 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast
|
||||
return false;
|
||||
}
|
||||
|
||||
cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922));
|
||||
cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIPv4Address(), 3922));
|
||||
|
||||
// Re-apply load balancing rules
|
||||
List<LoadBalancerVO> lbs = _elbVmMapDao.listLbsForElbVm(elbVm.getId());
|
||||
|
||||
@ -152,7 +152,7 @@ public class GloboDnsElement extends AdapterBase implements ResourceStateAdapter
|
||||
throw new InvalidParameterValueException("VM name should contain only lower case letters and digits: " + vmName + " - " + vm);
|
||||
}
|
||||
|
||||
CreateOrUpdateRecordAndReverseCommand cmd = new CreateOrUpdateRecordAndReverseCommand(vmHostname, nic.getIp4Address(), network.getNetworkDomain(),
|
||||
CreateOrUpdateRecordAndReverseCommand cmd = new CreateOrUpdateRecordAndReverseCommand(vmHostname, nic.getIPv4Address(), network.getNetworkDomain(),
|
||||
GloboDNSTemplateId.value(), GloboDNSOverride.value());
|
||||
callCommand(cmd, zoneId);
|
||||
return true;
|
||||
@ -174,7 +174,7 @@ public class GloboDnsElement extends AdapterBase implements ResourceStateAdapter
|
||||
throw new CloudRuntimeException("Could not find zone associated to this network");
|
||||
}
|
||||
|
||||
RemoveRecordCommand cmd = new RemoveRecordCommand(hostNameOfVirtualMachine(vm), nic.getIp4Address(), network.getNetworkDomain(), GloboDNSOverride.value());
|
||||
RemoveRecordCommand cmd = new RemoveRecordCommand(hostNameOfVirtualMachine(vm), nic.getIPv4Address(), network.getNetworkDomain(), GloboDNSOverride.value());
|
||||
callCommand(cmd, zoneId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -19,9 +19,9 @@ package com.globo.globodns.cloudstack.element;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Matchers.isA;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -151,7 +151,7 @@ public class GloboDnsElementTest {
|
||||
when(network.getDataCenterId()).thenReturn(zoneId);
|
||||
when(network.getId()).thenReturn(1l);
|
||||
NicProfile nic = new NicProfile();
|
||||
nic.setIp4Address("10.11.12.13");
|
||||
nic.setIPv4Address("10.11.12.13");
|
||||
VirtualMachineProfile vm = mock(VirtualMachineProfile.class);
|
||||
when(vm.getHostName()).thenReturn("vm-name");
|
||||
when(vm.getType()).thenReturn(VirtualMachine.Type.User);
|
||||
@ -184,7 +184,7 @@ public class GloboDnsElementTest {
|
||||
when(network.getDataCenterId()).thenReturn(zoneId);
|
||||
when(network.getId()).thenReturn(1l);
|
||||
NicProfile nic = new NicProfile();
|
||||
nic.setIp4Address("10.11.12.13");
|
||||
nic.setIPv4Address("10.11.12.13");
|
||||
VirtualMachineProfile vm = mock(VirtualMachineProfile.class);
|
||||
when(vm.getHostName()).thenReturn("vm-name");
|
||||
when(vm.getType()).thenReturn(VirtualMachine.Type.User);
|
||||
|
||||
@ -190,12 +190,12 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In
|
||||
|
||||
for (final NicProfile nic : profile.getNics()) {
|
||||
final int deviceId = nic.getDeviceId();
|
||||
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(" dns1=").append(nic.getGateway());
|
||||
buf.append(" gateway=").append(nic.getIPv4Gateway());
|
||||
buf.append(" dns1=").append(nic.getIPv4Gateway());
|
||||
}
|
||||
|
||||
if (nic.getTrafficType() == TrafficType.Guest) {
|
||||
@ -251,7 +251,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In
|
||||
final List<NicProfile> nics = profile.getNics();
|
||||
for (final NicProfile nic : nics) {
|
||||
if (nic.getTrafficType() == TrafficType.Control) {
|
||||
internalLbVm.setPrivateIpAddress(nic.getIp4Address());
|
||||
internalLbVm.setPrivateIpAddress(nic.getIPv4Address());
|
||||
internalLbVm.setPrivateMacAddress(nic.getMacAddress());
|
||||
}
|
||||
}
|
||||
@ -339,7 +339,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In
|
||||
|
||||
if (reprogramGuestNtwk) {
|
||||
final NicProfile guestNic = getNicProfileByTrafficType(profile, TrafficType.Guest);
|
||||
finalizeLbRulesForIp(cmds, internalLbVm, provider, new Ip(guestNic.getIp4Address()), guestNic.getNetworkId());
|
||||
finalizeLbRulesForIp(cmds, internalLbVm, provider, new Ip(guestNic.getIPv4Address()), guestNic.getNetworkId());
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -408,7 +408,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In
|
||||
|
||||
protected NicProfile getNicProfileByTrafficType(final VirtualMachineProfile profile, final TrafficType trafficType) {
|
||||
for (final NicProfile nic : profile.getNics()) {
|
||||
if (nic.getTrafficType() == trafficType && nic.getIp4Address() != null) {
|
||||
if (nic.getTrafficType() == trafficType && nic.getIPv4Address() != null) {
|
||||
return nic;
|
||||
}
|
||||
}
|
||||
@ -416,11 +416,11 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In
|
||||
}
|
||||
|
||||
protected void finalizeSshAndVersionOnStart(final Commands cmds, final VirtualMachineProfile profile, final DomainRouterVO router, final NicProfile controlNic) {
|
||||
cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922));
|
||||
cmds.addCommand("checkSsh", new CheckSshCommand(profile.getInstanceName(), controlNic.getIPv4Address(), 3922));
|
||||
|
||||
// Update internal lb vm 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);
|
||||
}
|
||||
@ -672,17 +672,17 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In
|
||||
s_logger.debug("Adding nic for Internal LB in Guest network " + guestNetwork);
|
||||
final NicProfile guestNic = new NicProfile();
|
||||
if (guestIp != null) {
|
||||
guestNic.setIp4Address(guestIp.addr());
|
||||
guestNic.setIPv4Address(guestIp.addr());
|
||||
} else {
|
||||
guestNic.setIp4Address(_ipAddrMgr.acquireGuestIpAddress(guestNetwork, null));
|
||||
guestNic.setIPv4Address(_ipAddrMgr.acquireGuestIpAddress(guestNetwork, null));
|
||||
}
|
||||
guestNic.setGateway(guestNetwork.getGateway());
|
||||
guestNic.setIPv4Gateway(guestNetwork.getGateway());
|
||||
guestNic.setBroadcastUri(guestNetwork.getBroadcastUri());
|
||||
guestNic.setBroadcastType(guestNetwork.getBroadcastDomainType());
|
||||
guestNic.setIsolationUri(guestNetwork.getBroadcastUri());
|
||||
guestNic.setMode(guestNetwork.getMode());
|
||||
final String gatewayCidr = guestNetwork.getCidr();
|
||||
guestNic.setNetmask(NetUtils.getCidrNetmask(gatewayCidr));
|
||||
guestNic.setIPv4Netmask(NetUtils.getCidrNetmask(gatewayCidr));
|
||||
guestNic.setDefaultNic(true);
|
||||
networks.put(guestNetwork, new ArrayList<NicProfile>(Arrays.asList(guestNic)));
|
||||
}
|
||||
|
||||
@ -27,24 +27,19 @@ import java.util.Set;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.network.contrail.api.command.CreateServiceInstanceCmd;
|
||||
import org.apache.cloudstack.network.contrail.model.InstanceIpModel;
|
||||
import org.apache.cloudstack.network.contrail.model.VMInterfaceModel;
|
||||
import org.apache.cloudstack.network.contrail.model.VirtualMachineModel;
|
||||
import org.apache.cloudstack.network.contrail.model.VirtualNetworkModel;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.dao.NetworkVO;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Provider;
|
||||
@ -52,12 +47,17 @@ import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.PhysicalNetworkServiceProvider;
|
||||
import com.cloud.network.PublicIpAddress;
|
||||
import com.cloud.network.element.IpDeployer;
|
||||
import com.cloud.network.element.StaticNatServiceProvider;
|
||||
import com.cloud.network.element.SourceNatServiceProvider;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.dao.NetworkVO;
|
||||
import com.cloud.network.element.DhcpServiceProvider;
|
||||
import com.cloud.network.element.IpDeployer;
|
||||
import com.cloud.network.element.SourceNatServiceProvider;
|
||||
import com.cloud.network.element.StaticNatServiceProvider;
|
||||
import com.cloud.network.rules.StaticNat;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.server.ConfigurationServerImpl;
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.NicVO;
|
||||
@ -65,8 +65,6 @@ import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.server.ConfigurationServer;
|
||||
import com.cloud.server.ConfigurationServerImpl;
|
||||
|
||||
@Component
|
||||
@Local(value = {ContrailElement.class, StaticNatServiceProvider.class, IpDeployer.class, SourceNatServiceProvider.class})
|
||||
@ -196,7 +194,7 @@ public class ContrailElementImpl extends AdapterBase
|
||||
ipModel = new InstanceIpModel(vm.getInstanceName(), nic.getDeviceId());
|
||||
ipModel.addToVMInterface(vmiModel);
|
||||
}
|
||||
ipModel.setAddress(nicProfile.getIp4Address());
|
||||
ipModel.setAddress(nicProfile.getIPv4Address());
|
||||
|
||||
try {
|
||||
vmModel.update(_manager.getModelController());
|
||||
|
||||
@ -24,15 +24,11 @@ import java.util.List;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import net.juniper.contrail.api.types.MacAddressesType;
|
||||
import net.juniper.contrail.api.types.VirtualMachineInterface;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.network.contrail.model.InstanceIpModel;
|
||||
import org.apache.cloudstack.network.contrail.model.VMInterfaceModel;
|
||||
import org.apache.cloudstack.network.contrail.model.VirtualMachineModel;
|
||||
import org.apache.cloudstack.network.contrail.model.VirtualNetworkModel;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
@ -73,6 +69,9 @@ import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
|
||||
import net.juniper.contrail.api.types.MacAddressesType;
|
||||
import net.juniper.contrail.api.types.VirtualMachineInterface;
|
||||
|
||||
@Local(value = {NetworkGuru.class})
|
||||
public class ContrailGuru extends AdapterBase implements NetworkGuru {
|
||||
@Inject
|
||||
@ -193,14 +192,14 @@ public class ContrailGuru extends AdapterBase implements NetworkGuru {
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||
s_logger.debug("allocate NicProfile on " + network.getName());
|
||||
|
||||
if (profile != null && profile.getRequestedIpv4() != null) {
|
||||
if (profile != null && profile.getRequestedIPv4() != null) {
|
||||
throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + profile);
|
||||
}
|
||||
if (profile == null) {
|
||||
profile = new NicProfile(ReservationStrategy.Create, null, null, null, null);
|
||||
}
|
||||
|
||||
profile.setStrategy(ReservationStrategy.Start);
|
||||
profile.setReservationStrategy(ReservationStrategy.Start);
|
||||
URI broadcastUri = null;
|
||||
try {
|
||||
broadcastUri = new URI("vlan://untagged");
|
||||
@ -256,9 +255,9 @@ public class ContrailGuru extends AdapterBase implements NetworkGuru {
|
||||
} else {
|
||||
s_logger.debug("Reuse existing instance-ip object on " + ipModel.getName());
|
||||
}
|
||||
if (nic.getIp4Address() != null) {
|
||||
s_logger.debug("Nic using existing IP address " + nic.getIp4Address());
|
||||
ipModel.setAddress(nic.getIp4Address());
|
||||
if (nic.getIPv4Address() != null) {
|
||||
s_logger.debug("Nic using existing IP address " + nic.getIPv4Address());
|
||||
ipModel.setAddress(nic.getIPv4Address());
|
||||
}
|
||||
|
||||
try {
|
||||
@ -282,13 +281,13 @@ public class ContrailGuru extends AdapterBase implements NetworkGuru {
|
||||
}
|
||||
}
|
||||
|
||||
if (nic.getIp4Address() == null) {
|
||||
if (nic.getIPv4Address() == null) {
|
||||
s_logger.debug("Allocated IP address " + ipModel.getAddress());
|
||||
nic.setIp4Address(ipModel.getAddress());
|
||||
nic.setIPv4Address(ipModel.getAddress());
|
||||
if (network.getCidr() != null) {
|
||||
nic.setNetmask(NetUtils.cidr2Netmask(network.getCidr()));
|
||||
nic.setIPv4Netmask(NetUtils.cidr2Netmask(network.getCidr()));
|
||||
}
|
||||
nic.setGateway(network.getGateway());
|
||||
nic.setIPv4Gateway(network.getGateway());
|
||||
nic.setFormat(AddressFormat.Ip4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import javax.ws.rs.core.MultivaluedMap;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.midonet.client.MidonetApi;
|
||||
import org.midonet.client.dto.DtoRule;
|
||||
@ -49,10 +50,6 @@ import org.midonet.client.resource.Rule;
|
||||
import org.midonet.client.resource.RuleChain;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.sun.jersey.core.util.MultivaluedMapImpl;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.agent.api.to.FirewallRuleTO;
|
||||
import com.cloud.agent.api.to.PortForwardingRuleTO;
|
||||
import com.cloud.configuration.Config;
|
||||
@ -87,6 +84,7 @@ import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
import com.sun.jersey.core.util.MultivaluedMapImpl;
|
||||
|
||||
@Component
|
||||
@Local(value = {NetworkElement.class, ConnectivityProvider.class, FirewallServiceProvider.class, SourceNatServiceProvider.class, DhcpServiceProvider.class,
|
||||
@ -430,7 +428,7 @@ public class MidoNetElement extends AdapterBase implements ConnectivityProvider,
|
||||
boolean isNewDhcpHost = true;
|
||||
|
||||
for (DhcpHost dhcpHost : sub.getDhcpHosts()) {
|
||||
if (dhcpHost.getIpAddr().equals(nic.getIp4Address())) {
|
||||
if (dhcpHost.getIpAddr().equals(nic.getIPv4Address())) {
|
||||
isNewDhcpHost = false;
|
||||
break;
|
||||
}
|
||||
@ -438,7 +436,7 @@ public class MidoNetElement extends AdapterBase implements ConnectivityProvider,
|
||||
|
||||
if (isNewDhcpHost) {
|
||||
DhcpHost host = sub.addDhcpHost();
|
||||
host.ipAddr(nic.getIp4Address());
|
||||
host.ipAddr(nic.getIPv4Address());
|
||||
host.macAddr(nic.getMacAddress());
|
||||
// This only sets the cloudstack internal name
|
||||
host.name(vm.getHostName());
|
||||
@ -776,7 +774,7 @@ public class MidoNetElement extends AdapterBase implements ConnectivityProvider,
|
||||
boolean routeExists = false;
|
||||
for (Route route : providerRouter.getRoutes(new MultivaluedMapImpl())) {
|
||||
String ip4 = route.getDstNetworkAddr();
|
||||
if (ip4 != null && ip4.equals(nic.getIp4Address())) {
|
||||
if (ip4 != null && ip4.equals(nic.getIPv4Address())) {
|
||||
routeExists = true;
|
||||
break;
|
||||
}
|
||||
@ -788,7 +786,7 @@ public class MidoNetElement extends AdapterBase implements ConnectivityProvider,
|
||||
.weight(100)
|
||||
.srcNetworkAddr("0.0.0.0")
|
||||
.srcNetworkLength(0)
|
||||
.dstNetworkAddr(nic.getIp4Address())
|
||||
.dstNetworkAddr(nic.getIPv4Address())
|
||||
.dstNetworkLength(32)
|
||||
.nextHopPort(providerDownlink.getId())
|
||||
.nextHopGateway(null)
|
||||
@ -826,7 +824,7 @@ public class MidoNetElement extends AdapterBase implements ConnectivityProvider,
|
||||
//remove the routes associated with this IP address
|
||||
for (Route route : providerRouter.getRoutes(new MultivaluedMapImpl())) {
|
||||
String routeDstAddr = route.getDstNetworkAddr();
|
||||
if (routeDstAddr != null && routeDstAddr.equals(nic.getIp4Address())) {
|
||||
if (routeDstAddr != null && routeDstAddr.equals(nic.getIPv4Address())) {
|
||||
route.delete();
|
||||
}
|
||||
}
|
||||
@ -1211,7 +1209,7 @@ public class MidoNetElement extends AdapterBase implements ConnectivityProvider,
|
||||
if (peerPort != null && peerPort instanceof RouterPort) {
|
||||
RouterPort checkPort = (RouterPort)peerPort;
|
||||
// Check it's a port on the providerRouter with the right gateway address
|
||||
if (checkPort.getDeviceId().compareTo(providerRouter.getId()) == 0 && checkPort.getPortAddress().equals(nic.getGateway())) {
|
||||
if (checkPort.getDeviceId().compareTo(providerRouter.getId()) == 0 && checkPort.getPortAddress().equals(nic.getIPv4Gateway())) {
|
||||
providerDownlink = checkPort;
|
||||
bridgeUplink = (BridgePort)api.getPort(checkPort.getPeerId());
|
||||
break;
|
||||
@ -1221,10 +1219,10 @@ public class MidoNetElement extends AdapterBase implements ConnectivityProvider,
|
||||
|
||||
// Create the ports and connection if they don't exist
|
||||
if (providerDownlink == null) {
|
||||
String cidr = NetUtils.ipAndNetMaskToCidr(nic.getGateway(), nic.getNetmask());
|
||||
String cidr = NetUtils.ipAndNetMaskToCidr(nic.getIPv4Gateway(), nic.getIPv4Netmask());
|
||||
String cidrSubnet = NetUtils.getCidrSubNet(cidr);
|
||||
int cidrSize = (int)NetUtils.getCidrSize(NetUtils.cidr2Netmask(cidr));
|
||||
String gateway = nic.getGateway();
|
||||
String gateway = nic.getIPv4Gateway();
|
||||
|
||||
// Add interior port on router side, with network details
|
||||
providerDownlink = providerRouter.addInteriorRouterPort().networkAddress(cidrSubnet).networkLength(cidrSize).portAddress(gateway).create();
|
||||
|
||||
@ -94,15 +94,15 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
@Override
|
||||
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(), Vlan.VlanType.VirtualNetwork, null, null, false);
|
||||
nic.setIp4Address(ip.getAddress().addr());
|
||||
nic.setIPv4Address(ip.getAddress().addr());
|
||||
|
||||
nic.setGateway(ip.getGateway());
|
||||
nic.setIPv4Gateway(ip.getGateway());
|
||||
|
||||
// Set netmask to /24 for now
|
||||
// TDO make it /32 and go via router for anything else on the subnet
|
||||
nic.setNetmask("255.255.255.0");
|
||||
nic.setIPv4Netmask("255.255.255.0");
|
||||
|
||||
// Make it the default nic so that a default route is set up.
|
||||
nic.setDefaultNic(true);
|
||||
@ -115,8 +115,8 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
nic.setMacAddress(ip.getMacAddress());
|
||||
}
|
||||
|
||||
nic.setDns1(dc.getDns1());
|
||||
nic.setDns2(dc.getDns2());
|
||||
nic.setIPv4Dns1(dc.getDns1());
|
||||
nic.setIPv4Dns2(dc.getDns2());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -125,8 +125,8 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,18 +140,18 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
s_logger.debug("allocate called with network: " + network + " nic: " + nic + " vm: " + vm);
|
||||
DataCenter dc = _dcDao.findById(network.getDataCenterId());
|
||||
|
||||
if (nic.getRequestedIpv4() != null) {
|
||||
if (nic.getRequestedIPv4() != null) {
|
||||
throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic);
|
||||
}
|
||||
|
||||
getIp(nic, dc, vm, network);
|
||||
|
||||
if (nic.getIp4Address() == null) {
|
||||
nic.setStrategy(Nic.ReservationStrategy.Start);
|
||||
if (nic.getIPv4Address() == null) {
|
||||
nic.setReservationStrategy(Nic.ReservationStrategy.Start);
|
||||
} else if (vm.getVirtualMachine().getType() == VirtualMachine.Type.DomainRouter) {
|
||||
nic.setStrategy(Nic.ReservationStrategy.Managed);
|
||||
nic.setReservationStrategy(Nic.ReservationStrategy.Managed);
|
||||
} else {
|
||||
nic.setStrategy(Nic.ReservationStrategy.Create);
|
||||
nic.setReservationStrategy(Nic.ReservationStrategy.Create);
|
||||
}
|
||||
|
||||
nic.setBroadcastUri(generateBroadcastUri(network));
|
||||
@ -163,7 +163,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
|
||||
throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||
s_logger.debug("reserve called with network: " + network + " nic: " + nic + " vm: " + vm);
|
||||
if (nic.getIp4Address() == null) {
|
||||
if (nic.getIPv4Address() == null) {
|
||||
getIp(nic, dest.getDataCenter(), vm, network);
|
||||
}
|
||||
}
|
||||
@ -206,10 +206,10 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
|
||||
s_logger.debug("deallocate called with network: " + network + " nic: " + nic + " vm: " + 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() != Nic.ReservationStrategy.Managed) {
|
||||
Transaction.execute(new TransactionCallbackNoReturn() {
|
||||
@Override
|
||||
|
||||
@ -30,8 +30,6 @@ import static org.mockito.Mockito.when;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.midonet.client.MidonetApi;
|
||||
import org.midonet.client.resource.Bridge;
|
||||
import org.midonet.client.resource.BridgePort;
|
||||
@ -53,6 +51,8 @@ import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class MidoNetElementTest extends TestCase {
|
||||
|
||||
/*
|
||||
@ -104,7 +104,7 @@ public class MidoNetElementTest extends TestCase {
|
||||
|
||||
//mockNic
|
||||
NicProfile mockNic = mock(NicProfile.class);
|
||||
when(mockNic.getIp4Address()).thenReturn("10.10.10.170");
|
||||
when(mockNic.getIPv4Address()).thenReturn("10.10.10.170");
|
||||
when(mockNic.getMacAddress()).thenReturn("02:00:73:3e:00:01");
|
||||
when(mockNic.getName()).thenReturn("Fake Name");
|
||||
|
||||
|
||||
@ -30,8 +30,6 @@ import java.util.TimeZone;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
@ -158,6 +156,7 @@ import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.cloudstack.usage.Usage;
|
||||
import org.apache.cloudstack.usage.UsageService;
|
||||
import org.apache.cloudstack.usage.UsageTypes;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.VgpuTypesInfo;
|
||||
import com.cloud.api.query.ViewResponseHelper;
|
||||
@ -1257,18 +1256,18 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
Network network = ApiDBUtils.findNetworkById(singleNicProfile.getNetworkId());
|
||||
if (network != null) {
|
||||
if (network.getTrafficType() == TrafficType.Management) {
|
||||
vmResponse.setPrivateIp(singleNicProfile.getIp4Address());
|
||||
vmResponse.setPrivateIp(singleNicProfile.getIPv4Address());
|
||||
vmResponse.setPrivateMacAddress(singleNicProfile.getMacAddress());
|
||||
vmResponse.setPrivateNetmask(singleNicProfile.getNetmask());
|
||||
vmResponse.setPrivateNetmask(singleNicProfile.getIPv4Netmask());
|
||||
} else if (network.getTrafficType() == TrafficType.Control) {
|
||||
vmResponse.setLinkLocalIp(singleNicProfile.getIp4Address());
|
||||
vmResponse.setLinkLocalIp(singleNicProfile.getIPv4Address());
|
||||
vmResponse.setLinkLocalMacAddress(singleNicProfile.getMacAddress());
|
||||
vmResponse.setLinkLocalNetmask(singleNicProfile.getNetmask());
|
||||
vmResponse.setLinkLocalNetmask(singleNicProfile.getIPv4Netmask());
|
||||
} else if (network.getTrafficType() == TrafficType.Public) {
|
||||
vmResponse.setPublicIp(singleNicProfile.getIp4Address());
|
||||
vmResponse.setPublicIp(singleNicProfile.getIPv4Address());
|
||||
vmResponse.setPublicMacAddress(singleNicProfile.getMacAddress());
|
||||
vmResponse.setPublicNetmask(singleNicProfile.getNetmask());
|
||||
vmResponse.setGateway(singleNicProfile.getGateway());
|
||||
vmResponse.setPublicNetmask(singleNicProfile.getIPv4Netmask());
|
||||
vmResponse.setGateway(singleNicProfile.getIPv4Gateway());
|
||||
} else if (network.getTrafficType() == TrafficType.Guest) {
|
||||
/*
|
||||
* In basic zone, public ip has TrafficType.Guest in case EIP service is not enabled.
|
||||
@ -1285,10 +1284,10 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
vmResponse.setGateway(vlan.getVlanGateway());
|
||||
}
|
||||
} else {
|
||||
vmResponse.setPublicIp(singleNicProfile.getIp4Address());
|
||||
vmResponse.setPublicIp(singleNicProfile.getIPv4Address());
|
||||
vmResponse.setPublicMacAddress(singleNicProfile.getMacAddress());
|
||||
vmResponse.setPublicNetmask(singleNicProfile.getNetmask());
|
||||
vmResponse.setGateway(singleNicProfile.getGateway());
|
||||
vmResponse.setPublicNetmask(singleNicProfile.getIPv4Netmask());
|
||||
vmResponse.setGateway(singleNicProfile.getIPv4Gateway());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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()));
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -101,6 +101,7 @@ import com.cloud.resource.ServerResource;
|
||||
import com.cloud.resource.UnableDeleteHostException;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.UploadVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.dao.SnapshotDao;
|
||||
@ -111,7 +112,6 @@ import com.cloud.storage.secondary.SecStorageVmAlertEventArgs;
|
||||
import com.cloud.storage.secondary.SecondaryStorageListener;
|
||||
import com.cloud.storage.secondary.SecondaryStorageVmAllocator;
|
||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.template.TemplateConstants;
|
||||
import com.cloud.template.TemplateManager;
|
||||
import com.cloud.user.Account;
|
||||
@ -1086,16 +1086,16 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
|
||||
for (NicProfile nic : profile.getNics()) {
|
||||
int deviceId = nic.getDeviceId();
|
||||
if (nic.getIp4Address() == null) {
|
||||
if (nic.getIPv4Address() == null) {
|
||||
buf.append(" eth").append(deviceId).append("mask=").append("0.0.0.0");
|
||||
buf.append(" eth").append(deviceId).append("ip=").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) {
|
||||
String mgmt_cidr = _configDao.getValue(Config.ManagementNetwork.key());
|
||||
@ -1107,9 +1107,9 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
} else if (nic.getTrafficType() == TrafficType.Public) {
|
||||
buf.append(" public.network.device=").append("eth").append(deviceId);
|
||||
} else if (nic.getTrafficType() == TrafficType.Storage) {
|
||||
buf.append(" storageip=").append(nic.getIp4Address());
|
||||
buf.append(" storagenetmask=").append(nic.getNetmask());
|
||||
buf.append(" storagegateway=").append(nic.getGateway());
|
||||
buf.append(" storageip=").append(nic.getIPv4Address());
|
||||
buf.append(" storagenetmask=").append(nic.getIPv4Netmask());
|
||||
buf.append(" storagegateway=").append(nic.getIPv4Gateway());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1147,11 +1147,11 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
for (NicProfile nic : nics) {
|
||||
if ((nic.getTrafficType() == TrafficType.Public && dc.getNetworkType() == NetworkType.Advanced) ||
|
||||
(nic.getTrafficType() == TrafficType.Guest && (dc.getNetworkType() == NetworkType.Basic || dc.isSecurityGroupEnabled()))) {
|
||||
secVm.setPublicIpAddress(nic.getIp4Address());
|
||||
secVm.setPublicNetmask(nic.getNetmask());
|
||||
secVm.setPublicIpAddress(nic.getIPv4Address());
|
||||
secVm.setPublicNetmask(nic.getIPv4Netmask());
|
||||
secVm.setPublicMacAddress(nic.getMacAddress());
|
||||
} else if (nic.getTrafficType() == TrafficType.Management) {
|
||||
secVm.setPrivateIpAddress(nic.getIp4Address());
|
||||
secVm.setPrivateIpAddress(nic.getIPv4Address());
|
||||
secVm.setPrivateMacAddress(nic.getMacAddress());
|
||||
}
|
||||
}
|
||||
@ -1167,7 +1167,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1185,7 +1185,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user