mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-5812: pass podId information when request for secondary ip address in Basic zone guest network
This commit is contained in:
parent
b15431e574
commit
4dcc5671d1
|
|
@ -170,6 +170,6 @@ public interface IpAddressManager {
|
|||
|
||||
public String allocateGuestIP(Network network, String requestedIp) throws InsufficientAddressCapacityException;
|
||||
|
||||
String allocatePublicIpForGuestNic(Network network, Account ipOwner, String requestedIp) throws InsufficientAddressCapacityException;
|
||||
String allocatePublicIpForGuestNic(Network network, Long podId, Account ipOwner, String requestedIp) throws InsufficientAddressCapacityException;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1888,8 +1888,8 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
|||
}
|
||||
|
||||
@Override
|
||||
public String allocatePublicIpForGuestNic(Network network, Account owner, String requestedIp) throws InsufficientAddressCapacityException {
|
||||
PublicIp ip = assignPublicIpAddress(network.getDataCenterId(), null, owner, VlanType.DirectAttached, network.getId(), requestedIp, false);
|
||||
public String allocatePublicIpForGuestNic(Network network, Long podId, Account owner, String requestedIp) throws InsufficientAddressCapacityException {
|
||||
PublicIp ip = assignPublicIpAddress(network.getDataCenterId(), podId, owner, VlanType.DirectAttached, network.getId(), requestedIp, false);
|
||||
if (ip == null) {
|
||||
s_logger.debug("There is no free public ip address");
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -679,8 +679,20 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
throw new InvalidParameterValueException("Allocating guest ip for nic failed");
|
||||
}
|
||||
} else if (network.getGuestType() == Network.GuestType.Shared) {
|
||||
//for basic zone, need to provide the podId to ensure proper ip alloation
|
||||
Long podId = null;
|
||||
DataCenter dc = _dcDao.findById(network.getDataCenterId());
|
||||
|
||||
if (dc.getNetworkType() == NetworkType.Basic) {
|
||||
VMInstanceVO vmi = (VMInstanceVO)vm;
|
||||
podId = vmi.getPodIdToDeployIn();
|
||||
if (podId == null) {
|
||||
throw new InvalidParameterValueException("vm pod id is null in Basic zone; can't decide the range for ip allocation");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ipaddr = _ipAddrMgr.allocatePublicIpForGuestNic(network, ipOwner, requestedIp);
|
||||
ipaddr = _ipAddrMgr.allocatePublicIpForGuestNic(network, podId, ipOwner, requestedIp);
|
||||
if (ipaddr == null) {
|
||||
throw new InvalidParameterValueException("Allocating ip to guest nic " + nicId + " failed");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue