Search in sources :

Example 1 with LsbootSanImage

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

the class UCSMServiceImpl method createLsbootSanImage.

private LsbootSanImage createLsbootSanImage(Map<String, Integer> ports, String hba, Map<String, String> hbaToSwitchIdMap) throws ClientGeneralException {
    LsbootSanImage lsbootSanImage = new LsbootSanImage();
    if (SwitchId.A.name().equals(hbaToSwitchIdMap.get(hba))) {
        lsbootSanImage.setRn("san-primary");
        lsbootSanImage.setType("primary");
        lsbootSanImage.setVnicName(hba);
    } else if (SwitchId.B.name().equals(hbaToSwitchIdMap.get(hba))) {
        lsbootSanImage.setRn("san-secondary");
        lsbootSanImage.setType("secondary");
        lsbootSanImage.setVnicName(hba);
    }
    if (ports != null && ports.size() > 0) {
        Iterator<String> portIterator = ports.keySet().iterator();
        if (portIterator.hasNext()) {
            String port = portIterator.next();
            LsbootSanImagePath lsbootSanImagePath = createLsbootSanImagePath(SanImagePathType.primary, port, ports.get(port));
            lsbootSanImage.getContent().add(factory.createLsbootSanImagePath(lsbootSanImagePath));
        }
        if (portIterator.hasNext()) {
            String port = portIterator.next();
            LsbootSanImagePath lsbootSanImagePath = createLsbootSanImagePath(SanImagePathType.secondary, port, ports.get(port));
            lsbootSanImage.getContent().add(factory.createLsbootSanImagePath(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 lsbootSanImage;
}
Also used : LsbootSanImagePath(com.emc.cloud.platform.ucs.in.model.LsbootSanImagePath) LsbootSanImage(com.emc.cloud.platform.ucs.in.model.LsbootSanImage) ClientGeneralException(com.emc.cloud.platform.clientlib.ClientGeneralException)

Example 2 with LsbootSanImage

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

the class UCSMServiceImpl method createLsbootStorage.

private LsbootStorage createLsbootStorage(String spDn, Map<String, Map<String, Integer>> hbaToStoragePortMap, LsServer lsServer) throws ClientGeneralException {
    Map<String, String> hbaToSwitchIdMap = getHBAToSwitchIdMap(lsServer);
    LsbootStorage lsbootStorage = new LsbootStorage();
    lsbootStorage.setOrder("1");
    lsbootStorage.setRn("storage");
    for (String hba : hbaToStoragePortMap.keySet()) {
        Map<String, Integer> ports = hbaToStoragePortMap.get(hba);
        LsbootSanImage lsbootSanImage = createLsbootSanImage(ports, hba, hbaToSwitchIdMap);
        lsbootStorage.getContent().add(factory.createLsbootSanImage(lsbootSanImage));
    }
    return lsbootStorage;
}
Also used : LsbootStorage(com.emc.cloud.platform.ucs.in.model.LsbootStorage) LsbootSanImage(com.emc.cloud.platform.ucs.in.model.LsbootSanImage)

Aggregations

LsbootSanImage (com.emc.cloud.platform.ucs.in.model.LsbootSanImage)2 ClientGeneralException (com.emc.cloud.platform.clientlib.ClientGeneralException)1 LsbootSanImagePath (com.emc.cloud.platform.ucs.in.model.LsbootSanImagePath)1 LsbootStorage (com.emc.cloud.platform.ucs.in.model.LsbootStorage)1