You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2014/07/12 02:40:26 UTC

git commit: updated refs/heads/master to 388210c

Repository: cloudstack
Updated Branches:
  refs/heads/master 63b81995f -> 388210c8f


Add more logs for MS cluster manager


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

Branch: refs/heads/master
Commit: 388210c8f91756c42c13ec670387266354cadb1d
Parents: 63b8199
Author: Anthony Xu <an...@citrix.com>
Authored: Fri Jul 11 17:39:40 2014 -0700
Committer: Anthony Xu <an...@citrix.com>
Committed: Fri Jul 11 17:39:40 2014 -0700

----------------------------------------------------------------------
 .../com/cloud/cluster/ClusterManagerImpl.java    | 19 +++++++++++--------
 .../cluster/dao/ManagementServerHostDaoImpl.java |  6 ++++--
 2 files changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/388210c8/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
index 4a0987f..5a70ca5 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
@@ -542,7 +542,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                             s_logger.trace("Cluster manager heartbeat update, id:" + _mshostId);
                         }
 
-                        _mshostDao.update(_mshostId, getCurrentRunId(), DateUtil.currentGMTTime());
+                        _mshostDao.update(_mshostId, _runId, DateUtil.currentGMTTime());
                         profilerHeartbeatUpdate.stop();
 
                         profilerPeerScan.start();
@@ -934,7 +934,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
     @DB
     public boolean start() {
         if (s_logger.isInfoEnabled()) {
-            s_logger.info("Starting cluster manager, msid : " + _msId);
+            s_logger.info("Starting Cluster manager, msid : " + _msId);
         }
 
         ManagementServerHostVO mshost = Transaction.execute(new TransactionCallback<ManagementServerHostVO>() {
@@ -948,7 +948,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                 if (mshost == null) {
                     mshost = new ManagementServerHostVO();
                     mshost.setMsid(_msId);
-                    mshost.setRunid(getCurrentRunId());
+                    mshost.setRunid(_runId);
                     mshost.setName(NetUtils.getHostName());
                     mshost.setVersion(version);
                     mshost.setServiceIP(_clusterNodeIP);
@@ -960,15 +960,14 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                     _mshostDao.persist(mshost);
 
                     if (s_logger.isInfoEnabled()) {
-                        s_logger.info("New instance of management server msid " + _msId + " is being started");
+                        s_logger.info("New instance of management server msid " + _msId + ", runId " + _runId + " is being started");
                     }
                 } else {
+                    _mshostDao.update(mshost.getId(), _runId, NetUtils.getHostName(), version, _clusterNodeIP, _currentServiceAdapter.getServicePort(),
+                        DateUtil.currentGMTTime());
                     if (s_logger.isInfoEnabled()) {
-                        s_logger.info("Management server " + _msId + " is being started");
+                        s_logger.info("Management server " + _msId + ", runId " + _runId + " is being started");
                     }
-
-                    _mshostDao.update(mshost.getId(), getCurrentRunId(), NetUtils.getHostName(), version, _clusterNodeIP, _currentServiceAdapter.getServicePort(),
-                        DateUtil.currentGMTTime());
                 }
 
                 return mshost;
@@ -996,6 +995,10 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
     @Override
     @DB
     public boolean stop() {
+        if (s_logger.isInfoEnabled()) {
+            s_logger.info("Stopping Cluster manager, msid : " + _msId);
+        }
+
         if (_mshostId != null) {
             ManagementServerHostVO mshost = _mshostDao.findByMsid(_msId);
             mshost.setState(ManagementServerHost.State.Down);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/388210c8/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java b/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
index 3d0c3f5..97b9a54 100644
--- a/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/dao/ManagementServerHostDaoImpl.java
@@ -142,7 +142,8 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
             txn.commit();
 
             if (count < 1) {
-                throw new CloudRuntimeException("Invalid cluster session detected", new ClusterInvalidSessionException("runid " + runid + " is no longer valid"));
+                s_logger.info("Invalid cluster session detected, runId " + runid + " is no longer valid");
+                throw new CloudRuntimeException("Invalid cluster session detected, runId " + runid + " is no longer valid", new ClusterInvalidSessionException("runId " + runid + " is no longer valid"));
             }
         } catch (Exception e) {
             s_logger.warn("Unexpected exception, ", e);
@@ -222,7 +223,8 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
             int count = pstmt.executeUpdate();
 
             if (count < 1) {
-                throw new CloudRuntimeException("Invalid cluster session detected", new ClusterInvalidSessionException("runid " + runId + " is no longer valid"));
+                s_logger.info("Invalid cluster session detected, runId " + runId + " is no longer valid");
+                throw new CloudRuntimeException("Invalid cluster session detected, runId " + runId + " is no longer valid", new ClusterInvalidSessionException("runId " + runId + " is no longer valid"));
             }
         } catch (SQLException e) {
             throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);