mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Elimiate mystery guestIp in IpAddressTO
Nobody can explain why it's there... Also fix wrong return result of several empty network element callbacks
This commit is contained in:
parent
17b2af2a90
commit
fe8a2992a2
@ -30,13 +30,12 @@ public class IpAddressTO {
|
||||
private String vlanGateway;
|
||||
private String vlanNetmask;
|
||||
private String vifMacAddress;
|
||||
private String guestIp;
|
||||
private Integer networkRate;
|
||||
private TrafficType trafficType;
|
||||
private String networkName;
|
||||
|
||||
public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String vlanId,
|
||||
String vlanGateway, String vlanNetmask, String vifMacAddress, String guestIp, Integer networkRate, boolean isOneToOneNat) {
|
||||
String vlanGateway, String vlanNetmask, String vifMacAddress, Integer networkRate, boolean isOneToOneNat) {
|
||||
this.accountId = accountId;
|
||||
this.publicIp = ipAddress;
|
||||
this.add = add;
|
||||
@ -46,7 +45,6 @@ public class IpAddressTO {
|
||||
this.vlanGateway = vlanGateway;
|
||||
this.vlanNetmask = vlanNetmask;
|
||||
this.vifMacAddress = vifMacAddress;
|
||||
this.guestIp = guestIp;
|
||||
this.networkRate = networkRate;
|
||||
this.oneToOneNat = isOneToOneNat;
|
||||
}
|
||||
@ -58,10 +56,6 @@ public class IpAddressTO {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public String getGuestIp(){
|
||||
return guestIp;
|
||||
}
|
||||
|
||||
public String getPublicIp() {
|
||||
return publicIp;
|
||||
}
|
||||
|
||||
@ -404,7 +404,7 @@ public class VirtualRoutingResource implements Manager {
|
||||
for (IpAddressTO ip : ips) {
|
||||
result = assignPublicIpAddress(routerName, routerIp, ip.getPublicIp(), ip.isAdd(),
|
||||
ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(), ip.getVlanNetmask(),
|
||||
ip.getVifMacAddress(), ip.getGuestIp(), 2);
|
||||
ip.getVifMacAddress(), 2);
|
||||
if (result != null) {
|
||||
results[i++] = IpAssocAnswer.errorResult;
|
||||
} else {
|
||||
@ -812,7 +812,7 @@ public class VirtualRoutingResource implements Manager {
|
||||
final String privateIpAddress, final String publicIpAddress,
|
||||
final boolean add, final boolean firstIP, final boolean sourceNat,
|
||||
final String vlanId, final String vlanGateway,
|
||||
final String vlanNetmask, final String vifMacAddress, String guestIp, int nicNum){
|
||||
final String vlanNetmask, final String vifMacAddress, int nicNum){
|
||||
|
||||
String args = "";
|
||||
if (add) {
|
||||
|
||||
@ -1534,8 +1534,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|
||||
result = _virtRouterResource.assignPublicIpAddress(routerName,
|
||||
routerIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(),
|
||||
ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(),
|
||||
ip.getVlanNetmask(), ip.getVifMacAddress(),
|
||||
ip.getGuestIp(), nicNum);
|
||||
ip.getVlanNetmask(), ip.getVifMacAddress(), nicNum);
|
||||
|
||||
if (result != null) {
|
||||
results[i++] = IpAssocAnswer.errorResult;
|
||||
|
||||
@ -1365,7 +1365,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
}
|
||||
|
||||
protected void assignPublicIpAddress(VirtualMachineMO vmMo, final String vmName, final String privateIpAddress, final String publicIpAddress, final boolean add, final boolean firstIP,
|
||||
final boolean sourceNat, final String vlanId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress, String guestIp) throws Exception {
|
||||
final boolean sourceNat, final String vlanId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress) throws Exception {
|
||||
|
||||
String publicNeworkName = HypervisorHostHelper.getPublicNetworkNamePrefix(vlanId);
|
||||
Pair<Integer, VirtualDevice> publicNicInfo = vmMo.getNicDeviceIndex(publicNeworkName);
|
||||
@ -1570,7 +1570,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
|
||||
for (IpAddressTO ip : ips) {
|
||||
assignPublicIpAddress(vmMo, routerName, controlIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(), ip.getVlanNetmask(),
|
||||
ip.getVifMacAddress(), ip.getGuestIp());
|
||||
ip.getVifMacAddress());
|
||||
results[i++] = ip.getPublicIp() + " - success";
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
||||
@ -1849,7 +1849,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
|
||||
|
||||
protected void assignPublicIpAddress(Connection conn, String vmName, String privateIpAddress, String publicIpAddress, boolean add, boolean firstIP,
|
||||
boolean sourceNat, String vlanId, String vlanGateway, String vlanNetmask, String vifMacAddress, String guestIp, Integer networkRate, TrafficType trafficType, String name) throws InternalErrorException {
|
||||
boolean sourceNat, String vlanId, String vlanGateway, String vlanNetmask, String vifMacAddress, Integer networkRate, TrafficType trafficType, String name) throws InternalErrorException {
|
||||
|
||||
try {
|
||||
VM router = getVM(conn, vmName);
|
||||
@ -2028,7 +2028,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
for (IpAddressTO ip : ips) {
|
||||
|
||||
assignPublicIpAddress(conn, routerName, routerIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(),
|
||||
ip.getVlanGateway(), ip.getVlanNetmask(), ip.getVifMacAddress(), ip.getGuestIp(), ip.getNetworkRate(), ip.getTrafficType(), ip.getNetworkName());
|
||||
ip.getVlanGateway(), ip.getVlanNetmask(), ip.getVifMacAddress(), ip.getNetworkRate(), ip.getTrafficType(), ip.getNetworkName());
|
||||
results[i++] = ip.getPublicIp() + " - success";
|
||||
}
|
||||
} catch (InternalErrorException e) {
|
||||
|
||||
@ -464,7 +464,7 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
|
||||
@Override
|
||||
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException {
|
||||
// return true, as IP will be associated as part of LB rule configuration
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -543,7 +543,7 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan
|
||||
|
||||
@Override
|
||||
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
// return true, as IP will be associated as part of static NAT/port forwarding rule configuration
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,7 +617,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
|
||||
@Override
|
||||
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException {
|
||||
// return true, as IP will be associated as part of LB rule configuration
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -413,7 +413,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
|
||||
// Get network rate
|
||||
Integer networkRate = _networkMgr.getNetworkRate(network.getId(), null);
|
||||
|
||||
IpAddressTO ip = new IpAddressTO(account.getAccountId(), sourceNatIpAddress, add, false, !sharedSourceNat, publicVlanTag, null, null, null, null, networkRate, false);
|
||||
IpAddressTO ip = new IpAddressTO(account.getAccountId(), sourceNatIpAddress, add, false, !sharedSourceNat, publicVlanTag, null, null, null, networkRate, false);
|
||||
IpAddressTO[] ips = new IpAddressTO[1];
|
||||
ips[0] = ip;
|
||||
IpAssocCommand cmd = new IpAssocCommand(ips);
|
||||
|
||||
@ -946,7 +946,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
|
||||
selfIp = selfipNic.getIp4Address();
|
||||
}
|
||||
|
||||
IpAddressTO ip = new IpAddressTO(guestConfig.getAccountId(), null, add, false, true, String.valueOf(guestVlanTag), selfIp, guestVlanNetmask, null, null, networkRate, false);
|
||||
IpAddressTO ip = new IpAddressTO(guestConfig.getAccountId(), null, add, false, true, String.valueOf(guestVlanTag), selfIp, guestVlanNetmask, null, networkRate, false);
|
||||
IpAddressTO[] ips = new IpAddressTO[1];
|
||||
ips[0] = ip;
|
||||
IpAssocCommand cmd = new IpAssocCommand(ips);
|
||||
|
||||
@ -2654,10 +2654,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
String vlanNetmask = ipAddr.getNetmask();
|
||||
String vifMacAddress = ipAddr.getMacAddress();
|
||||
|
||||
String vmGuestAddress = null;
|
||||
|
||||
IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, firstIP,
|
||||
sourceNat, vlanId, vlanGateway, vlanNetmask, vifMacAddress, vmGuestAddress, networkRate, ipAddr.isOneToOneNat());
|
||||
sourceNat, vlanId, vlanGateway, vlanNetmask, vifMacAddress, networkRate, ipAddr.isOneToOneNat());
|
||||
|
||||
ip.setTrafficType(network.getTrafficType());
|
||||
ip.setNetworkName(_networkMgr.getNetworkTag(router.getHypervisorType(), network));
|
||||
|
||||
@ -497,7 +497,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
||||
|
||||
IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, false,
|
||||
ipAddr.isSourceNat(), ipAddr.getVlanTag(), ipAddr.getGateway(), ipAddr.getNetmask(), macAddress,
|
||||
null, networkRate, ipAddr.isOneToOneNat());
|
||||
networkRate, ipAddr.isOneToOneNat());
|
||||
|
||||
ip.setTrafficType(network.getTrafficType());
|
||||
ip.setNetworkName(_networkMgr.getNetworkTag(router.getHypervisorType(), network));
|
||||
@ -1172,7 +1172,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
||||
Network network = _networkMgr.getNetwork(ipAddr.getNetworkId());
|
||||
IpAddressTO ip = new IpAddressTO(Account.ACCOUNT_ID_SYSTEM, ipAddr.getIpAddress(), add, false,
|
||||
false, ipAddr.getVlanTag(), ipAddr.getGateway(), ipAddr.getNetmask(), ipAddr.getMacAddress(),
|
||||
null, null, false);
|
||||
null, false);
|
||||
|
||||
ip.setTrafficType(network.getTrafficType());
|
||||
ip.setNetworkName(_networkMgr.getNetworkTag(router.getHypervisorType(), network));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user