bug 10588: putting config param for cluster sync intervals

This commit is contained in:
Abhinandan Prateek 2011-10-20 10:51:40 +05:30
parent d509c8751c
commit 1ea9b5d703
4 changed files with 17 additions and 6 deletions

View File

@ -24,13 +24,17 @@ import com.cloud.vm.VirtualMachine.State;
public class ClusterSyncAnswer extends Answer {
long _clusterId;
private HashMap<String, Pair<String, State>> _newStates;
private int _type = -1; // 0 for full, 1 for delta
HashMap<String, Pair<String, State>> _newStates;
int _type = -1; // 0 for full, 1 for delta
public static final int FULL_SYNC=0;
public static final int DELTA_SYNC=1;
public ClusterSyncAnswer() {
public ClusterSyncAnswer(long clusterId) {
_clusterId = clusterId;
result = false;
this.details = "Ignore sync as this is not a pool master";
_type = -1;
}
public ClusterSyncAnswer(long clusterId, HashMap<String, Pair<String, State>> newStates, int type){
@ -51,4 +55,8 @@ public class ClusterSyncAnswer extends Answer {
public boolean isFull(){
return _type==0;
}
public boolean isDelta(){
return _type==1;
}
}

View File

@ -6610,11 +6610,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
Host.Record hostr = poolr.master.getRecord(conn);
if (!_host.uuid.equals(hostr.uuid)) {
s_logger.debug("Not the master node so just return ok: " + _host.ip);
return new Answer(cmd, false, "Not a pool master");
return new ClusterSyncAnswer(cmd.getClusterId());
}
} catch (Exception e) {
s_logger.warn("Check for master failed, failing the Cluster sync command");
return new Answer(cmd, false, "Not a pool master");
return new ClusterSyncAnswer(cmd.getClusterId());
}
HashMap<String, Pair<String, State>> newStates;
int sync_type;

View File

@ -146,6 +146,8 @@ public enum Config {
MigrateRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "migrate.retry.interval", "120", "Time (in seconds) between migration retries", null),
PingInterval("Advanced", AgentManager.class, Integer.class, "ping.interval", "60", "Ping interval in seconds", null),
PingTimeout("Advanced", AgentManager.class, Float.class, "ping.timeout", "2.5", "Multiplier to ping.interval before announcing an agent has timed out", null),
ClusterDeltaSyncInterval("Advanced", AgentManager.class, Integer.class, "sync.interval", "60", "Cluster Delta sync interval in seconds", null),
ClusterFullSyncSkipSteps("Advanced", AgentManager.class, Integer.class, "skip.steps", "30", "Cluster full sync skip steps count", null),
Port("Advanced", AgentManager.class, Integer.class, "port", "8250", "Port to listen on for agent connection.", null),
RouterCpuMHz("Advanced", NetworkManager.class, Integer.class, "router.cpu.mhz", String.valueOf(VirtualNetworkApplianceManager.DEFAULT_ROUTER_CPU_MHZ), "Default CPU speed (MHz) for router VM.", null),
RestartRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "restart.retry.interval", "600", "Time (in seconds) between retries to restart a vm", null),

View File

@ -1943,7 +1943,8 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
long agentId = agent.getId();
Long clusterId = agent.getClusterId();
ClusterSyncCommand syncCmd = new ClusterSyncCommand(60, 20, clusterId);
ClusterSyncCommand syncCmd = new ClusterSyncCommand(Integer.parseInt(Config.ClusterDeltaSyncInterval.getDefaultValue()),
Integer.parseInt(Config.ClusterFullSyncSkipSteps.getDefaultValue()), clusterId);
try {
long seq_no = _agentMgr.send(agentId, new Commands(syncCmd), this);
s_logger.debug("Cluster VM sync started with jobid " + seq_no);