mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix for the NicVO.java regression.
Renamed set*() methods to correct naming.
This commit is contained in:
parent
9229f35942
commit
4b88eabef1
@ -838,7 +838,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
|
||||
vo.setDefaultNic(profile.isDefaultNic());
|
||||
|
||||
vo.setIp4Address(profile.getIPv4Address());
|
||||
vo.setIPv4Address(profile.getIPv4Address());
|
||||
vo.setAddressFormat(profile.getFormat());
|
||||
|
||||
if (profile.getMacAddress() != null) {
|
||||
@ -846,8 +846,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
}
|
||||
|
||||
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());
|
||||
@ -859,25 +859,25 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
|
||||
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) {
|
||||
@ -1332,16 +1332,16 @@ 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.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());
|
||||
@ -3315,8 +3315,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
||||
@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);
|
||||
|
||||
@ -136,7 +136,7 @@ public class NicVO implements Nic {
|
||||
return iPv4Address;
|
||||
}
|
||||
|
||||
public void setIp4Address(String address) {
|
||||
public void setIPv4Address(String address) {
|
||||
iPv4Address = address;
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ public class NicVO implements Nic {
|
||||
return iPv6Address;
|
||||
}
|
||||
|
||||
public void setIp6Address(String ip6Address) {
|
||||
public void setIPv6Address(String ip6Address) {
|
||||
this.iPv6Address = ip6Address;
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ public class NicVO implements Nic {
|
||||
return iPv4Gateway;
|
||||
}
|
||||
|
||||
public void setGateway(String gateway) {
|
||||
public void setIPv4Gateway(String gateway) {
|
||||
this.iPv4Gateway = gateway;
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ public class NicVO implements Nic {
|
||||
this.addressFormat = format;
|
||||
}
|
||||
|
||||
public void setNetmask(String netmask) {
|
||||
public void setIPv4Netmask(String netmask) {
|
||||
this.iPv4Netmask = netmask;
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ public class NicVO implements Nic {
|
||||
return iPv6Gateway;
|
||||
}
|
||||
|
||||
public void setIp6Gateway(String ip6Gateway) {
|
||||
public void setIPv6Gateway(String ip6Gateway) {
|
||||
this.iPv6Gateway = ip6Gateway;
|
||||
}
|
||||
|
||||
@ -355,7 +355,7 @@ public class NicVO implements Nic {
|
||||
return iPv6Cidr;
|
||||
}
|
||||
|
||||
public void setIp6Cidr(String ip6Cidr) {
|
||||
public void setIPv6Cidr(String ip6Cidr) {
|
||||
this.iPv6Cidr = ip6Cidr;
|
||||
}
|
||||
|
||||
|
||||
@ -24,8 +24,6 @@ import java.util.List;
|
||||
|
||||
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;
|
||||
@ -74,6 +72,8 @@ import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* Set of unittests for InternalLoadBalancerVMManager
|
||||
*
|
||||
@ -137,7 +137,7 @@ public class InternalLBVMManagerTest extends TestCase {
|
||||
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>();
|
||||
|
||||
@ -192,7 +192,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -657,7 +657,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
||||
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());
|
||||
|
||||
@ -201,7 +201,7 @@ public class NicPlugInOutRules extends RuleApplier {
|
||||
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());
|
||||
|
||||
@ -618,7 +618,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
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);
|
||||
@ -632,7 +632,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
//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) {
|
||||
@ -3646,13 +3646,13 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user