Skip to content

Commit 4b88eab

Browse files
author
Boris Schrijver
committed
Fix for the NicVO.java regression.
Renamed set*() methods to correct naming.
1 parent 9229f35 commit 4b88eab

File tree

7 files changed

+32
-32
lines changed

7 files changed

+32
-32
lines changed

engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -838,16 +838,16 @@ protected Integer applyProfileToNic(NicVO vo, NicProfile profile, Integer device
838838

839839
vo.setDefaultNic(profile.isDefaultNic());
840840

841-
vo.setIp4Address(profile.getIPv4Address());
841+
vo.setIPv4Address(profile.getIPv4Address());
842842
vo.setAddressFormat(profile.getFormat());
843843

844844
if (profile.getMacAddress() != null) {
845845
vo.setMacAddress(profile.getMacAddress());
846846
}
847847

848848
vo.setMode(profile.getMode());
849-
vo.setNetmask(profile.getIPv4Netmask());
850-
vo.setGateway(profile.getIPv4Gateway());
849+
vo.setIPv4Netmask(profile.getIPv4Netmask());
850+
vo.setIPv4Gateway(profile.getIPv4Gateway());
851851

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

860860
vo.setState(Nic.State.Allocated);
861861

862-
vo.setIp6Address(profile.getIPv6Address());
863-
vo.setIp6Gateway(profile.getIPv6Gateway());
864-
vo.setIp6Cidr(profile.getIPv6Cidr());
862+
vo.setIPv6Address(profile.getIPv6Address());
863+
vo.setIPv6Gateway(profile.getIPv6Gateway());
864+
vo.setIPv6Cidr(profile.getIPv6Cidr());
865865

866866
return deviceId;
867867
}
868868

869869
protected void applyProfileToNicForRelease(NicVO vo, NicProfile profile) {
870-
vo.setGateway(profile.getIPv4Gateway());
870+
vo.setIPv4Gateway(profile.getIPv4Gateway());
871871
vo.setAddressFormat(profile.getFormat());
872-
vo.setIp4Address(profile.getIPv4Address());
873-
vo.setIp6Address(profile.getIPv6Address());
872+
vo.setIPv4Address(profile.getIPv4Address());
873+
vo.setIPv6Address(profile.getIPv6Address());
874874
vo.setMacAddress(profile.getMacAddress());
875875
if (profile.getReservationStrategy() != null) {
876876
vo.setReservationStrategy(profile.getReservationStrategy());
877877
}
878878
vo.setBroadcastUri(profile.getBroadCastUri());
879879
vo.setIsolationUri(profile.getIsolationUri());
880-
vo.setNetmask(profile.getIPv4Netmask());
880+
vo.setIPv4Netmask(profile.getIPv4Netmask());
881881
}
882882

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

13331333
networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
13341334
guru.reserve(profile, network, vmProfile, dest, context);
1335-
nic.setIp4Address(profile.getIPv4Address());
1335+
nic.setIPv4Address(profile.getIPv4Address());
13361336
nic.setAddressFormat(profile.getFormat());
1337-
nic.setIp6Address(profile.getIPv6Address());
1337+
nic.setIPv6Address(profile.getIPv6Address());
13381338
nic.setMacAddress(profile.getMacAddress());
13391339
nic.setIsolationUri(profile.getIsolationUri());
13401340
nic.setBroadcastUri(profile.getBroadCastUri());
13411341
nic.setReserver(guru.getName());
13421342
nic.setState(Nic.State.Reserved);
1343-
nic.setNetmask(profile.getIPv4Netmask());
1344-
nic.setGateway(profile.getIPv4Gateway());
1343+
nic.setIPv4Netmask(profile.getIPv4Netmask());
1344+
nic.setIPv4Gateway(profile.getIPv4Gateway());
13451345

13461346
if (profile.getReservationStrategy() != null) {
13471347
nic.setReservationStrategy(profile.getReservationStrategy());
@@ -3315,8 +3315,8 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
33153315
@Override
33163316
public NicVO savePlaceholderNic(Network network, String ip4Address, String ip6Address, Type vmType) {
33173317
NicVO nic = new NicVO(null, null, network.getId(), null);
3318-
nic.setIp4Address(ip4Address);
3319-
nic.setIp6Address(ip6Address);
3318+
nic.setIPv4Address(ip4Address);
3319+
nic.setIPv6Address(ip6Address);
33203320
nic.setReservationStrategy(ReservationStrategy.PlaceHolder);
33213321
nic.setState(Nic.State.Reserved);
33223322
nic.setVmType(vmType);

engine/schema/src/com/cloud/vm/NicVO.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public String getIPv4Address() {
136136
return iPv4Address;
137137
}
138138

139-
public void setIp4Address(String address) {
139+
public void setIPv4Address(String address) {
140140
iPv4Address = address;
141141
}
142142

@@ -168,7 +168,7 @@ public String getIPv6Address() {
168168
return iPv6Address;
169169
}
170170

171-
public void setIp6Address(String ip6Address) {
171+
public void setIPv6Address(String ip6Address) {
172172
this.iPv6Address = ip6Address;
173173
}
174174

@@ -182,7 +182,7 @@ public String getIPv4Gateway() {
182182
return iPv4Gateway;
183183
}
184184

185-
public void setGateway(String gateway) {
185+
public void setIPv4Gateway(String gateway) {
186186
this.iPv4Gateway = gateway;
187187
}
188188

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

198-
public void setNetmask(String netmask) {
198+
public void setIPv4Netmask(String netmask) {
199199
this.iPv4Netmask = netmask;
200200
}
201201

@@ -346,7 +346,7 @@ public String getIPv6Gateway() {
346346
return iPv6Gateway;
347347
}
348348

349-
public void setIp6Gateway(String ip6Gateway) {
349+
public void setIPv6Gateway(String ip6Gateway) {
350350
this.iPv6Gateway = ip6Gateway;
351351
}
352352

@@ -355,7 +355,7 @@ public String getIPv6Cidr() {
355355
return iPv6Cidr;
356356
}
357357

358-
public void setIp6Cidr(String ip6Cidr) {
358+
public void setIPv6Cidr(String ip6Cidr) {
359359
this.iPv6Cidr = ip6Cidr;
360360
}
361361

plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
import javax.inject.Inject;
2626

27-
import junit.framework.TestCase;
28-
2927
import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
3028
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMManager;
3129
import org.junit.Before;
@@ -74,6 +72,8 @@
7472
import com.cloud.vm.dao.DomainRouterDao;
7573
import com.cloud.vm.dao.NicDao;
7674

75+
import junit.framework.TestCase;
76+
7777
/**
7878
* Set of unittests for InternalLoadBalancerVMManager
7979
*
@@ -137,7 +137,7 @@ public void setUp() {
137137
vm = setId(vm, 1);
138138
vm.setPrivateIpAddress("10.2.2.2");
139139
final NicVO nic = new NicVO("somereserver", 1L, 1L, VirtualMachine.Type.InternalLoadBalancerVm);
140-
nic.setIp4Address(requestedIp);
140+
nic.setIPv4Address(requestedIp);
141141

142142
final List<DomainRouterVO> emptyList = new ArrayList<DomainRouterVO>();
143143
final List<DomainRouterVO> nonEmptyList = new ArrayList<DomainRouterVO>();

server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public Network implement(Network config, NetworkOffering offering, DeployDestina
192192
for (NicVO nic : nicsInNetwork) {
193193
if (nic.getIPv4Address() != null) {
194194
long ipMask = getIpMask(nic.getIPv4Address(), cidrSize);
195-
nic.setIp4Address(NetUtils.long2Ip(newCidrAddress | ipMask));
195+
nic.setIPv4Address(NetUtils.long2Ip(newCidrAddress | ipMask));
196196
_nicDao.persist(nic);
197197
}
198198
}

server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ protected Pair<Map<String, PublicIpAddress>, Map<String, PublicIpAddress>> getNi
657657
final PublicIpAddress nicToUnplug = nicsToUnplug.get(ip.getVlanTag());
658658
if (nicToUnplug != null) {
659659
final NicVO nicVO = _nicDao.findByIp4AddressAndNetworkIdAndInstanceId(publicNtwkId, router.getId(), nicToUnplug.getAddress().addr());
660-
nicVO.setIp4Address(ip.getAddress().addr());
660+
nicVO.setIPv4Address(ip.getAddress().addr());
661661
_nicDao.update(nicVO.getId(), nicVO);
662662
s_logger.debug("Updated the nic " + nicVO + " with the new ip address " + ip.getAddress().addr());
663663
nicsToUnplug.remove(ip.getVlanTag());

server/src/com/cloud/network/rules/NicPlugInOutRules.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private Pair<Map<String, PublicIpAddress>, Map<String, PublicIpAddress>> getNics
201201
final PublicIpAddress nicToUnplug = nicsToUnplug.get(ip.getVlanTag());
202202
if (nicToUnplug != null) {
203203
NicVO nicVO = nicDao.findByIp4AddressAndNetworkIdAndInstanceId(publicNtwkId, _router.getId(), nicToUnplug.getAddress().addr());
204-
nicVO.setIp4Address(ip.getAddress().addr());
204+
nicVO.setIPv4Address(ip.getAddress().addr());
205205
nicDao.update(nicVO.getId(), nicVO);
206206
s_logger.debug("Updated the nic " + nicVO + " with the new ip address " + ip.getAddress().addr());
207207
nicsToUnplug.remove(ip.getVlanTag());

server/src/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ protected void runInContext() {
618618
if (NetUtils.isValidIp(vmIp)) {
619619
// set this vm ip addr in vm nic.
620620
if (nic != null) {
621-
nic.setIp4Address(vmIp);
621+
nic.setIPv4Address(vmIp);
622622
_nicDao.update(nicId, nic);
623623
s_logger.debug("Vm "+ vmId +" IP "+vmIp +" got retrieved successfully");
624624
vmIdCountMap.remove(nicId);
@@ -632,7 +632,7 @@ protected void runInContext() {
632632
//previously vm has ip and nic table has ip address. After vm restart or stop/start
633633
//if vm doesnot get the ip then set the ip in nic table to null
634634
if (nic.getIPv4Address() != null) {
635-
nic.setIp4Address(null);
635+
nic.setIPv4Address(null);
636636
_nicDao.update(nicId, nic);
637637
}
638638
if (answer.getDetails() != null) {
@@ -3646,13 +3646,13 @@ public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Command
36463646
boolean ipChanged = false;
36473647
if (originalIp != null && !originalIp.equalsIgnoreCase(returnedIp)) {
36483648
if (returnedIp != null && guestNic != null) {
3649-
guestNic.setIp4Address(returnedIp);
3649+
guestNic.setIPv4Address(returnedIp);
36503650
ipChanged = true;
36513651
}
36523652
}
36533653
if (returnedIp != null && !returnedIp.equalsIgnoreCase(originalIp)) {
36543654
if (guestNic != null) {
3655-
guestNic.setIp4Address(returnedIp);
3655+
guestNic.setIPv4Address(returnedIp);
36563656
ipChanged = true;
36573657
}
36583658
}

0 commit comments

Comments
 (0)