Search in sources :

Example 1 with LsbootSanCatSanImage

use of com.emc.cloud.platform.ucs.in.model.LsbootSanCatSanImage in project coprhd-controller by CoprHD.

the class UCSMServiceImpl method createLsbootSanCatSanImage.

private LsbootSanCatSanImage createLsbootSanCatSanImage(Map<String, Integer> ports, String hba, Map<String, String> hbaToSwitchIdMap) throws ClientGeneralException {
    LsbootSanCatSanImage lsbootSanCatSanImage = new LsbootSanCatSanImage();
    lsbootSanCatSanImage.setType(BootType.SAN.toString().toLowerCase());
    if (SwitchId.A.name().equals(hbaToSwitchIdMap.get(hba))) {
        lsbootSanCatSanImage.setRn("sanimg-" + SanImagePathType.primary.toString());
        lsbootSanCatSanImage.setType(SanImagePathType.primary.toString());
        lsbootSanCatSanImage.setVnicName(hba);
    } else if (SwitchId.B.name().equals(hbaToSwitchIdMap.get(hba))) {
        lsbootSanCatSanImage.setRn("sanimg-" + SanImagePathType.secondary.toString());
        lsbootSanCatSanImage.setType(SanImagePathType.secondary.toString());
        lsbootSanCatSanImage.setVnicName(hba);
    } else {
        log.error("Unable to determine fabric A or B for initiator {}", hba);
        String[] s = { "Unable to determine fabric A or B for initiator " + hba };
        throw new ClientGeneralException(ClientMessageKeys.UNEXPECTED_FAILURE, s);
    }
    if (ports != null && ports.size() > 0) {
        Iterator<String> portIterator = ports.keySet().iterator();
        if (portIterator.hasNext()) {
            String port = portIterator.next();
            LsbootSanCatSanImagePath lsbootSanImagePath = createLsbootSanCatSanImagePath(SanImagePathType.primary, port, ports.get(port));
            lsbootSanCatSanImage.getContent().add(factory.createLsbootSanCatSanImagePath(lsbootSanImagePath));
        }
        if (portIterator.hasNext()) {
            String port = portIterator.next();
            LsbootSanCatSanImagePath lsbootSanImagePath = createLsbootSanCatSanImagePath(SanImagePathType.secondary, port, ports.get(port));
            lsbootSanCatSanImage.getContent().add(factory.createLsbootSanCatSanImagePath(lsbootSanImagePath));
        }
    } else {
        log.error("Unable to determine array targets for initiator {}", hba);
        String[] s = { "Unable to determine array targets for initiator " + hba };
        throw new ClientGeneralException(ClientMessageKeys.UNEXPECTED_FAILURE, s);
    }
    return lsbootSanCatSanImage;
}
Also used : LsbootSanCatSanImage(com.emc.cloud.platform.ucs.in.model.LsbootSanCatSanImage) LsbootSanCatSanImagePath(com.emc.cloud.platform.ucs.in.model.LsbootSanCatSanImagePath) ClientGeneralException(com.emc.cloud.platform.clientlib.ClientGeneralException)

Example 2 with LsbootSanCatSanImage

use of com.emc.cloud.platform.ucs.in.model.LsbootSanCatSanImage in project coprhd-controller by CoprHD.

the class UCSMServiceImpl method createLsbootSan.

private LsbootSan createLsbootSan(String spDN, Map<String, Map<String, Integer>> hbaToStoragePortMap, LsServer lsServerCurrent) throws ClientGeneralException {
    Map<String, String> hbaToSwitchIdMap = getHBAToSwitchIdMap(lsServerCurrent);
    LsbootSan lsbootSan = new LsbootSan();
    lsbootSan.setOrder("1");
    lsbootSan.setRn("san");
    for (String hba : hbaToStoragePortMap.keySet()) {
        Map<String, Integer> ports = hbaToStoragePortMap.get(hba);
        LsbootSanCatSanImage lsbootSanCatSanImage = createLsbootSanCatSanImage(ports, hba, hbaToSwitchIdMap);
        lsbootSan.getContent().add(factory.createLsbootSanCatSanImage(lsbootSanCatSanImage));
    }
    return lsbootSan;
}
Also used : LsbootSan(com.emc.cloud.platform.ucs.in.model.LsbootSan) LsbootSanCatSanImage(com.emc.cloud.platform.ucs.in.model.LsbootSanCatSanImage)

Aggregations

LsbootSanCatSanImage (com.emc.cloud.platform.ucs.in.model.LsbootSanCatSanImage)2 ClientGeneralException (com.emc.cloud.platform.clientlib.ClientGeneralException)1 LsbootSan (com.emc.cloud.platform.ucs.in.model.LsbootSan)1 LsbootSanCatSanImagePath (com.emc.cloud.platform.ucs.in.model.LsbootSanCatSanImagePath)1