use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class ObjectVirtualPoolForm method doSave.
protected ObjectVirtualPoolRestRep doSave() {
ObjectVirtualPoolRestRep virtualPool;
if (isNew()) {
ObjectVirtualPoolBuilder builder = apply(new ObjectVirtualPoolBuilder());
virtualPool = VirtualPoolUtils.create(builder.getVirtualPool());
this.id = ResourceUtils.stringId(virtualPool);
} else {
ObjectVirtualPoolRestRep oldVirtualPool = VirtualPoolUtils.getObjectVirtualPool(id);
ObjectVirtualPoolUpdateBuilder builder = apply(new ObjectVirtualPoolUpdateBuilder(oldVirtualPool));
virtualPool = VirtualPoolUtils.update(id, builder.getVirtualPoolUpdate());
List<NamedRelatedResourceRep> matchingPools = VirtualPoolUtils.refreshMatchingPools(virtualPool);
Logger.info("Refreshed File Virtual Pool '%s' matching pools: %d", virtualPool.getName(), matchingPools.size());
}
virtualPool = saveStoragePools(virtualPool);
return virtualPool;
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class ApiTestVcenter method deleteTasks.
private void deleteTasks(TasksList tasks) throws NoSuchAlgorithmException {
if (CollectionUtils.isEmpty(tasks.getTasks())) {
return;
}
Iterator<NamedRelatedResourceRep> tasksIterator = tasks.getTasks().iterator();
BalancedWebResource user = loginUser(getSystemAdminWithDomain());
while (tasksIterator.hasNext()) {
NamedRelatedResourceRep task = tasksIterator.next();
if (task == null) {
continue;
}
URI taskId = task.getId();
ClientResponse clientResponse = user.path(getVdcTaskDeleteApi(taskId)).post(ClientResponse.class);
Assert.assertEquals(HttpStatus.SC_OK, clientResponse.getStatus());
}
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class ApiTestVcenter method getDataCenterIdsFromVcenterDataCenterList.
private List<URI> getDataCenterIdsFromVcenterDataCenterList(VcenterDataCenterList dataCenterList) {
List<URI> dataCenterUris = new ArrayList<URI>();
if (dataCenterList == null || CollectionUtils.isEmpty(dataCenterList.getDataCenters())) {
return dataCenterUris;
}
Iterator<NamedRelatedResourceRep> vcentersIterator = dataCenterList.getDataCenters().iterator();
while (vcentersIterator.hasNext()) {
NamedRelatedResourceRep dataCenter = vcentersIterator.next();
dataCenterUris.add(dataCenter.getId());
}
return dataCenterUris;
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class ApiTestVcenter method getHostIdsFromHostList.
private List<URI> getHostIdsFromHostList(HostList hostList) {
List<URI> hostUris = new ArrayList<URI>();
if (hostList == null || CollectionUtils.isEmpty(hostList.getHosts())) {
return hostUris;
}
Iterator<NamedRelatedResourceRep> vcentersIterator = hostList.getHosts().iterator();
while (vcentersIterator.hasNext()) {
NamedRelatedResourceRep host = vcentersIterator.next();
hostUris.add(host.getId());
}
return hostUris;
}
use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.
the class HostService method findComputeElementsUsedInCluster.
private Map<URI, List<ComputeElement>> findComputeElementsUsedInCluster(URI clusterId) throws DatabaseException {
Map<URI, List<ComputeElement>> computeSystemToComputeElementMap = new HashMap<URI, List<ComputeElement>>();
HostList hostList = clusterService.getClusterHosts(clusterId);
List<NamedRelatedResourceRep> list = hostList.getHosts();
for (NamedRelatedResourceRep hostRep : list) {
HostRestRep host = getHost(hostRep.getId());
RelatedResourceRep computeElement = host.getComputeElement();
if (computeElement == null) {
// this can happen if cluster has hosts that were not provisioned by vipr
continue;
}
ComputeElement ce = _dbClient.queryObject(ComputeElement.class, computeElement.getId());
URI computeSystem = ce.getComputeSystem();
List<ComputeElement> usedComputeElements;
if (computeSystemToComputeElementMap.containsKey(computeSystem)) {
usedComputeElements = computeSystemToComputeElementMap.get(computeSystem);
} else {
usedComputeElements = new ArrayList<ComputeElement>();
}
usedComputeElements.add(ce);
computeSystemToComputeElementMap.put(computeSystem, usedComputeElements);
}
return computeSystemToComputeElementMap;
}
Aggregations