@@ -3184,39 +3184,33 @@ public void processConnect(Host agent, StartupCommand cmd, boolean forRebalance)
31843184 if (s_logger .isDebugEnabled ())
31853185 s_logger .debug ("Received startup command from hypervisor host. host id: " + agent .getId ());
31863186
3187+ Long clusterId = agent .getClusterId ();
3188+ long agentId = agent .getId ();
3189+
31873190 if (VmJobEnabled .value ()) {
31883191 _syncMgr .resetHostSyncState (agent .getId ());
3192+ }else if (!VmJobEnabled .value () && agent .getHypervisorType () == HypervisorType .XenServer ){
3193+ StartupRoutingCommand startup = (StartupRoutingCommand )cmd ;
3194+ HashMap <String , Pair <String , State >> allStates = startup .getClusterVMStateChanges ();
3195+ if (allStates != null ) {
3196+ fullSync (clusterId , allStates );
3197+ }
3198+ // initiate the cron job
3199+ ClusterSyncCommand syncCmd = new ClusterSyncCommand (ClusterDeltaSyncInterval .value (), clusterId );
3200+ try {
3201+ long seq_no = _agentMgr .send (agentId , new Commands (syncCmd ), this );
3202+ s_logger .debug ("Cluster VM sync started with jobid " + seq_no );
3203+ } catch (AgentUnavailableException e ) {
3204+ s_logger .fatal ("The Cluster VM sync process failed for cluster id " + clusterId + " with " , e );
3205+ }
31893206 }
31903207
31913208 if (forRebalance ) {
31923209 s_logger .debug ("Not processing listener " + this + " as connect happens on rebalance process" );
31933210 return ;
31943211 }
31953212
3196- if (forRebalance ) {
3197- s_logger .debug ("Not processing listener " + this + " as connect happens on rebalance process" );
3198- return ;
3199- }
3200-
3201- Long clusterId = agent .getClusterId ();
3202- long agentId = agent .getId ();
3203-
32043213 if (agent .getHypervisorType () == HypervisorType .XenServer ) { // only for Xen
3205- if (!VmJobEnabled .value ()) {
3206- StartupRoutingCommand startup = (StartupRoutingCommand )cmd ;
3207- HashMap <String , Pair <String , State >> allStates = startup .getClusterVMStateChanges ();
3208- if (allStates != null ) {
3209- fullSync (clusterId , allStates );
3210- }
3211- // initiate the cron job
3212- ClusterSyncCommand syncCmd = new ClusterSyncCommand (ClusterDeltaSyncInterval .value (), clusterId );
3213- try {
3214- long seq_no = _agentMgr .send (agentId , new Commands (syncCmd ), this );
3215- s_logger .debug ("Cluster VM sync started with jobid " + seq_no );
3216- } catch (AgentUnavailableException e ) {
3217- s_logger .fatal ("The Cluster VM sync process failed for cluster id " + clusterId + " with " , e );
3218- }
3219- }
32203214 // initiate the cron job
32213215 ClusterVMMetaDataSyncCommand syncVMMetaDataCmd = new ClusterVMMetaDataSyncCommand (ClusterVMMetaDataSyncInterval .value (), clusterId );
32223216 try {
0 commit comments