cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mlsoren...@apache.org
Subject git commit: updated refs/heads/master to 566ce3e
Date Tue, 30 Jul 2013 17:23:06 GMT
Updated Branches:
  refs/heads/master 2b0946c6d -> 566ce3e62


Summary: Fix null pointer and op_networks blocker to account cleanup

Detail: Accounts can fail in cleanup/gc process due to inconsistent op_networks
table and null pointer in looking up account for event publishing.

BUG-ID: CLOUDSTACK-3957
Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1375204815 -0600


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/566ce3e6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/566ce3e6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/566ce3e6

Branch: refs/heads/master
Commit: 566ce3e625933033c6cdabe078ed788f5e88c6c9
Parents: 2b0946c
Author: Marcus Sorensen <marcus@betterservers.com>
Authored: Tue Jul 30 11:20:15 2013 -0600
Committer: Marcus Sorensen <marcus@betterservers.com>
Committed: Tue Jul 30 11:22:11 2013 -0600

----------------------------------------------------------------------
 server/src/com/cloud/event/ActionEventUtils.java    |  4 ++++
 .../src/com/cloud/network/NetworkManagerImpl.java   | 16 +++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/566ce3e6/server/src/com/cloud/event/ActionEventUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/event/ActionEventUtils.java b/server/src/com/cloud/event/ActionEventUtils.java
index 7b727cd..4ee6e9e 100755
--- a/server/src/com/cloud/event/ActionEventUtils.java
+++ b/server/src/com/cloud/event/ActionEventUtils.java
@@ -200,6 +200,10 @@ public class ActionEventUtils {
 
     private static long getDomainId(long accountId){
         AccountVO account = _accountDao.findByIdIncludingRemoved(accountId);
+        if (account == null) {
+            s_logger.error("Failed to find account(including removed ones) by id '" + accountId
+ "'");
+            return 0;
+        }
         return account.getDomainId();
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/566ce3e6/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 5fc4f41..b489097 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -2805,13 +2805,6 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
             return false;
         }
 
-        // Don't allow to delete network via api call when it has vms assigned to it
-        int nicCount = getActiveNicsInNetwork(networkId);
-        if (nicCount > 0) {
-            s_logger.debug("Unable to remove the network id=" + networkId + " as it has active
Nics.");
-            return false;
-        }
-
         // Make sure that there are no user vms in the network that are not Expunged/Error
         List<UserVmVO> userVms = _userVmDao.listByNetworkIdAndStates(networkId);
 
@@ -2822,6 +2815,15 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
             }
         }
 
+        // Don't allow to delete network via api call when it has vms assigned to it
+        int nicCount = getActiveNicsInNetwork(networkId);
+        if (nicCount > 0) {
+            s_logger.debug("The network id=" + networkId + " has active Nics, but shouldn't.");
+            // at this point we have already determined that there are no active user vms
in network
+            // if the op_networks table shows active nics, it's a bug in releasing nics updating
op_networks
+            _networksDao.changeActiveNicsBy(networkId, (-1 * nicCount)); 
+        }
+
         //In Basic zone, make sure that there are no non-removed console proxies and SSVMs
using the network
         DataCenter zone = _configMgr.getZone(network.getDataCenterId());
         if (zone.getNetworkType() == NetworkType.Basic) {


Mime
View raw message