Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -838,16 +838,16 @@ protected Integer applyProfileToNic(NicVO vo, NicProfile profile, Integer device

vo.setDefaultNic(profile.isDefaultNic());

vo.setIp4Address(profile.getIPv4Address());
vo.setIPv4Address(profile.getIPv4Address());
vo.setAddressFormat(profile.getFormat());

if (profile.getMacAddress() != null) {
vo.setMacAddress(profile.getMacAddress());
}

vo.setMode(profile.getMode());
vo.setNetmask(profile.getIPv4Netmask());
vo.setGateway(profile.getIPv4Gateway());
vo.setIPv4Netmask(profile.getIPv4Netmask());
vo.setIPv4Gateway(profile.getIPv4Gateway());

if (profile.getBroadCastUri() != null) {
vo.setBroadcastUri(profile.getBroadCastUri());
Expand All @@ -859,25 +859,25 @@ protected Integer applyProfileToNic(NicVO vo, NicProfile profile, Integer device

vo.setState(Nic.State.Allocated);

vo.setIp6Address(profile.getIPv6Address());
vo.setIp6Gateway(profile.getIPv6Gateway());
vo.setIp6Cidr(profile.getIPv6Cidr());
vo.setIPv6Address(profile.getIPv6Address());
vo.setIPv6Gateway(profile.getIPv6Gateway());
vo.setIPv6Cidr(profile.getIPv6Cidr());

return deviceId;
}

protected void applyProfileToNicForRelease(NicVO vo, NicProfile profile) {
vo.setGateway(profile.getIPv4Gateway());
vo.setIPv4Gateway(profile.getIPv4Gateway());
vo.setAddressFormat(profile.getFormat());
vo.setIp4Address(profile.getIPv4Address());
vo.setIp6Address(profile.getIPv6Address());
vo.setIPv4Address(profile.getIPv4Address());
vo.setIPv6Address(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.getIPv4Netmask());
vo.setIPv4Netmask(profile.getIPv4Netmask());
}

protected void applyProfileToNetwork(NetworkVO network, NetworkProfile profile) {
Expand Down Expand Up @@ -1332,16 +1332,16 @@ public NicProfile prepareNic(VirtualMachineProfile vmProfile, DeployDestination

networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
guru.reserve(profile, network, vmProfile, dest, context);
nic.setIp4Address(profile.getIPv4Address());
nic.setIPv4Address(profile.getIPv4Address());
nic.setAddressFormat(profile.getFormat());
nic.setIp6Address(profile.getIPv6Address());
nic.setIPv6Address(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.getIPv4Netmask());
nic.setGateway(profile.getIPv4Gateway());
nic.setIPv4Netmask(profile.getIPv4Netmask());
nic.setIPv4Gateway(profile.getIPv4Gateway());

if (profile.getReservationStrategy() != null) {
nic.setReservationStrategy(profile.getReservationStrategy());
Expand Down Expand Up @@ -3315,8 +3315,8 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
@Override
public NicVO savePlaceholderNic(Network network, String ip4Address, String ip6Address, Type vmType) {
NicVO nic = new NicVO(null, null, network.getId(), null);
nic.setIp4Address(ip4Address);
nic.setIp6Address(ip6Address);
nic.setIPv4Address(ip4Address);
nic.setIPv6Address(ip6Address);
nic.setReservationStrategy(ReservationStrategy.PlaceHolder);
nic.setState(Nic.State.Reserved);
nic.setVmType(vmType);
Expand Down
12 changes: 6 additions & 6 deletions engine/schema/src/com/cloud/vm/NicVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public String getIPv4Address() {
return iPv4Address;
}

public void setIp4Address(String address) {
public void setIPv4Address(String address) {
iPv4Address = address;
}

Expand Down Expand Up @@ -168,7 +168,7 @@ public String getIPv6Address() {
return iPv6Address;
}

public void setIp6Address(String ip6Address) {
public void setIPv6Address(String ip6Address) {
this.iPv6Address = ip6Address;
}

Expand All @@ -182,7 +182,7 @@ public String getIPv4Gateway() {
return iPv4Gateway;
}

public void setGateway(String gateway) {
public void setIPv4Gateway(String gateway) {
this.iPv4Gateway = gateway;
}

Expand All @@ -195,7 +195,7 @@ public void setAddressFormat(AddressFormat format) {
this.addressFormat = format;
}

public void setNetmask(String netmask) {
public void setIPv4Netmask(String netmask) {
this.iPv4Netmask = netmask;
}

Expand Down Expand Up @@ -346,7 +346,7 @@ public String getIPv6Gateway() {
return iPv6Gateway;
}

public void setIp6Gateway(String ip6Gateway) {
public void setIPv6Gateway(String ip6Gateway) {
this.iPv6Gateway = ip6Gateway;
}

Expand All @@ -355,7 +355,7 @@ public String getIPv6Cidr() {
return iPv6Cidr;
}

public void setIp6Cidr(String ip6Cidr) {
public void setIPv6Cidr(String ip6Cidr) {
this.iPv6Cidr = ip6Cidr;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

import javax.inject.Inject;

import junit.framework.TestCase;

import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMManager;
import org.junit.Before;
Expand Down Expand Up @@ -74,6 +72,8 @@
import com.cloud.vm.dao.DomainRouterDao;
import com.cloud.vm.dao.NicDao;

import junit.framework.TestCase;

/**
* Set of unittests for InternalLoadBalancerVMManager
*
Expand Down Expand Up @@ -137,7 +137,7 @@ public void setUp() {
vm = setId(vm, 1);
vm.setPrivateIpAddress("10.2.2.2");
final NicVO nic = new NicVO("somereserver", 1L, 1L, VirtualMachine.Type.InternalLoadBalancerVm);
nic.setIp4Address(requestedIp);
nic.setIPv4Address(requestedIp);

final List<DomainRouterVO> emptyList = new ArrayList<DomainRouterVO>();
final List<DomainRouterVO> nonEmptyList = new ArrayList<DomainRouterVO>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public Network implement(Network config, NetworkOffering offering, DeployDestina
for (NicVO nic : nicsInNetwork) {
if (nic.getIPv4Address() != null) {
long ipMask = getIpMask(nic.getIPv4Address(), cidrSize);
nic.setIp4Address(NetUtils.long2Ip(newCidrAddress | ipMask));
nic.setIPv4Address(NetUtils.long2Ip(newCidrAddress | ipMask));
_nicDao.persist(nic);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ protected Pair<Map<String, PublicIpAddress>, Map<String, PublicIpAddress>> getNi
final PublicIpAddress nicToUnplug = nicsToUnplug.get(ip.getVlanTag());
if (nicToUnplug != null) {
final NicVO nicVO = _nicDao.findByIp4AddressAndNetworkIdAndInstanceId(publicNtwkId, router.getId(), nicToUnplug.getAddress().addr());
nicVO.setIp4Address(ip.getAddress().addr());
nicVO.setIPv4Address(ip.getAddress().addr());
_nicDao.update(nicVO.getId(), nicVO);
s_logger.debug("Updated the nic " + nicVO + " with the new ip address " + ip.getAddress().addr());
nicsToUnplug.remove(ip.getVlanTag());
Expand Down
2 changes: 1 addition & 1 deletion server/src/com/cloud/network/rules/NicPlugInOutRules.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private Pair<Map<String, PublicIpAddress>, Map<String, PublicIpAddress>> getNics
final PublicIpAddress nicToUnplug = nicsToUnplug.get(ip.getVlanTag());
if (nicToUnplug != null) {
NicVO nicVO = nicDao.findByIp4AddressAndNetworkIdAndInstanceId(publicNtwkId, _router.getId(), nicToUnplug.getAddress().addr());
nicVO.setIp4Address(ip.getAddress().addr());
nicVO.setIPv4Address(ip.getAddress().addr());
nicDao.update(nicVO.getId(), nicVO);
s_logger.debug("Updated the nic " + nicVO + " with the new ip address " + ip.getAddress().addr());
nicsToUnplug.remove(ip.getVlanTag());
Expand Down
8 changes: 4 additions & 4 deletions server/src/com/cloud/vm/UserVmManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ protected void runInContext() {
if (NetUtils.isValidIp(vmIp)) {
// set this vm ip addr in vm nic.
if (nic != null) {
nic.setIp4Address(vmIp);
nic.setIPv4Address(vmIp);
_nicDao.update(nicId, nic);
s_logger.debug("Vm "+ vmId +" IP "+vmIp +" got retrieved successfully");
vmIdCountMap.remove(nicId);
Expand All @@ -632,7 +632,7 @@ protected void runInContext() {
//previously vm has ip and nic table has ip address. After vm restart or stop/start
//if vm doesnot get the ip then set the ip in nic table to null
if (nic.getIPv4Address() != null) {
nic.setIp4Address(null);
nic.setIPv4Address(null);
_nicDao.update(nicId, nic);
}
if (answer.getDetails() != null) {
Expand Down Expand Up @@ -3646,13 +3646,13 @@ public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Command
boolean ipChanged = false;
if (originalIp != null && !originalIp.equalsIgnoreCase(returnedIp)) {
if (returnedIp != null && guestNic != null) {
guestNic.setIp4Address(returnedIp);
guestNic.setIPv4Address(returnedIp);
ipChanged = true;
}
}
if (returnedIp != null && !returnedIp.equalsIgnoreCase(originalIp)) {
if (guestNic != null) {
guestNic.setIp4Address(returnedIp);
guestNic.setIPv4Address(returnedIp);
ipChanged = true;
}
}
Expand Down