some more vm networking and expunging improvements

This commit is contained in:
abhishek 2010-10-04 16:51:02 -07:00
parent ccd7c4e617
commit 45271210d5
2 changed files with 19 additions and 15 deletions

View File

@ -2471,8 +2471,10 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
}
description = desc;
}
IPAddressVO ipAdd = _ipAddressDao.findById(rule.getPublicIpAddress());
saveEvent(userId, accountId, level, type, description);
saveEvent(userId, ipAdd.getAccountId(), level, type, description);
}
} finally {
if (e != null) {
@ -2500,6 +2502,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
// for existing user ids
throw new PermissionDeniedException("Account does not own supplied address");
}
// although we are not writing these values to the DB, we will check
// them out of an abundance
// of caution (may not be warranted)

View File

@ -1952,21 +1952,22 @@ public class UserVmManagerImpl implements UserVmManager {
}
List<FirewallRuleVO> forwardingRules = null;
try
{
forwardingRules = _rulesDao.listByPrivateIp(privateIpAddress);
for(FirewallRuleVO rule: forwardingRules)
{
_networkMgr.deleteRule(rule.getId(), Long.valueOf(User.UID_SYSTEM), vm.getAccountId());
if(s_logger.isDebugEnabled())
s_logger.debug("Rule "+rule.getId()+" for vm:"+vm.getId()+" is deleted successfully during expunge operation");
}
} catch (Exception e) {
s_logger.info("VM " + vmId +" expunge failed due to " + e.getMessage());
forwardingRules = _rulesDao.listByPrivateIp(privateIpAddress);
for(FirewallRuleVO rule: forwardingRules)
{
try
{
_networkMgr.deleteRule(rule.getId(), Long.valueOf(User.UID_SYSTEM), Long.valueOf(User.UID_SYSTEM));
if(s_logger.isDebugEnabled())
s_logger.debug("Rule "+rule.getId()+" for vm:"+vm.getName()+" is deleted successfully during expunge operation");
}
catch(Exception e)
{
s_logger.warn("Failed to delete rule:"+rule.getId()+" for vm:"+vm.getName());
}
}
List<VolumeVO> vols = null;
try {