public static ISoftwareManagementTask createThriftTask(String targetName,
String specFileName, StatusUpdater statusUpdater,
ManagementOperation managementOperation,
ILockedClusterEntityManager lockClusterEntityMgr) {
ClusterOperation clusterOperation = new ClusterOperation();
switch (managementOperation) {
case CREATE:
clusterOperation.setAction(ClusterAction.CREATE);
break;
case RESIZE:
clusterOperation.setAction(ClusterAction.CREATE);
break;
case QUERY:
String clusterName = targetName.split("-")[0];
boolean needQuery = checkAndResetNodePowerStatusChanged(clusterName,
lockClusterEntityMgr.getClusterEntityMgr());
if (needQuery) {
clusterOperation.setAction(ClusterAction.QUERY);
break;
} else {
return null;
}
case UPDATE:
clusterOperation.setAction(ClusterAction.UPDATE);
break;
case START:
clusterOperation.setAction(ClusterAction.START);
break;
case STOP:
//When stop ironfan deployed cluster, don't need to stop
//hadoop services, return directly.
return null;
case DESTROY:
clusterOperation.setAction(ClusterAction.DESTROY);
break;
case CONFIGURE:
clusterOperation.setAction(ClusterAction.CONFIGURE);
break;
default:
return null;
}
clusterOperation.setTargetName(targetName);
clusterOperation.setSpecFileName(specFileName);
clusterOperation.setLogLevel(ClusterCmdUtil.getLogLevel());
ThriftSoftwareManagementTask task =
new ThriftSoftwareManagementTask(clusterOperation, statusUpdater,
lockClusterEntityMgr);
return task;
}