Search in sources :

Example 81 with NamedRelatedResourceRep

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;
}
Also used : ObjectVirtualPoolBuilder(util.builders.ObjectVirtualPoolBuilder) ObjectVirtualPoolUpdateBuilder(util.builders.ObjectVirtualPoolUpdateBuilder) ObjectVirtualPoolRestRep(com.emc.storageos.model.vpool.ObjectVirtualPoolRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 82 with NamedRelatedResourceRep

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());
    }
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 83 with NamedRelatedResourceRep

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;
}
Also used : ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 84 with NamedRelatedResourceRep

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;
}
Also used : ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 85 with NamedRelatedResourceRep

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;
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) ComputeElement(com.emc.storageos.db.client.model.ComputeElement) UnManagedExportMaskList(com.emc.storageos.model.block.UnManagedExportMaskList) UnManagedVolumeList(com.emc.storageos.model.block.UnManagedVolumeList) NamedElementQueryResultList(com.emc.storageos.db.client.constraint.NamedElementQueryResultList) InitiatorList(com.emc.storageos.model.host.InitiatorList) ArrayList(java.util.ArrayList) TaskList(com.emc.storageos.model.TaskList) MountInfoList(com.emc.storageos.model.file.MountInfoList) HostList(com.emc.storageos.model.host.HostList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) List(java.util.List) BulkList(com.emc.storageos.api.service.impl.response.BulkList) LinkedList(java.util.LinkedList) IpInterfaceList(com.emc.storageos.model.host.IpInterfaceList) HostList(com.emc.storageos.model.host.HostList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Aggregations

NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)111 URI (java.net.URI)47 ArrayList (java.util.ArrayList)28 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)22 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)18 Asset (com.emc.sa.asset.annotation.Asset)11 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)11 AssetOption (com.emc.vipr.model.catalog.AssetOption)9 HashMap (java.util.HashMap)8 GET (javax.ws.rs.GET)8 Produces (javax.ws.rs.Produces)8 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)7 Path (javax.ws.rs.Path)7 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)6 NamedURI (com.emc.storageos.db.client.model.NamedURI)5 SnapshotList (com.emc.storageos.model.SnapshotList)5 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)5 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)5 HashSet (java.util.HashSet)5 List (java.util.List)5