mirror of https://github.com/apache/cloudstack.git
VPC: update ip address object after the ip is associated with the network
This commit is contained in:
parent
32c858ecd2
commit
84a4a7c1c8
|
|
@ -406,7 +406,7 @@ public interface NetworkManager extends NetworkService {
|
|||
* @param ipAddrId
|
||||
* @param networkId
|
||||
*/
|
||||
IpAddress associateIPToGuestNetwork(long ipAddrId, long networkId) throws ResourceAllocationException, ResourceUnavailableException,
|
||||
IPAddressVO associateIPToGuestNetwork(long ipAddrId, long networkId) throws ResourceAllocationException, ResourceUnavailableException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1125,12 +1125,12 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
|
||||
@DB
|
||||
@Override
|
||||
public IpAddress associateIPToGuestNetwork(long ipId, long networkId) throws ResourceAllocationException, ResourceUnavailableException,
|
||||
public IPAddressVO associateIPToGuestNetwork(long ipId, long networkId) throws ResourceAllocationException, ResourceUnavailableException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
Account owner = null;
|
||||
|
||||
IpAddress ipToAssoc = getIp(ipId);
|
||||
IPAddressVO ipToAssoc = _ipAddressDao.findById(ipId);
|
||||
if (ipToAssoc != null) {
|
||||
_accountMgr.checkAccess(caller, null, true, ipToAssoc);
|
||||
owner = _accountMgr.getAccount(ipToAssoc.getAllocatedToAccountId());
|
||||
|
|
|
|||
|
|
@ -732,13 +732,11 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
|
|||
ip = _networkMgr.assignSystemIp(lb.getNetworkId(), lbOwner, true, false);
|
||||
lb.setSourceIpAddressId(ip.getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
if (ip.getAssociatedWithNetworkId() == null) {
|
||||
s_logger.debug("The ip is not associated with the network id="+ lb.getNetworkId() + " so assigning");
|
||||
_networkMgr.associateIPToGuestNetwork(ipAddrId, lb.getNetworkId());
|
||||
ip = _networkMgr.associateIPToGuestNetwork(ipAddrId, lb.getNetworkId());
|
||||
}
|
||||
result = createLoadBalancer(lb, openFirewall);
|
||||
} catch (Exception ex) {
|
||||
|
|
|
|||
|
|
@ -176,8 +176,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
|
|||
if (ipAddress.getAssociatedWithNetworkId() == null) {
|
||||
s_logger.debug("The ip is not associated with the network id="+ networkId + " so assigning");
|
||||
try {
|
||||
_networkMgr.associateIPToGuestNetwork(ipAddrId, networkId);
|
||||
ipAddress = _ipAddressDao.findById(ipAddrId);
|
||||
ipAddress = _networkMgr.associateIPToGuestNetwork(ipAddrId, networkId);
|
||||
} catch (Exception ex) {
|
||||
s_logger.warn("Failed to associate ip id=" + ipAddrId + " to network id=" + networkId + " as " +
|
||||
"a part of port forwarding rule creation");
|
||||
|
|
@ -364,7 +363,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
|
|||
if (ipAddress.getAssociatedWithNetworkId() == null) {
|
||||
s_logger.debug("The ip is not associated with the network id="+ networkId + " so assigning");
|
||||
try {
|
||||
_networkMgr.associateIPToGuestNetwork(ipId, networkId);
|
||||
ipAddress = _networkMgr.associateIPToGuestNetwork(ipId, networkId);
|
||||
} catch (Exception ex) {
|
||||
s_logger.warn("Failed to associate ip id=" + ipId + " to network id=" + networkId + " as " +
|
||||
"a part of enable static nat");
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public class RemoteAccessVpnManagerImpl implements RemoteAccessVpnService, Manag
|
|||
if (ipAddress.getAssociatedWithNetworkId() == null) {
|
||||
s_logger.debug("The ip is not associated with the network id="+ networkId + " so assigning");
|
||||
try {
|
||||
_networkMgr.associateIPToGuestNetwork(publicIpId, networkId);
|
||||
ipAddress = _networkMgr.associateIPToGuestNetwork(publicIpId, networkId);
|
||||
} catch (Exception ex) {
|
||||
s_logger.warn("Failed to associate ip id=" + publicIpId + " to network id=" + networkId + " as " +
|
||||
"a part of remote access vpn creation");
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS
|
|||
}
|
||||
|
||||
@Override
|
||||
public IpAddress associateIPToGuestNetwork(long ipId, long networkId) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException, ResourceUnavailableException {
|
||||
public IPAddressVO associateIPToGuestNetwork(long ipId, long networkId) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException, ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue