Search in sources :

Example 66 with VNXeBase

use of com.emc.storageos.vnxe.models.VNXeBase in project coprhd-controller by CoprHD.

the class DeleteStorageResourceRequest method getStorageResourceId.

/**
 * Get storageResource Id using filesystem Id
 *
 * @param fsId fileSystem Id
 * @return storageResource Id
 */
private String getStorageResourceId(String fsId) {
    FileSystemRequest fsReq = new FileSystemRequest(_client, fsId);
    VNXeFileSystem fs = fsReq.get();
    VNXeBase resource = fs.getStorageResource();
    String result = null;
    if (resource != null) {
        result = resource.getId();
    }
    return result;
}
Also used : VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem)

Example 67 with VNXeBase

use of com.emc.storageos.vnxe.models.VNXeBase in project coprhd-controller by CoprHD.

the class FileSystemActionRequestTest method modifyFileSystem.

// @Test
public void modifyFileSystem() {
    ModifyFileSystemParam parm = new ModifyFileSystemParam();
    NfsShareCreateParam nfsShareParm = new NfsShareCreateParam();
    nfsShareParm.setName("fs-21-share-1");
    nfsShareParm.setPath("/");
    NfsShareParam shareParm = new NfsShareParam();
    List<VNXeBase> hosts = new ArrayList<VNXeBase>();
    VNXeBase host = new VNXeBase();
    host.setId("Host_1");
    hosts.add(host);
    shareParm.setReadWriteHosts(hosts);
    nfsShareParm.setNfsShareParameters(shareParm);
    List<NfsShareCreateParam> nfsList = new ArrayList<NfsShareCreateParam>();
    nfsList.add(nfsShareParm);
    parm.setNfsShareCreate(nfsList);
    FileSystemActionRequest req = new FileSystemActionRequest(_client);
    VNXeCommandJob job = req.modifyFileSystemAsync(parm, "res_4");
    System.out.println(job.getId());
}
Also used : VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) ArrayList(java.util.ArrayList) NfsShareParam(com.emc.storageos.vnxe.models.NfsShareParam) ModifyFileSystemParam(com.emc.storageos.vnxe.models.ModifyFileSystemParam) NfsShareCreateParam(com.emc.storageos.vnxe.models.NfsShareCreateParam)

Example 68 with VNXeBase

use of com.emc.storageos.vnxe.models.VNXeBase in project coprhd-controller by CoprHD.

the class VNXUnityCommunicationInterface method discoverIscsiPorts.

/**
 * Discover iscsiPorts
 *
 * @param system
 * @param client
 * @param spIdMap
 *            storage processors VNXeId and ViPR URI map
 * @return
 * @throws VNXeException
 */
private HashMap<String, List<StoragePort>> discoverIscsiPorts(StorageSystem system, VNXeApiClient client, Map<String, URI> spIdMap) throws VNXeException {
    HashMap<String, List<StoragePort>> storagePorts = new HashMap<String, List<StoragePort>>();
    List<StoragePort> newStoragePorts = new ArrayList<StoragePort>();
    List<StoragePort> existingStoragePorts = new ArrayList<StoragePort>();
    _logger.info("Start iSCSI storage port discovery for storage system {}", system.getId());
    // Retrieve the list of iscsi ports
    List<VNXeIscsiNode> ports = client.getAllIscsiPorts();
    if (ports == null || ports.isEmpty()) {
        _logger.info("No iSCSI ports found for the system: {} ", system.getId());
        return storagePorts;
    }
    _logger.info("Number iSCSI ports found: {}", ports.size());
    // Create the list of storage ports.
    for (VNXeIscsiNode node : ports) {
        StoragePort port = null;
        VNXeEthernetPort eport = node.getEthernetPort();
        if (eport == null) {
            _logger.info("No ethernet port found for the iscsi node: {}", node.getId());
            continue;
        }
        VNXeBase spId = eport.getStorageProcessor();
        if (spId == null) {
            _logger.info("No storage processor info for the iscsi node: {}", node.getId());
            continue;
        }
        String spIdStr = spId.getId();
        URI haDomainUri = spIdMap.get(spIdStr);
        if (haDomainUri == null) {
            _logger.info("The sp {} has not been discovered.", spIdStr);
            continue;
        }
        // Check if storage port was already discovered
        String portNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, node.getName(), NativeGUIDGenerator.PORT);
        URIQueryResultList results = new URIQueryResultList();
        _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStoragePortByNativeGuidConstraint(portNativeGuid), results);
        Iterator<URI> it = results.iterator();
        if (it.hasNext()) {
            _logger.info("cross verifying for duplicate port");
            StoragePort tmpPort = _dbClient.queryObject(StoragePort.class, it.next());
            _logger.info(String.format("Actual StorageDevice %s : PortGroup found for port %s - Actual PortGroup %s", system.getId(), tmpPort.getPortNetworkId(), tmpPort.getPortGroup()));
            if (tmpPort.getStorageDevice().equals(system.getId()) && tmpPort.getPortGroup().equals(spIdStr)) {
                port = tmpPort;
                _logger.info("found duplicate iscsi port {}", node.getName());
            }
        }
        // If iscsi port was not previously discovered, add new storage port
        if (port == null) {
            port = new StoragePort();
            port.setId(URIUtil.createId(StoragePort.class));
            port.setLabel(portNativeGuid);
            port.setTransportType("IP");
            port.setNativeGuid(portNativeGuid);
            port.setStorageDevice(system.getId());
            port.setRegistrationStatus(RegistrationStatus.REGISTERED.toString());
            port.setPortName(eport.getId());
            port.setPortNetworkId(node.getName());
            port.setPortGroup(spIdStr);
            port.setStorageHADomain(haDomainUri);
            VNXeIscsiPortal portal = node.getIscsiPortal();
            if (portal != null) {
                port.setIpAddress(portal.getIpAddress());
            }
            _logger.info("Creating new storage port using NativeGuid : {}, IQN:", portNativeGuid, node.getName());
            newStoragePorts.add(port);
        } else {
            existingStoragePorts.add(port);
        }
        Health health = node.getEthernetPort().getHealth();
        if (health != null && health.getValue() == Health.HealthEnum.OK.getValue()) {
            port.setOperationalStatus(StoragePort.OperationalStatus.OK.name());
        } else {
            port.setOperationalStatus(StoragePort.OperationalStatus.NOT_OK.name());
        }
        port.setDiscoveryStatus(DiscoveryStatus.VISIBLE.name());
        port.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
    }
    _logger.info("iSCSI port discovery for storage system {} complete", system.getId());
    storagePorts.put(NEW, newStoragePorts);
    storagePorts.put(EXISTING, existingStoragePorts);
    return storagePorts;
}
Also used : HashMap(java.util.HashMap) Health(com.emc.storageos.vnxe.models.Health) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) VNXeEthernetPort(com.emc.storageos.vnxe.models.VNXeEthernetPort) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) VNXeIscsiNode(com.emc.storageos.vnxe.models.VNXeIscsiNode) VNXeIscsiPortal(com.emc.storageos.vnxe.models.VNXeIscsiPortal) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 69 with VNXeBase

use of com.emc.storageos.vnxe.models.VNXeBase in project coprhd-controller by CoprHD.

the class VNXUnityCommunicationInterface method discoverFcPorts.

/**
 * Discover fcPorts
 *
 * @param system
 * @param client
 * @param spIdMap
 *            storage processors VNXeId and ViPR URI map
 * @return
 * @throws VNXeException
 */
private HashMap<String, List<StoragePort>> discoverFcPorts(StorageSystem system, VNXeApiClient client, Map<String, URI> spIdMap) throws VNXeException {
    HashMap<String, List<StoragePort>> storagePorts = new HashMap<String, List<StoragePort>>();
    List<StoragePort> newStoragePorts = new ArrayList<StoragePort>();
    List<StoragePort> existingStoragePorts = new ArrayList<StoragePort>();
    _logger.info("Start FC storage port discovery for storage system {}", system.getId());
    // Retrieve the list of iscsi ports
    List<VNXeFCPort> ports = client.getAllFcPorts();
    if (ports == null || ports.isEmpty()) {
        _logger.info("No FC ports found for the system: {} ", system.getId());
        storagePorts.put(NEW, newStoragePorts);
        storagePorts.put(EXISTING, existingStoragePorts);
        return storagePorts;
    }
    // Create the list of storage ports.
    for (VNXeFCPort fcPort : ports) {
        StoragePort port = null;
        VNXeBase spId = fcPort.getStorageProcessor();
        if (spId == null) {
            _logger.info("No storage processor info for the fcPort: {}", fcPort.getId());
            continue;
        }
        String spIdStr = spId.getId();
        URI haDomainUri = spIdMap.get(spIdStr);
        if (haDomainUri == null) {
            _logger.info("The sp {} has not been discovered.", spIdStr);
            continue;
        }
        // Check if storage port was already discovered
        String portNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, fcPort.getWwn(), NativeGUIDGenerator.PORT);
        URIQueryResultList results = new URIQueryResultList();
        _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStoragePortByNativeGuidConstraint(portNativeGuid), results);
        Iterator<URI> it = results.iterator();
        if (it.hasNext()) {
            _logger.debug("cross verifying for duplicate port");
            StoragePort tmpPort = _dbClient.queryObject(StoragePort.class, it.next());
            _logger.info(String.format("Actual StorageDevice %s : PortGroup found for port %s - Actual PortGroup %s", system.getId(), tmpPort.getPortNetworkId(), tmpPort.getPortGroup()));
            if (tmpPort.getStorageDevice().equals(system.getId()) && tmpPort.getPortGroup().equals(spIdStr)) {
                port = tmpPort;
                _logger.debug("found duplicate fc port {}", fcPort.getWwn());
            }
        }
        // port
        if (port == null) {
            port = new StoragePort();
            port.setId(URIUtil.createId(StoragePort.class));
            port.setLabel(portNativeGuid);
            port.setTransportType("FC");
            port.setNativeGuid(portNativeGuid);
            port.setStorageDevice(system.getId());
            port.setRegistrationStatus(RegistrationStatus.REGISTERED.toString());
            port.setPortName(fcPort.getId());
            port.setPortNetworkId(fcPort.getPortWwn());
            port.setPortGroup(spIdStr);
            port.setStorageHADomain(haDomainUri);
            _logger.info("Creating new storage port using NativeGuid : {}, WWN:", portNativeGuid, fcPort.getWwn());
            newStoragePorts.add(port);
        } else {
            existingStoragePorts.add(port);
        }
        Health portHealth = fcPort.getHealth();
        if (portHealth != null) {
            int healthValue = portHealth.getValue();
            if (healthValue == Health.HealthEnum.OK.getValue()) {
                port.setOperationalStatus(StoragePort.OperationalStatus.OK.name());
            } else {
                port.setOperationalStatus(StoragePort.OperationalStatus.NOT_OK.name());
            }
        }
        port.setDiscoveryStatus(DiscoveryStatus.VISIBLE.name());
        port.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
    }
    _logger.info("FC port discovery for storage system {} complete", system.getId());
    storagePorts.put(NEW, newStoragePorts);
    storagePorts.put(EXISTING, existingStoragePorts);
    return storagePorts;
}
Also used : HashMap(java.util.HashMap) Health(com.emc.storageos.vnxe.models.Health) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) VNXeFCPort(com.emc.storageos.vnxe.models.VNXeFCPort) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 70 with VNXeBase

use of com.emc.storageos.vnxe.models.VNXeBase in project coprhd-controller by CoprHD.

the class HostInitiatorTest method createHostInititaor.

// @Test
public void createHostInititaor() {
    String hostId = "Host_1";
    String wwn = "20:00:00:25:b5:5d:00:04:20:00:00:25:b5:5d:00:e5";
    HostInitiatorCreateParam initCreateParam = new HostInitiatorCreateParam();
    VNXeBase host = new VNXeBase(hostId);
    initCreateParam.setHost(host);
    initCreateParam.setInitiatorType(HostInitiatorTypeEnum.INITIATOR_TYPE_FC.getValue());
    initCreateParam.setInitiatorWWNorIqn(wwn);
    HostInitiatorRequest req = new HostInitiatorRequest(_client);
    req.createHostInitiator(initCreateParam);
}
Also used : VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) HostInitiatorCreateParam(com.emc.storageos.vnxe.models.HostInitiatorCreateParam)

Aggregations

VNXeBase (com.emc.storageos.vnxe.models.VNXeBase)71 ArrayList (java.util.ArrayList)39 URI (java.net.URI)17 HashMap (java.util.HashMap)14 LunGroupModifyParam (com.emc.storageos.vnxe.models.LunGroupModifyParam)13 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)12 VNXeHostInitiator (com.emc.storageos.vnxe.models.VNXeHostInitiator)11 HashSet (java.util.HashSet)11 List (java.util.List)11 StoragePort (com.emc.storageos.db.client.model.StoragePort)9 VNXeException (com.emc.storageos.vnxe.VNXeException)9 VNXeCommandJob (com.emc.storageos.vnxe.models.VNXeCommandJob)9 ConsistencyGroupRequests (com.emc.storageos.vnxe.requests.ConsistencyGroupRequests)9 LunGroupRequests (com.emc.storageos.vnxe.requests.LunGroupRequests)9 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)8 BlockHostAccess (com.emc.storageos.vnxe.models.BlockHostAccess)8 LunParam (com.emc.storageos.vnxe.models.LunParam)8 ModifyFileSystemParam (com.emc.storageos.vnxe.models.ModifyFileSystemParam)8 Initiator (com.emc.storageos.db.client.model.Initiator)7 VNXeHost (com.emc.storageos.vnxe.models.VNXeHost)7