Skip to content

Commit fe8a299

Browse files
author
Sheng Yang
committed
Elimiate mystery guestIp in IpAddressTO
Nobody can explain why it's there... Also fix wrong return result of several empty network element callbacks
1 parent 17b2af2 commit fe8a299

12 files changed

Lines changed: 17 additions & 26 deletions

File tree

api/src/com/cloud/agent/api/to/IpAddressTO.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@ public class IpAddressTO {
3030
private String vlanGateway;
3131
private String vlanNetmask;
3232
private String vifMacAddress;
33-
private String guestIp;
3433
private Integer networkRate;
3534
private TrafficType trafficType;
3635
private String networkName;
3736

3837
public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String vlanId,
39-
String vlanGateway, String vlanNetmask, String vifMacAddress, String guestIp, Integer networkRate, boolean isOneToOneNat) {
38+
String vlanGateway, String vlanNetmask, String vifMacAddress, Integer networkRate, boolean isOneToOneNat) {
4039
this.accountId = accountId;
4140
this.publicIp = ipAddress;
4241
this.add = add;
@@ -46,7 +45,6 @@ public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstI
4645
this.vlanGateway = vlanGateway;
4746
this.vlanNetmask = vlanNetmask;
4847
this.vifMacAddress = vifMacAddress;
49-
this.guestIp = guestIp;
5048
this.networkRate = networkRate;
5149
this.oneToOneNat = isOneToOneNat;
5250
}
@@ -58,10 +56,6 @@ public long getAccountId() {
5856
return accountId;
5957
}
6058

61-
public String getGuestIp(){
62-
return guestIp;
63-
}
64-
6559
public String getPublicIp() {
6660
return publicIp;
6761
}

core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ protected Answer execute(final IpAssocCommand cmd) {
404404
for (IpAddressTO ip : ips) {
405405
result = assignPublicIpAddress(routerName, routerIp, ip.getPublicIp(), ip.isAdd(),
406406
ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(), ip.getVlanNetmask(),
407-
ip.getVifMacAddress(), ip.getGuestIp(), 2);
407+
ip.getVifMacAddress(), 2);
408408
if (result != null) {
409409
results[i++] = IpAssocAnswer.errorResult;
410410
} else {
@@ -812,7 +812,7 @@ public String assignPublicIpAddress(final String vmName,
812812
final String privateIpAddress, final String publicIpAddress,
813813
final boolean add, final boolean firstIP, final boolean sourceNat,
814814
final String vlanId, final String vlanGateway,
815-
final String vlanNetmask, final String vifMacAddress, String guestIp, int nicNum){
815+
final String vlanNetmask, final String vifMacAddress, int nicNum){
816816

817817
String args = "";
818818
if (add) {

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,8 +1534,7 @@ public Answer execute(IpAssocCommand cmd) {
15341534
result = _virtRouterResource.assignPublicIpAddress(routerName,
15351535
routerIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(),
15361536
ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(),
1537-
ip.getVlanNetmask(), ip.getVifMacAddress(),
1538-
ip.getGuestIp(), nicNum);
1537+
ip.getVlanNetmask(), ip.getVifMacAddress(), nicNum);
15391538

15401539
if (result != null) {
15411540
results[i++] = IpAssocAnswer.errorResult;

plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ protected void assignVPCPublicIpAddress(String domrName, String routerIp, IpAddr
13651365
}
13661366

13671367
protected void assignPublicIpAddress(VirtualMachineMO vmMo, final String vmName, final String privateIpAddress, final String publicIpAddress, final boolean add, final boolean firstIP,
1368-
final boolean sourceNat, final String vlanId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress, String guestIp) throws Exception {
1368+
final boolean sourceNat, final String vlanId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress) throws Exception {
13691369

13701370
String publicNeworkName = HypervisorHostHelper.getPublicNetworkNamePrefix(vlanId);
13711371
Pair<Integer, VirtualDevice> publicNicInfo = vmMo.getNicDeviceIndex(publicNeworkName);
@@ -1570,7 +1570,7 @@ protected Answer execute(IpAssocCommand cmd) {
15701570

15711571
for (IpAddressTO ip : ips) {
15721572
assignPublicIpAddress(vmMo, routerName, controlIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(), ip.getVlanNetmask(),
1573-
ip.getVifMacAddress(), ip.getGuestIp());
1573+
ip.getVifMacAddress());
15741574
results[i++] = ip.getPublicIp() + " - success";
15751575
}
15761576
} catch (Throwable e) {

plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ protected Answer execute(final SavePasswordCommand cmd) {
18491849

18501850

18511851
protected void assignPublicIpAddress(Connection conn, String vmName, String privateIpAddress, String publicIpAddress, boolean add, boolean firstIP,
1852-
boolean sourceNat, String vlanId, String vlanGateway, String vlanNetmask, String vifMacAddress, String guestIp, Integer networkRate, TrafficType trafficType, String name) throws InternalErrorException {
1852+
boolean sourceNat, String vlanId, String vlanGateway, String vlanNetmask, String vifMacAddress, Integer networkRate, TrafficType trafficType, String name) throws InternalErrorException {
18531853

18541854
try {
18551855
VM router = getVM(conn, vmName);
@@ -2028,7 +2028,7 @@ protected Answer execute(IpAssocCommand cmd) {
20282028
for (IpAddressTO ip : ips) {
20292029

20302030
assignPublicIpAddress(conn, routerName, routerIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(),
2031-
ip.getVlanGateway(), ip.getVlanNetmask(), ip.getVifMacAddress(), ip.getGuestIp(), ip.getNetworkRate(), ip.getTrafficType(), ip.getNetworkName());
2031+
ip.getVlanGateway(), ip.getVlanNetmask(), ip.getVifMacAddress(), ip.getNetworkRate(), ip.getTrafficType(), ip.getNetworkName());
20322032
results[i++] = ip.getPublicIp() + " - success";
20332033
}
20342034
} catch (InternalErrorException e) {

plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ public boolean verifyServicesCombination(Set<Service> services) {
464464
@Override
465465
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException {
466466
// return true, as IP will be associated as part of LB rule configuration
467-
return false;
467+
return true;
468468
}
469469

470470
@Override

plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ public IpDeployer getIpDeployer(Network network) {
543543

544544
@Override
545545
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException {
546-
// TODO Auto-generated method stub
547-
return false;
546+
// return true, as IP will be associated as part of static NAT/port forwarding rule configuration
547+
return true;
548548
}
549549
}

plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ public boolean verifyServicesCombination(Set<Service> services) {
617617
@Override
618618
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException {
619619
// return true, as IP will be associated as part of LB rule configuration
620-
return false;
620+
return true;
621621
}
622622

623623
@Override

server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ public boolean manageGuestNetworkWithExternalFirewall(boolean add, Network netwo
413413
// Get network rate
414414
Integer networkRate = _networkMgr.getNetworkRate(network.getId(), null);
415415

416-
IpAddressTO ip = new IpAddressTO(account.getAccountId(), sourceNatIpAddress, add, false, !sharedSourceNat, publicVlanTag, null, null, null, null, networkRate, false);
416+
IpAddressTO ip = new IpAddressTO(account.getAccountId(), sourceNatIpAddress, add, false, !sharedSourceNat, publicVlanTag, null, null, null, networkRate, false);
417417
IpAddressTO[] ips = new IpAddressTO[1];
418418
ips[0] = ip;
419419
IpAssocCommand cmd = new IpAssocCommand(ips);

server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ public boolean manageGuestNetworkWithExternalLoadBalancer(boolean add, Network g
946946
selfIp = selfipNic.getIp4Address();
947947
}
948948

949-
IpAddressTO ip = new IpAddressTO(guestConfig.getAccountId(), null, add, false, true, String.valueOf(guestVlanTag), selfIp, guestVlanNetmask, null, null, networkRate, false);
949+
IpAddressTO ip = new IpAddressTO(guestConfig.getAccountId(), null, add, false, true, String.valueOf(guestVlanTag), selfIp, guestVlanNetmask, null, networkRate, false);
950950
IpAddressTO[] ips = new IpAddressTO[1];
951951
ips[0] = ip;
952952
IpAssocCommand cmd = new IpAssocCommand(ips);

0 commit comments

Comments
 (0)