Search in sources :

Example 76 with Host

use of com.emc.storageos.db.client.model.Host in project coprhd-controller by CoprHD.

the class ExportMaskPlacementDescriptorTest method mockHost.

private Host mockHost(String label) {
    Host host = new Host();
    host.setId(mockURI("Host"));
    host.setLabel(label);
    host.setHostName(label);
    return host;
}
Also used : Host(com.emc.storageos.db.client.model.Host)

Example 77 with Host

use of com.emc.storageos.db.client.model.Host in project coprhd-controller by CoprHD.

the class ExportMaskPlacementDescriptorTest method createDescriptor.

private ExportMaskPlacementDescriptor createDescriptor(int numInitiators, int numVolumes) {
    URI tenant = mockURI("TenantOrg");
    URI project = mockURI("Project");
    URI virtualArray = mockURI("VirtualArray");
    Host host = mockHost("host.somewhere.com");
    StorageSystem vplex = mockStorageSystem("vplex");
    StorageSystem array = mockStorageSystem("backend-array");
    Set<Initiator> initiators = mockSetOfInitiators(host, numInitiators);
    Map<URI, Volume> volumes = mockSetOfVolumes(array, numVolumes);
    return ExportMaskPlacementDescriptor.create(tenant, project, vplex, array, virtualArray, volumes, initiators);
}
Also used : Initiator(com.emc.storageos.db.client.model.Initiator) Volume(com.emc.storageos.db.client.model.Volume) Host(com.emc.storageos.db.client.model.Host) URI(java.net.URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 78 with Host

use of com.emc.storageos.db.client.model.Host in project coprhd-controller by CoprHD.

the class StoragePortsAssignerTest method getHostInitiators.

/**
 * Returns initiators in a single host.
 *
 * @param numberInitiators -- number of initiators
 * @return List<Initiator>
 */
private static List<Initiator> getHostInitiators(int numberInitiators) {
    Host host = new Host();
    host.setHostName("host" + hostIndex++);
    host.setId(URI.create(host.getHostName()));
    List<Initiator> initiators = new ArrayList<Initiator>();
    for (int i = 0; i < numberInitiators; i++) {
        Initiator initiator = new Initiator();
        initiator.setHost(host.getId());
        initiator.setHostName(host.getHostName());
        String byte1 = String.format("%02x", initIndex / 256);
        String byte0 = String.format("%02x", initIndex % 256);
        initiator.setInitiatorPort("10:00:00:00:00:00:" + byte1 + ":" + byte0);
        initiator.setId(URI.create("init" + initIndex++));
        initiators.add(initiator);
    }
    return initiators;
}
Also used : Initiator(com.emc.storageos.db.client.model.Initiator) ArrayList(java.util.ArrayList) Host(com.emc.storageos.db.client.model.Host)

Example 79 with Host

use of com.emc.storageos.db.client.model.Host in project coprhd-controller by CoprHD.

the class VmaxExportOperations method queryClusterInitiators.

/**
 * This function is to retrieve the initiators of the given host id (uri)
 *
 * @param hostId
 *            - host uri
 * @return a list of initiator port transform name
 */
private List<String> queryClusterInitiators(URI hostId) {
    List<String> initiatorNames = new ArrayList<String>();
    Host host = _dbClient.queryObject(Host.class, hostId);
    if (host == null) {
        return initiatorNames;
    }
    if (host.getCluster() == null) {
        return initiatorNames;
    }
    List<URI> hostUris = ComputeSystemHelper.getChildrenUris(_dbClient, host.getCluster(), Host.class, "cluster");
    for (URI hosturi : hostUris) {
        initiatorNames.addAll(queryHostInitiators(hosturi));
    }
    return initiatorNames;
}
Also used : ArrayList(java.util.ArrayList) Host(com.emc.storageos.db.client.model.Host) URI(java.net.URI)

Example 80 with Host

use of com.emc.storageos.db.client.model.Host in project coprhd-controller by CoprHD.

the class VmaxExportOperations method validateInitiatorHostOS.

/*
     * This private method ensures that the OS of the host to which the initiators belong are
     * of the same type..The API SVC would have checked for this; however we are ensuring that
     * callers of this method directly..RP? adhere.
     */
private boolean validateInitiatorHostOS(List<Initiator> initiatorList) {
    Set<String> hostTypes = new HashSet<String>();
    for (Initiator ini : initiatorList) {
        URI hostURI = ini.getHost();
        if (hostURI == null) {
            hostTypes.add(Host.HostType.Other.name());
        } else {
            Host host = _dbClient.queryObject(Host.class, hostURI);
            hostTypes.add(host.getType());
        }
    }
    return (hostTypes.size() == 1);
}
Also used : Initiator(com.emc.storageos.db.client.model.Initiator) Host(com.emc.storageos.db.client.model.Host) URI(java.net.URI) Sets.newHashSet(com.google.common.collect.Sets.newHashSet) HashSet(java.util.HashSet)

Aggregations

Host (com.emc.storageos.db.client.model.Host)227 URI (java.net.URI)104 Initiator (com.emc.storageos.db.client.model.Initiator)52 ArrayList (java.util.ArrayList)49 HashMap (java.util.HashMap)38 Cluster (com.emc.storageos.db.client.model.Cluster)37 HashSet (java.util.HashSet)35 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)33 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)32 VcenterDataCenter (com.emc.storageos.db.client.model.VcenterDataCenter)26 ComputeElement (com.emc.storageos.db.client.model.ComputeElement)24 Volume (com.emc.storageos.db.client.model.Volume)20 Path (javax.ws.rs.Path)20 Produces (javax.ws.rs.Produces)20 Vcenter (com.emc.storageos.db.client.model.Vcenter)19 ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)18 ExportMask (com.emc.storageos.db.client.model.ExportMask)18 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)17 NamedURI (com.emc.storageos.db.client.model.NamedURI)16 StringSet (com.emc.storageos.db.client.model.StringSet)16