use of com.emc.aix.AixVioCLI in project coprhd-controller by CoprHD.
the class AixVioDiscoveryAdapter method discoverInitiators.
@Override
protected void discoverInitiators(Host host, List<Initiator> oldInitiators, HostStateChange changes) {
AixVioCLI cli = getCli(host);
List<Initiator> addedInitiators = Lists.newArrayList();
try {
for (HBAInfo hba : cli.listInitiators()) {
Initiator initiator;
String wwpn = SanUtils.normalizeWWN(hba.getWwpn());
if (findInitiatorByPort(oldInitiators, wwpn) == null) {
initiator = getOrCreateInitiator(host.getId(), oldInitiators, wwpn);
addedInitiators.add(initiator);
} else {
initiator = getOrCreateInitiator(host.getId(), oldInitiators, wwpn);
}
discoverFCInitiator(host, initiator, hba);
}
} catch (DeviceControllerException e) {
throw e;
} catch (Exception e) {
LOG.error("Failed to list FC Ports, skipping");
}
try {
for (String iqn : cli.listIQNs()) {
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 (DeviceControllerException e) {
throw e;
} catch (Exception e) {
LOG.error("Failed to list iSCSI Ports, skipping");
}
// 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);
}
}
use of com.emc.aix.AixVioCLI in project coprhd-controller by CoprHD.
the class AixVioDiscoveryAdapter method setNativeGuid.
@Override
protected void setNativeGuid(Host host) {
AixVioCLI cli = getCli(host);
try {
String macAddress = cli.getNetworkAdapterMacAddress(ENT0);
if (macAddress != null && !host.getNativeGuid().equalsIgnoreCase(macAddress)) {
checkDuplicateHost(host, macAddress);
info("Setting nativeGuid for " + host.getId() + " as " + macAddress);
host.setNativeGuid(macAddress);
save(host);
}
} catch (CommandException ex) {
LOG.warn("Failed to get MAC address of adapter during discovery");
}
}
Aggregations