Search in sources :

Example 1 with WinRMSoapException

use of com.iwave.ext.windows.winrm.WinRMSoapException in project coprhd-controller by CoprHD.

the class WindowsHostDiscoveryAdapter method discoverInitiators.

@Override
protected void discoverInitiators(Host host, List<Initiator> oldInitiators, HostStateChange changes) {
    WindowsSystemWinRM windows = createWindowsSystem(host);
    List<Initiator> addedInitiators = new ArrayList<Initiator>();
    try {
        for (FibreChannelHBA hba : windows.listFibreChannelHBAs()) {
            Initiator initiator;
            if (findInitiatorByPort(oldInitiators, hba.getPortWWN()) == null) {
                initiator = getOrCreateInitiator(host.getId(), oldInitiators, hba.getPortWWN());
                addedInitiators.add(initiator);
            } else {
                initiator = getOrCreateInitiator(host.getId(), oldInitiators, hba.getPortWWN());
            }
            discoverFCInitiator(host, initiator, hba);
        }
    } catch (WinRMSoapException e) {
        info("Could not retrieve fibre channel HBAs: %s", e.getMessage());
        clearInitiators(oldInitiators, Protocol.FC.name());
    } catch (WinRMException e) {
        warn(e, "Error while retrieving fibre channel HBAs: %s", e.getMessage());
        clearInitiators(oldInitiators, Protocol.FC.name());
    }
    try {
        for (String iqn : windows.listIScsiInitiators()) {
            Initiator initiator;
            if (findInitiatorByPort(oldInitiators, iqn) == null) {
                initiator = getOrCreateInitiator(host.getId(), oldInitiators, iqn);
                addedInitiators.add(initiator);
            } else {
                initiator = getOrCreateInitiator(host.getId(), oldInitiators, iqn);
            }
            discoverISCSIInitiator(host, initiator, iqn);
        }
    } catch (WinRMSoapException e) {
        info("Could not retrieve iSCSI interfaces: %s", e.getMessage());
        clearInitiators(oldInitiators, Protocol.iSCSI.name());
    } catch (WinRMException e) {
        warn(e, "Error while retrieving iSCSI interfaces: %s", e.getMessage());
        clearInitiators(oldInitiators, Protocol.iSCSI.name());
    }
    // update export groups with new initiators if host is in use.
    if (!addedInitiators.isEmpty()) {
        Collection<URI> addedInitiatorIds = Lists.newArrayList(Collections2.transform(addedInitiators, CommonTransformerFunctions.fctnDataObjectToID()));
        changes.setNewInitiators(addedInitiatorIds);
    }
}
Also used : WindowsSystemWinRM(com.iwave.ext.windows.WindowsSystemWinRM) WinRMException(com.iwave.ext.windows.winrm.WinRMException) Initiator(com.emc.storageos.db.client.model.Initiator) ArrayList(java.util.ArrayList) WinRMSoapException(com.iwave.ext.windows.winrm.WinRMSoapException) URI(java.net.URI)

Aggregations

Initiator (com.emc.storageos.db.client.model.Initiator)1 WindowsSystemWinRM (com.iwave.ext.windows.WindowsSystemWinRM)1 WinRMException (com.iwave.ext.windows.winrm.WinRMException)1 WinRMSoapException (com.iwave.ext.windows.winrm.WinRMSoapException)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1