this.host = host;
final Value[] booleanValues = PCMK_BOOLEAN_VALUES;
final Value hbBooleanTrue = booleanValues[0];
final Value hbBooleanFalse = booleanValues[1];
/* hostlist choices for stonith */
stonithHostlistChoices.add(new StringValue());
final String[] hosts = host.getCluster().getHostNames();
if (hosts != null && hosts.length < 8) {
stonithHostlistChoices.add(new StringValue(Tools.join(" ", hosts)));
for (final String h : hosts) {
stonithHostlistChoices.add(new StringValue(h));
}
}
/* clones */
cloneResourceAgent = new ResourceAgent(Application.PM_CLONE_SET_NAME, "", "clone");
cloneResourceAgent.setMetaDataLoaded(true);
addMetaAttributeToResourceAgent(cloneResourceAgent, MASTER_MAX_META_ATTR, null, true);
addMetaAttributeToResourceAgent(cloneResourceAgent, MASTER_NODE_MAX_META_ATTR, null, true);
addMetaAttributeToResourceAgent(cloneResourceAgent, CLONE_MAX_META_ATTR, null, false);
addMetaAttributeToResourceAgent(cloneResourceAgent, CLONE_NODE_MAX_META_ATTR, null, false);
addMetaAttributeToResourceAgent(cloneResourceAgent, NOTIFY_META_ATTR, null, false);
addMetaAttributeToResourceAgent(cloneResourceAgent, GLOBALLY_UNIQUE_META_ATTR, null, false);
addMetaAttributeToResourceAgent(cloneResourceAgent, ORDERED_META_ATTR, null, false);
addMetaAttributeToResourceAgent(cloneResourceAgent, INTERLEAVE_META_ATTR, null, false);
addMetaAttributeToResourceAgent(groupResourceAgent, GROUP_ORDERED_META_ATTR, null, false);
addMetaAttributeToResourceAgent(groupResourceAgent, GROUP_COLLOCATED_META_ATTR, null, false);
/* groups */
final Map<String, String> maParams = getMetaAttrParameters();
for (final String metaAttr : maParams.keySet()) {
addMetaAttributeToResourceAgent(cloneResourceAgent, metaAttr, maParams.get(metaAttr), false);
addMetaAttributeToResourceAgent(groupResourceAgent, metaAttr, maParams.get(metaAttr), false);
}
/* Hardcoding global params */
/* symmetric cluster */
globalParams.add("symmetric-cluster");
globalShortDescMap.put("symmetric-cluster", "Symmetric Cluster");
globalLongDescMap.put("symmetric-cluster", "Symmetric Cluster");
globalTypeMap.put("symmetric-cluster", PARAM_TYPE_BOOLEAN);
globalDefaultMap.put("symmetric-cluster", hbBooleanFalse);
globalComboBoxChoices.put("symmetric-cluster", booleanValues);
globalRequiredParams.add("symmetric-cluster");
globalNotAdvancedParams.add("symmetric-cluster");
/* stonith enabled */
globalParams.add("stonith-enabled");
globalShortDescMap.put("stonith-enabled", "Stonith Enabled");
globalLongDescMap.put("stonith-enabled", "Stonith Enabled");
globalTypeMap.put("stonith-enabled", PARAM_TYPE_BOOLEAN);
globalDefaultMap.put("stonith-enabled", hbBooleanTrue);
globalComboBoxChoices.put("stonith-enabled", booleanValues);
globalRequiredParams.add("stonith-enabled");
globalNotAdvancedParams.add("stonith-enabled");
/* transition timeout */
globalParams.add("default-action-timeout");
globalShortDescMap.put("default-action-timeout", "Transition Timeout");
globalLongDescMap.put("default-action-timeout", "Transition Timeout");
globalTypeMap.put("default-action-timeout", PARAM_TYPE_INTEGER);
globalDefaultMap.put("default-action-timeout", new StringValue("20"));
globalComboBoxChoices.put("default-action-timeout", INTEGER_VALUES);
globalRequiredParams.add("default-action-timeout");
/* resource stickiness */
/* special case: is advanced parameter if not set. */
globalParams.add("default-resource-stickiness");
globalShortDescMap.put("default-resource-stickiness", "Resource Stickiness");
globalLongDescMap.put("default-resource-stickiness", "Resource Stickiness");
globalTypeMap.put("default-resource-stickiness", PARAM_TYPE_INTEGER);
globalComboBoxChoices.put("default-resource-stickiness", INTEGER_VALUES);
globalDefaultMap.put("default-resource-stickiness", new StringValue("0"));
globalRequiredParams.add("default-resource-stickiness");
/* no quorum policy */
globalParams.add("no-quorum-policy");
globalShortDescMap.put("no-quorum-policy", "No Quorum Policy");
globalLongDescMap.put("no-quorum-policy", "No Quorum Policy");
globalTypeMap.put("no-quorum-policy", PARAM_TYPE_STRING);
globalDefaultMap.put("no-quorum-policy", new StringValue("stop"));
globalComboBoxChoices.put("no-quorum-policy", new Value[]{new StringValue("ignore"),
new StringValue("stop"),
new StringValue("freeze"),
new StringValue("suicide")});
globalRequiredParams.add("no-quorum-policy");
globalNotAdvancedParams.add("no-quorum-policy");
/* resource failure stickiness */
globalParams.add("default-resource-failure-stickiness");
globalShortDescMap.put("default-resource-failure-stickiness", "Resource Failure Stickiness");
globalLongDescMap.put("default-resource-failure-stickiness", "Resource Failure Stickiness");
globalTypeMap.put("default-resource-failure-stickiness", PARAM_TYPE_INTEGER);
globalComboBoxChoices.put("default-resource-failure-stickiness", INTEGER_VALUES);
globalDefaultMap.put("default-resource-failure-stickiness", new StringValue("0"));
globalRequiredParams.add("default-resource-failure-stickiness");
globalComboBoxChoices.put("placement-strategy", new Value[]{new StringValue("default"),
new StringValue("utilization"),
new StringValue("minimal"),
new StringValue("balanced")});
final String hbV = host.getHeartbeatVersion();
final String pcmkV = host.getPacemakerVersion();
try {
if (pcmkV != null || Tools.compareVersions(hbV, "2.1.3") >= 0) {
String clusterRecheckInterval = "cluster-recheck-interval";
String dcDeadtime = "dc-deadtime";
String electionTimeout = "election-timeout";
String shutdownEscalation = "shutdown-escalation";
if (Tools.versionBeforePacemaker(host)) {
clusterRecheckInterval = "cluster_recheck_interval";
dcDeadtime = "dc_deadtime";
electionTimeout = "election_timeout";
shutdownEscalation = "shutdown_escalation";
}
final String[] params = {"stonith-action",
"is-managed-default",
"cluster-delay",
"batch-limit",
"stop-orphan-resources",
"stop-orphan-actions",
"remove-after-stop",
"pe-error-series-max",
"pe-warn-series-max",
"pe-input-series-max",
"startup-fencing",
"start-failure-is-fatal",
dcDeadtime,
clusterRecheckInterval,
electionTimeout,
shutdownEscalation,
"crmd-integration-timeout",
"crmd-finalization-timeout",
"expected-quorum-votes",
"maintenance-mode",
};
globalParams.add("dc-version");
globalShortDescMap.put("dc-version", "DC Version");
globalTypeMap.put("dc-version", PARAM_TYPE_LABEL);
paramGlobalAccessTypes.put("dc-version", AccessMode.NEVER);
globalParams.add("cluster-infrastructure");
globalShortDescMap.put("cluster-infrastructure", "Cluster Infrastructure");
globalTypeMap.put("cluster-infrastructure", PARAM_TYPE_LABEL);
paramGlobalAccessTypes.put("cluster-infrastructure", AccessMode.NEVER);
globalNotAdvancedParams.add("no-quorum-policy");
globalNotAdvancedParams.add("maintenance-mode");
paramGlobalAccessTypes.put("maintenance-mode", AccessMode.OP);
globalNotAdvancedParams.add(clusterRecheckInterval);
for (final String param : params) {
globalParams.add(param);
final String[] parts = param.split("[-_]");
for (int i = 0; i < parts.length; i++) {
if ("dc".equals(parts[i])) {
parts[i] = "DC";
}
if ("crmd".equals(parts[i])) {
parts[i] = "CRMD";
} else {
parts[i] = Tools.ucfirst(parts[i]);
}
}
final String name = Tools.join(" ", parts);
globalShortDescMap.put(param, name);
globalLongDescMap.put(param, name);
globalTypeMap.put(param, PARAM_TYPE_STRING);
globalDefaultMap.put(param, new StringValue());
}
globalDefaultMap.put("stonith-action", new StringValue("reboot"));
globalComboBoxChoices.put("stonith-action", new Value[]{new StringValue("reboot"),
new StringValue("poweroff")});
globalTypeMap.put("is-managed-default", PARAM_TYPE_BOOLEAN);
globalDefaultMap.put("is-managed-default", hbBooleanFalse);
globalComboBoxChoices.put("is-managed-default", booleanValues);