}
private static void bundleData(String key, String val, ServiceContext serviceCtxt) {
CartridgeInstanceData instanceData = new CartridgeInstanceData();
instanceData.setNodeId(key);
instanceData.setStatus(val);
instanceData.setDomain(serviceCtxt.getDomainName());
instanceData.setSubDomain(serviceCtxt.getSubDomainName());
instanceData.setAlias("".equals(serviceCtxt.getProperty(CloudControllerConstants.ALIAS_PROPERTY))
? "NULL"
: serviceCtxt.getProperty(CloudControllerConstants.ALIAS_PROPERTY));
instanceData.setTenantRange("".equals(serviceCtxt.getProperty(CloudControllerConstants.TENANT_ID_PROPERTY))
? serviceCtxt.getTenantRange()
: serviceCtxt.getProperty(CloudControllerConstants.TENANT_ID_PROPERTY));
if (serviceCtxt.getCartridge() != null) {
instanceData.setMultiTenant(serviceCtxt.getCartridge().isMultiTenant());
for (IaasProvider iaas : serviceCtxt.getCartridge().getIaases()) {
IaasContext ctxt = null;
if ((ctxt = serviceCtxt.getIaasContext(iaas.getType())) == null) {
ctxt = serviceCtxt.addIaasContext(iaas.getType());
}
if (ctxt.didISpawn(key)) {
instanceData.setIaas(iaas.getType());
instanceData.setMetaData(ctxt.getNode(key));
// clear to be removed data
ctxt.removeToBeRemovedNodeId(key);
// if the node is terminated
if (val.equals(NodeStatus.TERMINATED.toString())) {
// since this node is terminated
FasterLookUpDataHolder.getInstance().removeNodeId(key);
// remove node meta data
ctxt.removeNodeMetadata(ctxt.getNode(key));
}
break;
}
}
instanceData.setType(serviceCtxt.getCartridge().getType());
} else {
log.warn("Cartridge is null for Service Context : (domain: " +
serviceCtxt.getDomainName() +
", sub domain: " +
serviceCtxt.getSubDomainName() +