List<Callable<Void>> storeProcedures = new ArrayList<Callable<Void>>();
Map<String, NodeOperationStatus> nodesStatus =
new HashMap<String, NodeOperationStatus>();
for (int i = 0; i < nodes.size(); i++) {
NodeEntity node = nodes.get(i);
if (node.getMoId() == null) {
logger.info("VC vm does not exist for node: " + node.getVmName());
continue;
}
VcVirtualMachine vcVm = VcCache.getIgnoreMissing(node.getMoId());
if (vcVm == null) {
// cannot find VM
logger.info("VC vm does not exist for node: " + node.getVmName());
continue;
}
StartVmSP.StartVmPrePowerOn prePowerOn = new StartVmSP.StartVmPrePowerOn(isMapDistro,
(new Gson()).toJson(node.getVolumns()));
StartVmPostPowerOn query =
new StartVmPostPowerOn(node.fetchAllPortGroups(),
Constants.VM_POWER_ON_WAITING_SEC, clusterEntityMgr);
VcHost host = null;
if (node.getHostName() != null) {
host = VcResourceUtils.findHost(node.getHostName());
}
StartVmSP startSp = new StartVmSP(vcVm, prePowerOn, query, host);
storeProcedures.add(startSp);
nodesStatus.put(node.getVmName(),
new NodeOperationStatus(node.getVmName()));
}
try {
if (storeProcedures.isEmpty()) {
logger.info("no VM is available. Return directly.");