Search in sources :

Example 1 with AixSystem

use of com.emc.aix.AixSystem in project coprhd-controller by CoprHD.

the class AixHostDiscoveryAdapter method setNativeGuid.

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

Example 2 with AixSystem

use of com.emc.aix.AixSystem in project coprhd-controller by CoprHD.

the class AixHostDiscoveryAdapter method discoverIpInterfaces.

@Override
protected void discoverIpInterfaces(Host host, List<IpInterface> oldIpInterfaces) {
    AixSystem aix = getCli(host);
    for (IPInterface nic : aix.listIPInterfaces()) {
        if (StringUtils.isNotBlank(nic.getIpAddress())) {
            IpInterface ipInterface = getOrCreateIpInterface(oldIpInterfaces, nic.getIpAddress());
            discoverIp4Interface(host, ipInterface, nic);
        }
    }
}
Also used : IpInterface(com.emc.storageos.db.client.model.IpInterface) IPInterface(com.iwave.ext.linux.model.IPInterface) AixSystem(com.emc.aix.AixSystem)

Example 3 with AixSystem

use of com.emc.aix.AixSystem in project coprhd-controller by CoprHD.

the class AixHostDiscoveryAdapter method discoverInitiators.

@Override
protected void discoverInitiators(Host host, List<Initiator> oldInitiators, HostStateChange changes) {
    AixSystem aix = getCli(host);
    List<Initiator> addedInitiators = Lists.newArrayList();
    try {
        for (HBAInfo hba : aix.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 : aix.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) AixSystem(com.emc.aix.AixSystem) 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 4 with AixSystem

use of com.emc.aix.AixSystem in project coprhd-controller by CoprHD.

the class AixService method convertHost.

public static AixSystem convertHost(Host host) {
    AixSystem cli = new AixSystem();
    cli.setHost(host.getHostName());
    cli.setPort(host.getPortNumber());
    cli.setUsername(host.getUsername());
    cli.setPassword(host.getPassword());
    cli.setHostId(host.getId());
    return cli;
}
Also used : AixSystem(com.emc.aix.AixSystem)

Example 5 with AixSystem

use of com.emc.aix.AixSystem in project coprhd-controller by CoprHD.

the class HostRescanDeviceController method getRescanAdapter.

private HostRescanAdapter getRescanAdapter(Host host) {
    if (HostType.Linux.name().equalsIgnoreCase(host.getType())) {
        return new LinuxSystemCLI(host.getHostName(), host.getPortNumber(), host.getUsername(), host.getPassword());
    } else if (HostType.AIX.name().equalsIgnoreCase(host.getType())) {
        return new AixSystem(host.getHostName(), host.getPortNumber(), host.getUsername(), host.getPassword());
    } else if (HostType.HPUX.name().equalsIgnoreCase(host.getType())) {
        return new HpuxSystem(host.getHostName(), host.getPortNumber(), host.getUsername(), host.getPassword());
    } else if (HostType.Windows.name().equalsIgnoreCase(host.getType())) {
        List<AuthnProvider> authProviders = new ArrayList<AuthnProvider>();
        for (URI authProviderId : getDbClient().queryByType(AuthnProvider.class, true)) {
            AuthnProvider authProvider = getDbClient().queryObject(AuthnProvider.class, authProviderId);
            authProviders.add(authProvider);
        }
        KerberosUtil.initializeKerberos(authProviders);
        return WindowsHostDiscoveryAdapter.createWindowsSystem(host);
    } else if (HostType.Esx.name().equalsIgnoreCase(host.getType())) {
        if (host.getUsername() != null && host.getPassword() != null) {
            VCenterAPI vcenterAPI = EsxHostDiscoveryAdapter.createVCenterAPI(host);
            List<HostSystem> hostSystems = vcenterAPI.listAllHostSystems();
            if (hostSystems != null && !hostSystems.isEmpty()) {
                return new HostStorageAPI(hostSystems.get(0));
            } else {
                return null;
            }
        } else if (host.getVcenterDataCenter() != null) {
            // Lookup the vcenter datacenter and vcenter to retreive the HostSystem
            VcenterDataCenter dataCenter = dbClient.queryObject(VcenterDataCenter.class, host.getVcenterDataCenter());
            if (dataCenter == null || dataCenter.getInactive()) {
                throw DeviceControllerException.exceptions.objectNotFound(host.getVcenterDataCenter());
            }
            Vcenter vcenter = dbClient.queryObject(Vcenter.class, dataCenter.getVcenter());
            if (vcenter == null || vcenter.getInactive()) {
                throw DeviceControllerException.exceptions.objectNotFound(dataCenter.getVcenter());
            }
            VCenterAPI vCenterAPI = VcenterDiscoveryAdapter.createVCenterAPI(vcenter);
            String datacenterName = dataCenter.getLabel();
            HostSystem hostSystem = vCenterAPI.findHostSystem(datacenterName, host.getHostName());
            if (hostSystem != null) {
                return new HostStorageAPI(hostSystem);
            } else {
                return null;
            }
        }
    } else {
        // Unanticipated host type
        return null;
    }
    return null;
}
Also used : VCenterAPI(com.iwave.ext.vmware.VCenterAPI) LinuxSystemCLI(com.iwave.ext.linux.LinuxSystemCLI) Vcenter(com.emc.storageos.db.client.model.Vcenter) AuthnProvider(com.emc.storageos.db.client.model.AuthnProvider) URI(java.net.URI) HpuxSystem(com.emc.hpux.HpuxSystem) AixSystem(com.emc.aix.AixSystem) HostSystem(com.vmware.vim25.mo.HostSystem) ArrayList(java.util.ArrayList) List(java.util.List) VcenterDataCenter(com.emc.storageos.db.client.model.VcenterDataCenter) HostStorageAPI(com.iwave.ext.vmware.HostStorageAPI)

Aggregations

AixSystem (com.emc.aix.AixSystem)6 CommandException (com.iwave.ext.command.CommandException)2 URI (java.net.URI)2 AixVersion (com.emc.aix.model.AixVersion)1 HpuxSystem (com.emc.hpux.HpuxSystem)1 ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)1 AuthnProvider (com.emc.storageos.db.client.model.AuthnProvider)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 ArrayList (java.util.ArrayList)1