disable XS full host sync and delta sync when new sync model is enabled
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/206a9ed5 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/206a9ed5 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/206a9ed5 Branch: refs/heads/master Commit: 206a9ed53fbd228a9af675576f486d18887b4dc9 Parents: 90ea324 Author: Kelven Yang <[email protected]> Authored: Fri Jan 24 16:55:54 2014 -0800 Committer: Kelven Yang <[email protected]> Committed: Fri Feb 28 15:35:57 2014 -0800 ---------------------------------------------------------------------- .../com/cloud/vm/VirtualMachineManagerImpl.java | 83 +++++++++++--------- 1 file changed, 44 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/206a9ed5/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index f944d7e..1dae94d 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -2925,12 +2925,14 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Override public boolean processAnswers(long agentId, long seq, Answer[] answers) { - for (final Answer answer : answers) { - if (answer instanceof ClusterSyncAnswer) { - ClusterSyncAnswer hs = (ClusterSyncAnswer)answer; - if (!hs.isExceuted()) { - deltaSync(hs.getNewStates()); - hs.setExecuted(); + if (!VmJobEnabled.value()) { + for (final Answer answer : answers) { + if (answer instanceof ClusterSyncAnswer) { + ClusterSyncAnswer hs = (ClusterSyncAnswer)answer; + if (!hs.isExceuted()) { + deltaSync(hs.getNewStates()); + hs.setExecuted(); + } } } } @@ -3018,48 +3020,51 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac long agentId = agent.getId(); if (agent.getHypervisorType() == HypervisorType.XenServer) { // only for Xen - StartupRoutingCommand startup = (StartupRoutingCommand)cmd; - HashMap<String, Ternary<String, State, String>> allStates = startup.getClusterVMStateChanges(); - if (allStates != null) { - fullSync(clusterId, allStates); - } + if (!VmJobEnabled.value()) { + StartupRoutingCommand startup = (StartupRoutingCommand)cmd; + HashMap<String, Ternary<String, State, String>> allStates = startup.getClusterVMStateChanges(); + if (allStates != null) { + fullSync(clusterId, allStates); + } - // initiate the cron job - ClusterSyncCommand syncCmd = new ClusterSyncCommand(ClusterDeltaSyncInterval.value(), clusterId); - try { - long seq_no = _agentMgr.send(agentId, new Commands(syncCmd), this); - s_logger.debug("Cluster VM sync started with jobid " + seq_no); - } catch (AgentUnavailableException e) { - s_logger.fatal("The Cluster VM sync process failed for cluster id " + clusterId + " with ", e); + // initiate the cron job + ClusterSyncCommand syncCmd = new ClusterSyncCommand(ClusterDeltaSyncInterval.value(), clusterId); + try { + long seq_no = _agentMgr.send(agentId, new Commands(syncCmd), this); + s_logger.debug("Cluster VM sync started with jobid " + seq_no); + } catch (AgentUnavailableException e) { + s_logger.fatal("The Cluster VM sync process failed for cluster id " + clusterId + " with ", e); + } } } else { // for others KVM and VMWare - StartupRoutingCommand startup = (StartupRoutingCommand)cmd; - Commands commands = fullHostSync(agentId, startup); + if (!VmJobEnabled.value()) { + StartupRoutingCommand startup = (StartupRoutingCommand)cmd; + Commands commands = fullHostSync(agentId, startup); - if (commands.size() > 0) { - s_logger.debug("Sending clean commands to the agent"); + if (commands.size() > 0) { + s_logger.debug("Sending clean commands to the agent"); - try { - boolean error = false; - Answer[] answers = _agentMgr.send(agentId, commands); - for (Answer answer : answers) { - if (!answer.getResult()) { - s_logger.warn("Unable to stop a VM due to " + answer.getDetails()); - error = true; + try { + boolean error = false; + Answer[] answers = _agentMgr.send(agentId, commands); + for (Answer answer : answers) { + if (!answer.getResult()) { + s_logger.warn("Unable to stop a VM due to " + answer.getDetails()); + error = true; + } } + if (error) { + throw new ConnectionException(true, "Unable to stop VMs"); + } + } catch (final AgentUnavailableException e) { + s_logger.warn("Agent is unavailable now", e); + throw new ConnectionException(true, "Unable to sync", e); + } catch (final OperationTimedoutException e) { + s_logger.warn("Agent is unavailable now", e); + throw new ConnectionException(true, "Unable to sync", e); } - if (error) { - throw new ConnectionException(true, "Unable to stop VMs"); - } - } catch (final AgentUnavailableException e) { - s_logger.warn("Agent is unavailable now", e); - throw new ConnectionException(true, "Unable to sync", e); - } catch (final OperationTimedoutException e) { - s_logger.warn("Agent is unavailable now", e); - throw new ConnectionException(true, "Unable to sync", e); } } - } }
