Search in sources :

Example 1 with AixVioCLI

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);
    }
}
Also used : HBAInfo(com.iwave.ext.linux.model.HBAInfo) Initiator(com.emc.storageos.db.client.model.Initiator) AixVioCLI(com.emc.aix.AixVioCLI) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) URI(java.net.URI) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CommandException(com.iwave.ext.command.CommandException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)

Example 2 with AixVioCLI

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");
    }
}
Also used : AixVioCLI(com.emc.aix.AixVioCLI) CommandException(com.iwave.ext.command.CommandException)

Aggregations

AixVioCLI (com.emc.aix.AixVioCLI)2 CommandException (com.iwave.ext.command.CommandException)2 ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)1 Initiator (com.emc.storageos.db.client.model.Initiator)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 HBAInfo (com.iwave.ext.linux.model.HBAInfo)1 URI (java.net.URI)1