Search in sources :

Example 16 with NamedVolumesList

use of com.emc.storageos.model.block.NamedVolumesList in project coprhd-controller by CoprHD.

the class VolumeGroupService method getVolumes.

/**
 * Get application volumes
 *
 * @param id Application Id
 * @brief List volumes for an application
 * @return NamedVolumesList
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/volumes")
public NamedVolumesList getVolumes(@PathParam("id") URI id) {
    ArgValidator.checkFieldUriType(id, VolumeGroup.class, "id");
    VolumeGroup volumeGroup = (VolumeGroup) queryResource(id);
    NamedVolumesList result = new NamedVolumesList();
    List<Volume> volumes = ControllerUtils.getVolumeGroupVolumes(_dbClient, volumeGroup);
    for (Volume volume : volumes) {
        result.getVolumes().add(toNamedRelatedResource(volume));
    }
    return result;
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) VolumeGroup(com.emc.storageos.db.client.model.VolumeGroup) NamedVolumesList(com.emc.storageos.model.block.NamedVolumesList) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 17 with NamedVolumesList

use of com.emc.storageos.model.block.NamedVolumesList in project coprhd-controller by CoprHD.

the class BlockFullCopyManager method getFullCopiesForSource.

/**
 * Returns the full copies for the source volume with the passed URI.
 *
 * @param sourceVolumeURI The URI of the full copy source volume.
 *
 * @return NamedVolumesList
 */
public NamedVolumesList getFullCopiesForSource(URI sourceVolumeURI) {
    NamedVolumesList fullCopyList = new NamedVolumesList();
    ArgValidator.checkFieldUriType(sourceVolumeURI, Volume.class, "id");
    Volume sourceVolume = _dbClient.queryObject(Volume.class, sourceVolumeURI);
    StringSet fullCopyIds = sourceVolume.getFullCopies();
    if (fullCopyIds == null || fullCopyIds.isEmpty()) {
        return fullCopyList;
    }
    for (String fullCopyId : fullCopyIds) {
        Volume fullCopyVolume = _dbClient.queryObject(Volume.class, URI.create(fullCopyId));
        if (fullCopyVolume == null || fullCopyVolume.getInactive()) {
            s_logger.warn("Stale full copy {} found for volume {}", fullCopyId, sourceVolumeURI);
            continue;
        }
        fullCopyList.getVolumes().add(DbObjectMapper.toNamedRelatedResource(fullCopyVolume));
    }
    return fullCopyList;
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) StringSet(com.emc.storageos.db.client.model.StringSet) NamedVolumesList(com.emc.storageos.model.block.NamedVolumesList)

Aggregations

NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)17 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)7 Volume (com.emc.storageos.db.client.model.Volume)6 URI (java.net.URI)6 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)5 Path (javax.ws.rs.Path)5 Produces (javax.ws.rs.Produces)5 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)4 GET (javax.ws.rs.GET)4 VolumeGroup (com.emc.storageos.db.client.model.VolumeGroup)3 VolumeGroupCopySetParam (com.emc.storageos.model.application.VolumeGroupCopySetParam)3 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)3 HashSet (java.util.HashSet)3 Asset (com.emc.sa.asset.annotation.Asset)2 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)2 SOURCE_TO_TARGET (com.emc.storageos.model.block.Copy.SyncDirection.SOURCE_TO_TARGET)2 CreateCloneOfApplication (com.emc.sa.service.vipr.application.tasks.CreateCloneOfApplication)1 CreateSnapshotForApplication (com.emc.sa.service.vipr.application.tasks.CreateSnapshotForApplication)1 WaitForTasks (com.emc.sa.service.vipr.tasks.WaitForTasks)1 MapVolume (com.emc.storageos.api.mapper.functions.MapVolume)1