Search in sources :

Example 6 with HpuxSystem

use of com.emc.hpux.HpuxSystem in project coprhd-controller by CoprHD.

the class HpuxHostDiscoveryAdapter method discoverInitiators.

@Override
protected void discoverInitiators(Host host, List<Initiator> oldInitiators, HostStateChange changes) {
    HpuxSystem hpux = getCli(host);
    List<Initiator> addedInitiators = Lists.newArrayList();
    try {
        for (HBAInfo hba : hpux.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 : hpux.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) HpuxSystem(com.emc.hpux.HpuxSystem) Initiator(com.emc.storageos.db.client.model.Initiator) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) URI(java.net.URI) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CommandException(com.iwave.ext.command.CommandException) JSchException(com.jcraft.jsch.JSchException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)

Example 7 with HpuxSystem

use of com.emc.hpux.HpuxSystem in project coprhd-controller by CoprHD.

the class HpuxHostDiscoveryAdapter method setNativeGuid.

@Override
protected void setNativeGuid(Host host) {
    HpuxSystem hpux = getCli(host);
    try {
        String macAddress = hpux.getNetworkAdapterMacAddress(LAN0);
        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 : HpuxSystem(com.emc.hpux.HpuxSystem) CommandException(com.iwave.ext.command.CommandException)

Aggregations

HpuxSystem (com.emc.hpux.HpuxSystem)7 CommandException (com.iwave.ext.command.CommandException)2 URI (java.net.URI)2 AixSystem (com.emc.aix.AixSystem)1 HpuxVersion (com.emc.hpux.model.HpuxVersion)1 ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)1 AuthnProvider (com.emc.storageos.db.client.model.AuthnProvider)1 HostType (com.emc.storageos.db.client.model.Host.HostType)1 Initiator (com.emc.storageos.db.client.model.Initiator)1 IpInterface (com.emc.storageos.db.client.model.IpInterface)1 Vcenter (com.emc.storageos.db.client.model.Vcenter)1 VcenterDataCenter (com.emc.storageos.db.client.model.VcenterDataCenter)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 LinuxSystemCLI (com.iwave.ext.linux.LinuxSystemCLI)1 HBAInfo (com.iwave.ext.linux.model.HBAInfo)1 IPInterface (com.iwave.ext.linux.model.IPInterface)1 HostStorageAPI (com.iwave.ext.vmware.HostStorageAPI)1 VCenterAPI (com.iwave.ext.vmware.VCenterAPI)1 JSchException (com.jcraft.jsch.JSchException)1 HostSystem (com.vmware.vim25.mo.HostSystem)1