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);
}
}
Aggregations