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;
}
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);
}
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;
}
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;
}
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);
}
Aggregations