Search in sources :

Example 51 with ComputeElement

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

the class ComputeVirtualPoolService method getURIs.

private List<URI> getURIs(Collection<ComputeElement> elements) throws APIException {
    List<URI> uriList = new ArrayList<URI>();
    if (elements == null || elements.isEmpty()) {
        return uriList;
    }
    for (ComputeElement element : elements) {
        URI uri = element.getId();
        uriList.add(uri);
    }
    return uriList;
}
Also used : ComputeElement(com.emc.storageos.db.client.model.ComputeElement) ArrayList(java.util.ArrayList) URI(java.net.URI)

Example 52 with ComputeElement

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

the class ComputeVirtualPoolService method removeHostToCVPRelation.

private void removeHostToCVPRelation(Collection<ComputeElement> removeElements, ComputeVirtualPool cvp) {
    List<Host> updatedHosts = Lists.newArrayList();
    for (ComputeElement computeElement : removeElements) {
        List<Host> hosts = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, Host.class, ContainmentConstraint.Factory.getContainedObjectsConstraint(computeElement.getId(), Host.class, "computeElement"));
        for (Host host : hosts) {
            if (!NullColumnValueGetter.isNullURI(host.getComputeVirtualPoolId()) && host.getComputeVirtualPoolId().equals(cvp.getId())) {
                host.setComputeVirtualPoolId(NullColumnValueGetter.getNullURI());
                updatedHosts.add(host);
            }
        }
    }
    if (CollectionUtils.isNotEmpty(updatedHosts)) {
        _dbClient.updateObject(updatedHosts);
    }
}
Also used : ComputeElement(com.emc.storageos.db.client.model.ComputeElement) Host(com.emc.storageos.db.client.model.Host)

Aggregations

ComputeElement (com.emc.storageos.db.client.model.ComputeElement)52 Host (com.emc.storageos.db.client.model.Host)24 URI (java.net.URI)20 ComputeSystem (com.emc.storageos.db.client.model.ComputeSystem)15 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)12 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)11 ClientGeneralException (com.emc.cloud.platform.clientlib.ClientGeneralException)10 ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)10 LsServer (com.emc.cloud.platform.ucs.out.model.LsServer)9 MalformedURLException (java.net.MalformedURLException)9 Produces (javax.ws.rs.Produces)9 ComputeSystemControllerTimeoutException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerTimeoutException)8 HashMap (java.util.HashMap)8 Path (javax.ws.rs.Path)8 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)7 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)7 ComputeVirtualPool (com.emc.storageos.db.client.model.ComputeVirtualPool)6 UCSServiceProfile (com.emc.storageos.db.client.model.UCSServiceProfile)6 UCSServiceProfileTemplate (com.emc.storageos.db.client.model.UCSServiceProfileTemplate)6 Cluster (com.emc.storageos.db.client.model.Cluster)4