use of com.emc.cloud.platform.ucs.out.model.LsbootDef in project coprhd-controller by CoprHD.
the class UcsDiscoveryWorker method reconcileServiceProfileTemplatesBootDefinitions.
private void reconcileServiceProfileTemplatesBootDefinitions(ComputeSystem cs, List<LsServer> lsServers) {
URIQueryResultList uris = new URIQueryResultList();
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getComputeSystemServiceProfileTemplateConstraint(cs.getId()), uris);
Map<String, LsServer> lsServerMap = new HashMap<>();
for (LsServer lsServer : lsServers) {
lsServerMap.put(lsServer.getDn(), lsServer);
}
List<UCSServiceProfileTemplate> serviceTemplates = _dbClient.queryObject(UCSServiceProfileTemplate.class, uris, true);
for (UCSServiceProfileTemplate serviceProfileTemplate : serviceTemplates) {
LsServer lsServer = lsServerMap.get(serviceProfileTemplate.getDn());
if (lsServer == null) {
continue;
}
Map<String, Object> serviceProfileTemplateDetails = getServiceProfileTemplateDetails(lsServer);
LsbootDef lsbootDef = (LsbootDef) serviceProfileTemplateDetails.get("associatedBootPolicy");
if (lsbootDef != null) {
_log.debug("Reconcile bootdef for SPT:" + serviceProfileTemplate.getLabel());
ComputeBootDef computeBootDef = reconcileComputeBootDef(lsbootDef, serviceProfileTemplate, cs);
} else {
// Remove any computeBootDefs that are no longer needed.
URIQueryResultList bootDefUris = new URIQueryResultList();
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getServiceProfileTemplateComputeBootDefsConstraint(serviceProfileTemplate.getId()), bootDefUris);
List<ComputeBootDef> bootDefs = _dbClient.queryObject(ComputeBootDef.class, bootDefUris, true);
deleteComputeBootDefs(bootDefs);
}
}
}
use of com.emc.cloud.platform.ucs.out.model.LsbootDef in project coprhd-controller by CoprHD.
the class UcsDiscoveryWorker method getServiceProfileTemplateDetails.
private Map<String, Object> getServiceProfileTemplateDetails(LsServer spt) {
Map<String, Object> serviceProfileTemplateDetails = new HashMap<>();
int vhbaCount = 0;
int vnicCount = 0;
List<VnicEther> vnics = new ArrayList<>();
List<VnicFc> vhbas = new ArrayList<>();
if (spt.getContent() != null && !spt.getContent().isEmpty()) {
for (Serializable element : spt.getContent()) {
if (element instanceof JAXBElement<?>) {
if (((JAXBElement) element).getValue() instanceof LsRequirement) {
LsRequirement lsRequirement = (LsRequirement) ((JAXBElement) element).getValue();
serviceProfileTemplateDetails.put("associatedServerPool", lsRequirement.getName());
} else if (((JAXBElement) element).getValue() instanceof VnicEther) {
vnics.add(((VnicEther) ((JAXBElement) element).getValue()));
vnicCount++;
} else if (((JAXBElement) element).getValue() instanceof VnicFc) {
vhbas.add(((VnicFc) ((JAXBElement) element).getValue()));
vhbaCount++;
} else if (((JAXBElement) element).getValue() instanceof LsbootDef) {
LsbootDef lsbootDef = (LsbootDef) ((JAXBElement) element).getValue();
serviceProfileTemplateDetails.put("associatedBootPolicy", lsbootDef);
}
}
}
serviceProfileTemplateDetails.put("vhbaCount", vhbaCount);
serviceProfileTemplateDetails.put("vnicCount", vnicCount);
serviceProfileTemplateDetails.put("vhbas", vhbas);
serviceProfileTemplateDetails.put("vnics", vnics);
}
return serviceProfileTemplateDetails;
}
Aggregations