report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(ce);
return;
}
Cluster cl = domain.getClusterNamed(cluster);
if ( cl == null){
String msg = localStrings.getLocalString("NoSuchCluster", "No such cluster {0}", cluster);
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
for (Iterator it = instanceWeights.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
String instance = (String)entry.getKey();
try {
Server s = domain.getServerNamed(instance);
if (s == null) {
String msg = localStrings.getLocalString("NoSuchInstance", "No such instance {0}", instance);
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
Cluster c = domain.getClusterForInstance(s.getName());
if (c == null) {
String msg = localStrings.getLocalString("InstanceDoesNotBelongToCluster",
"Instance {0} does not belong to cluster {1}.", instance,cluster);
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
if (!c.getName().equals(cluster)) {
String msg = localStrings.getLocalString("InstanceDoesNotBelongToCluster",
"Instance {0} does not belong to cluster {1}.", instance,cluster);
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);