mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
bug 13282: release elastic IP of the vm on vmStop
status 13282: resolved fixed
This commit is contained in:
parent
184ac11d96
commit
4dec3c890a
@ -2780,6 +2780,16 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
||||
|
||||
@Override
|
||||
public void finalizeStop(VirtualMachineProfile<UserVmVO> profile, StopAnswer answer) {
|
||||
//release elastic IP here
|
||||
IPAddressVO ip = _ipAddressDao.findByAssociatedVmId(profile.getId());
|
||||
if (ip != null && ip.getElastic()) {
|
||||
UserContext ctx = UserContext.current();
|
||||
try {
|
||||
_rulesMgr.disableStaticNat(ip.getId(), ctx.getCaller(), ctx.getCallerUserId(), true);
|
||||
} catch (Exception ex) {
|
||||
s_logger.warn("Failed to disable static nat and release elastic ip " + ip + " as a part of vm " + profile.getVirtualMachine() + " stop due to exception ", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String generateRandomPassword() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user