Search in sources :

Example 46 with VolumeGroup

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

the class VolumeGroupService method performVolumeGroupSnapshotSessionOperation.

/*
     * Wrapper of BlockConsistencyGroupService methods for snapshot session operations
     * 
     * @param volumeGroupId
     * 
     * @param param
     * 
     * @return a TaskList
     */
private TaskList performVolumeGroupSnapshotSessionOperation(final URI volumeGroupId, final VolumeGroupSnapshotSessionOperationParam param, OperationTypeEnum opType) {
    List<BlockSnapshotSession> snapSessions = getSnapshotSessionsGroupedBySnapSessionset(volumeGroupId, param);
    // Check for pending tasks
    VolumeGroup volumeGroup = _dbClient.queryObject(VolumeGroup.class, volumeGroupId);
    if (opType == OperationTypeEnum.RESTORE_VOLUME_GROUP_SNAPSHOT_SESSION) {
        checkForApplicationPendingTasks(volumeGroup, _dbClient, true);
    } else {
        checkForApplicationPendingTasks(volumeGroup, _dbClient, false);
    }
    auditOp(opType, true, AuditLogManager.AUDITOP_BEGIN, volumeGroupId.toString(), param.getSnapshotSessions());
    TaskList taskList = new TaskList();
    Table<URI, String, BlockSnapshotSession> storageRgToSnapshot = ControllerUtils.getSnapshotSessionForStorageReplicationGroup(snapSessions, _dbClient);
    for (Cell<URI, String, BlockSnapshotSession> cell : storageRgToSnapshot.cellSet()) {
        BlockSnapshotSession session = cell.getValue();
        log.info("{} for replication group {}", opType.getDescription(), cell.getColumnKey());
        ResourceOperationTypeEnum oprEnum = null;
        try {
            // should not be null
            URI cgUri = session.getConsistencyGroup();
            URI sessionUri = session.getId();
            log.info("CG: {}, Session: {}", cgUri, session.getLabel());
            switch(opType) {
                case RESTORE_VOLUME_GROUP_SNAPSHOT_SESSION:
                    oprEnum = ResourceOperationTypeEnum.RESTORE_SNAPSHOT_SESSION;
                    taskList.addTask(_blockConsistencyGroupService.restoreConsistencyGroupSnapshotSession(cgUri, sessionUri));
                    break;
                case DELETE_VOLUME_GROUP_SNAPSHOT_SESSION:
                    oprEnum = ResourceOperationTypeEnum.DELETE_CONSISTENCY_GROUP_SNAPSHOT_SESSION;
                    taskList.getTaskList().addAll(_blockConsistencyGroupService.deactivateConsistencyGroupSnapshotSession(cgUri, sessionUri).getTaskList());
                    break;
                case LINK_VOLUME_GROUP_SNAPSHOT_SESSION_TARGET:
                    oprEnum = ResourceOperationTypeEnum.LINK_SNAPSHOT_SESSION_TARGETS;
                    SnapshotSessionLinkTargetsParam linkParam = new SnapshotSessionLinkTargetsParam(((VolumeGroupSnapshotSessionLinkTargetsParam) param).getNewLinkedTargets());
                    taskList.getTaskList().addAll(_blockConsistencyGroupService.linkTargetVolumes(cgUri, sessionUri, linkParam).getTaskList());
                    break;
                case RELINK_VOLUME_GROUP_SNAPSHOT_SESSION_TARGET:
                    oprEnum = ResourceOperationTypeEnum.RELINK_CONSISTENCY_GROUP_SNAPSHOT_SESSION_TARGETS;
                    SnapshotSessionRelinkTargetsParam relinkParam = new SnapshotSessionRelinkTargetsParam(getRelinkTargetIdsForSession((VolumeGroupSnapshotSessionRelinkTargetsParam) param, session, snapSessions.size()));
                    taskList.getTaskList().addAll(_blockConsistencyGroupService.relinkTargetVolumes(cgUri, sessionUri, relinkParam).getTaskList());
                    break;
                case UNLINK_VOLUME_GROUP_SNAPSHOT_SESSION_TARGET:
                    oprEnum = ResourceOperationTypeEnum.UNLINK_SNAPSHOT_SESSION_TARGETS;
                    SnapshotSessionUnlinkTargetsParam unlinkParam = new SnapshotSessionUnlinkTargetsParam(getUnlinkTargetIdsForSession((VolumeGroupSnapshotSessionUnlinkTargetsParam) param, session));
                    taskList.addTask(_blockConsistencyGroupService.unlinkTargetVolumesForSession(cgUri, sessionUri, unlinkParam));
                    break;
                default:
                    log.error("Unsupported operation {}", opType.getDescription());
                    break;
            }
        } catch (InternalException | APIException e) {
            String errMsg = String.format("Exception occurred while performing %s on Replication group %s", opType.getDescription(), cell.getColumnKey());
            log.error(errMsg, e);
            TaskResourceRep task = BlockServiceUtils.createFailedTaskOnSnapshotSession(_dbClient, session, oprEnum, e);
            taskList.addTask(task);
        } catch (Exception ex) {
            String errMsg = String.format("Unexpected Exception occurred while performing %s on Replication group %s", opType.getDescription(), cell.getColumnKey());
            log.error(errMsg, ex);
        }
    }
    auditOp(opType, true, AuditLogManager.AUDITOP_END, volumeGroupId.toString(), param.getSnapshotSessions());
    return taskList;
}
Also used : BlockSnapshotSession(com.emc.storageos.db.client.model.BlockSnapshotSession) TaskList(com.emc.storageos.model.TaskList) TaskResourceRep(com.emc.storageos.model.TaskResourceRep) VolumeGroupSnapshotSessionUnlinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionUnlinkTargetsParam) URI(java.net.URI) NullColumnValueGetter.isNullURI(com.emc.storageos.db.client.util.NullColumnValueGetter.isNullURI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) SnapshotSessionLinkTargetsParam(com.emc.storageos.model.block.SnapshotSessionLinkTargetsParam) VolumeGroupSnapshotSessionLinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionLinkTargetsParam) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) VolumeGroup(com.emc.storageos.db.client.model.VolumeGroup) VolumeGroupSnapshotSessionRelinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionRelinkTargetsParam) SnapshotSessionRelinkTargetsParam(com.emc.storageos.model.block.SnapshotSessionRelinkTargetsParam) VolumeGroupSnapshotSessionRelinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionRelinkTargetsParam) ResourceOperationTypeEnum(com.emc.storageos.model.ResourceOperationTypeEnum) SnapshotSessionUnlinkTargetsParam(com.emc.storageos.model.block.SnapshotSessionUnlinkTargetsParam) VolumeGroupSnapshotSessionUnlinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionUnlinkTargetsParam)

Example 47 with VolumeGroup

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

the class VolumeGroupService method getSnapshotsGroupedBySnapset.

/**
 * Validate resources and group snapshots by snapsetLabel
 *
 * If partial, group snapshots in VolumeGroupSnapshotOperationParam by snapsetLabel
 * If full, find all the snapshots for each snapsetLabel that the snapshots in the param belong to
 *
 * @param volumeGroupId
 * @param param
 * @return map snapsetLabel to snapshots
 */
private Map<String, List<BlockSnapshot>> getSnapshotsGroupedBySnapset(final URI volumeGroupId, VolumeGroupSnapshotOperationParam param) {
    // Query volume group
    final VolumeGroup volumeGroup = (VolumeGroup) queryResource(volumeGroupId);
    // validate replica operation for volume group
    validateCopyOperationForVolumeGroup(volumeGroup, ReplicaTypeEnum.SNAPSHOT);
    List<URI> snapshotsInRequest = new ArrayList<URI>();
    boolean partialRequest = false;
    if (param.getSnapshots() != null && !param.getSnapshots().isEmpty()) {
        // validate only one snapshot URI is provided for full request
        if (!param.getPartial() && param.getSnapshots().size() > 1) {
            throw APIException.badRequests.invalidNumberOfReplicas(ReplicaTypeEnum.SNAPSHOT.toString());
        }
        snapshotsInRequest.addAll(param.getSnapshots());
        partialRequest = param.getPartial();
    } else {
        ArgValidator.checkFieldNotEmpty(param.getCopySetName(), COPY_SET_NAME_FIELD);
        if (param.getSubGroups() != null && !param.getSubGroups().isEmpty()) {
            partialRequest = validateSubGroupsParam(param.getSubGroups(), volumeGroup);
        }
        URIQueryResultList snapshotIds = new URIQueryResultList();
        _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getBlockSnapshotsBySnapsetLabel(param.getCopySetName()), snapshotIds);
        Iterator<BlockSnapshot> iter = _dbClient.queryIterativeObjects(BlockSnapshot.class, snapshotIds);
        if (partialRequest) {
            // get one snapshot per sub group requested
            List<Volume> volumesInApplication = ControllerUtils.getVolumeGroupVolumes(_dbClient, volumeGroup);
            Map<URI, Volume> volumesMap = new HashMap<URI, Volume>();
            for (Volume volume : volumesInApplication) {
                if (volume.getAssociatedVolumes() != null) {
                    List<URI> assocVolIds = new ArrayList<URI>();
                    for (String s : volume.getAssociatedVolumes()) {
                        assocVolIds.add(URI.create(s));
                    }
                    List<Volume> assocVols = _dbClient.queryObject(Volume.class, assocVolIds);
                    for (Volume assocVol : assocVols) {
                        volumesMap.put(assocVol.getId(), assocVol);
                    }
                } else {
                    volumesMap.put(volume.getId(), volume);
                }
            }
            while (iter.hasNext()) {
                BlockSnapshot snapshot = iter.next();
                Volume parent = volumesMap.get(snapshot.getParent().getURI());
                if (parent != null && param.getSubGroups().contains(parent.getReplicationGroupInstance())) {
                    snapshotsInRequest.add(snapshot.getId());
                }
            }
        } else {
            // for non-partial, we only need one snapshot per sub group
            Map<String, List<URI>> subGroupSnapshotMap = new HashMap<String, List<URI>>();
            while (iter.hasNext()) {
                BlockSnapshot snapshot = iter.next();
                if (NullColumnValueGetter.isNotNullValue(snapshot.getReplicationGroupInstance())) {
                    if (subGroupSnapshotMap.get(snapshot.getReplicationGroupInstance()) == null) {
                        subGroupSnapshotMap.put(snapshot.getReplicationGroupInstance(), new ArrayList<URI>());
                    }
                    subGroupSnapshotMap.get(snapshot.getReplicationGroupInstance()).add(snapshot.getId());
                }
            }
            for (Entry<String, List<URI>> entry : subGroupSnapshotMap.entrySet()) {
                snapshotsInRequest.add(entry.getValue().get(0));
            }
        }
    }
    Map<String, List<BlockSnapshot>> snapsetToSnapshots = new HashMap<String, List<BlockSnapshot>>();
    for (URI snapshotURI : snapshotsInRequest) {
        ArgValidator.checkFieldUriType(snapshotURI, BlockSnapshot.class, SNAPSHOT_FIELD);
        // Get the snapshot
        BlockSnapshot snapshot = BlockServiceUtils.querySnapshotResource(snapshotURI, uriInfo, _dbClient);
        if (NullColumnValueGetter.isNullValue(snapshot.getReplicationGroupInstance())) {
            throw APIException.badRequests.noReplicationGroupForReplica(snapshot.getLabel());
        }
        // validate that source of the provided snapshot is part of the volume group
        if (!ControllerUtils.isSourceInVoumeGroup(snapshot, volumeGroupId, _dbClient)) {
            throw APIException.badRequests.replicaOperationNotAllowedSourceNotInVolumeGroup(ReplicaTypeEnum.SNAPSHOT.toString(), snapshot.getLabel());
        }
        String snapsetLabel = snapshot.getSnapsetLabel();
        List<BlockSnapshot> snapshots = snapsetToSnapshots.get(snapsetLabel);
        if (snapshots == null) {
            if (partialRequest) {
                snapshots = new ArrayList<BlockSnapshot>();
                snapshots.add(snapshot);
            } else {
                snapshots = ControllerUtils.getVolumeGroupSnapshots(volumeGroup.getId(), snapsetLabel, _dbClient);
            }
            snapsetToSnapshots.put(snapsetLabel, snapshots);
        } else if (partialRequest) {
            snapshots.add(snapshot);
        }
    }
    return snapsetToSnapshots;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) URI(java.net.URI) NullColumnValueGetter.isNullURI(com.emc.storageos.db.client.util.NullColumnValueGetter.isNullURI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) Volume(com.emc.storageos.db.client.model.Volume) VolumeGroup(com.emc.storageos.db.client.model.VolumeGroup) BlockSnapshotSessionList(com.emc.storageos.model.block.BlockSnapshotSessionList) ArrayList(java.util.ArrayList) TaskList(com.emc.storageos.model.TaskList) NamedVolumeGroupsList(com.emc.storageos.model.block.NamedVolumeGroupsList) HostList(com.emc.storageos.model.host.HostList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) ClusterList(com.emc.storageos.model.host.cluster.ClusterList) VolumeGroupList(com.emc.storageos.model.application.VolumeGroupList) List(java.util.List) NamedVolumesList(com.emc.storageos.model.block.NamedVolumesList) VolumeGroupCopySetList(com.emc.storageos.model.application.VolumeGroupCopySetList) SnapshotList(com.emc.storageos.model.SnapshotList)

Example 48 with VolumeGroup

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

the class VolumeGroupService method createVolumeGroupFullCopy.

/**
 * Creates a volume group full copy
 * - Creates full copy for all the array replication groups within this Application.
 * - If partial flag is specified, it creates full copy only for set of array replication groups.
 * A Volume from each array replication group can be provided to indicate which array replication
 * groups are required to take full copy.
 *
 * @prereq none
 *
 * @param volumeGroupId the URI of the Volume Group
 *            - Volume group URI
 * @param param VolumeGroupFullCopyCreateParam
 *
 * @brief Create volume group fullcopy
 * @return TaskList
 */
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/protection/full-copies")
@CheckPermission(roles = { Role.SYSTEM_ADMIN }, acls = { ACL.ANY })
public TaskList createVolumeGroupFullCopy(@PathParam("id") final URI volumeGroupId, VolumeGroupFullCopyCreateParam param) {
    ArgValidator.checkFieldUriType(volumeGroupId, VolumeGroup.class, "id");
    // Query Volume Group
    final VolumeGroup volumeGroup = (VolumeGroup) queryResource(volumeGroupId);
    ArgValidator.checkEntityNotNull(volumeGroup, volumeGroupId, isIdEmbeddedInURL(volumeGroupId));
    // validate replica operation for volume group
    validateCopyOperationForVolumeGroup(volumeGroup, ReplicaTypeEnum.FULL_COPY);
    TaskList taskList = new TaskList();
    // get all volumes
    List<Volume> volumes = ControllerUtils.getVolumeGroupVolumes(_dbClient, volumeGroup);
    // validate that there should be some volumes in VolumeGroup
    if (volumes.isEmpty()) {
        throw APIException.badRequests.replicaOperationNotAllowedOnEmptyVolumeGroup(volumeGroup.getLabel(), ReplicaTypeEnum.FULL_COPY.toString());
    }
    List<URI> partialVolumeList = new ArrayList<URI>();
    boolean partial = isPartialRequest(param, volumeGroup, partialVolumeList);
    if (partial) {
        log.info("Full Copy requested for subset of array groups in Application.");
        // validate that at least one volume URI is provided
        ArgValidator.checkFieldNotEmpty(partialVolumeList, "volumes");
        // validate that provided volumes
        Set<String> arrayGroupNames = new HashSet<String>();
        List<Volume> volumesInRequest = new ArrayList<Volume>();
        for (URI volumeURI : partialVolumeList) {
            ArgValidator.checkFieldUriType(volumeURI, Volume.class, "volume");
            // Get the Volume.
            Volume volume = (Volume) BlockFullCopyUtils.queryFullCopyResource(volumeURI, uriInfo, true, _dbClient);
            String arrayGroupName = volume.getReplicationGroupInstance();
            if (volume.isVPlexVolume(_dbClient)) {
                // get backend source volume to get RG name
                Volume backedVol = VPlexUtil.getVPLEXBackendVolume(volume, true, _dbClient);
                if (backedVol != null) {
                    arrayGroupName = backedVol.getReplicationGroupInstance();
                }
            }
            // this shouldn't happen, but just in case, skip if replicationGroupInstance is null
            if (NullColumnValueGetter.isNullValue(arrayGroupName)) {
                log.info("Skipping volume {} because replicationGroupInstance is null", volume.getLabel());
                continue;
            }
            // skip repeated array groups
            if (arrayGroupNames.contains(arrayGroupName)) {
                log.info("Skipping repetitive request for Volume array group {}. Volume: {}", arrayGroupName, volume.getLabel());
                continue;
            }
            arrayGroupNames.add(arrayGroupName);
            // validate that provided volumes are part of Volume Group
            if (!volume.getVolumeGroupIds().contains(volumeGroupId.toString())) {
                throw APIException.badRequests.replicaOperationNotAllowedVolumeNotInVolumeGroup(ReplicaTypeEnum.FULL_COPY.toString(), volume.getLabel());
            }
            volumesInRequest.add(volume);
        }
        checkForApplicationPendingTasks(volumeGroup, _dbClient, false);
        // check for full copy not supported volumes
        for (String groupName : arrayGroupNames) {
            checkForFullCopyNotSupportedVolumes(CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, Volume.class, AlternateIdConstraint.Factory.getVolumeReplicationGroupInstanceConstraint(groupName)));
        }
        for (Volume volume : volumesInRequest) {
            // set Flag in Volume so that we will know about partial request during processing.
            volume.addInternalFlags(Flag.VOLUME_GROUP_PARTIAL_REQUEST);
            _dbClient.updateObject(volume);
            // to make the requested name unique across array replication groups
            try {
                taskList.getTaskList().addAll(getFullCopyManager().createFullCopy(volume.getId(), param).getTaskList());
            } catch (Exception e) {
                volume.clearInternalFlags(Flag.VOLUME_GROUP_PARTIAL_REQUEST);
                _dbClient.updateObject(volume);
                throw e;
            }
        }
    } else {
        log.info("Full Copy requested for entire Application");
        checkForApplicationPendingTasks(volumeGroup, _dbClient, false);
        // make sure there are no xtremio/unity volumes in the application
        checkForFullCopyNotSupportedVolumes(volumes);
        auditOp(OperationTypeEnum.CREATE_VOLUME_GROUP_FULL_COPY, true, AuditLogManager.AUDITOP_BEGIN, volumeGroup.getId().toString(), param.getName(), param.getCount());
        // Full copy will be created for all volumes in Application
        taskList = getFullCopyManager().createFullCopy(volumes.get(0).getId(), param);
    }
    return taskList;
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) VolumeGroup(com.emc.storageos.db.client.model.VolumeGroup) TaskList(com.emc.storageos.model.TaskList) ArrayList(java.util.ArrayList) URI(java.net.URI) NullColumnValueGetter.isNullURI(com.emc.storageos.db.client.util.NullColumnValueGetter.isNullURI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) HashSet(java.util.HashSet) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 49 with VolumeGroup

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

the class VolumeGroupService method getVolumeGroupSnapshot.

/**
 * Get the specified volume group snapshot
 *
 * @prereq none
 * @param volumeGroupId The URI of the volume group
 * @param snapshotId The URI of the snapshot
 * @brief Get the specified volume group snapshot
 * @return BlockSnapshotRestRep
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/protection/snapshots/{sid}")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public BlockSnapshotRestRep getVolumeGroupSnapshot(@PathParam("id") final URI volumeGroupId, @PathParam("sid") URI snapshotId) {
    // query Volume Group
    final VolumeGroup volumeGroup = (VolumeGroup) queryResource(volumeGroupId);
    // validate replica operation for volume group
    validateCopyOperationForVolumeGroup(volumeGroup, ReplicaTypeEnum.SNAPSHOT);
    // validate snapshot ID
    ArgValidator.checkFieldUriType(snapshotId, BlockSnapshot.class, SNAPSHOT_ID_FIELD);
    // get snapshot
    BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, snapshotId);
    ArgValidator.checkEntity(snapshot, snapshotId, isIdEmbeddedInURL(snapshotId), true);
    // validate that source of the provided snapshot is part of the volume group
    Volume volume = _dbClient.queryObject(Volume.class, snapshot.getParent().getURI());
    if (volume != null && Volume.checkForVplexBackEndVolume(_dbClient, volume)) {
        // get VPLEX virtual volume to check for volume group reference
        volume = Volume.fetchVplexVolume(_dbClient, volume);
    }
    if (volume == null || volume.getInactive() || !volume.getVolumeGroupIds().contains(volumeGroupId.toString())) {
        throw APIException.badRequests.replicaOperationNotAllowedSourceNotInVolumeGroup(ReplicaTypeEnum.SNAPSHOT.toString(), snapshot.getLabel());
    }
    return BlockMapper.map(_dbClient, snapshot);
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) VolumeGroup(com.emc.storageos.db.client.model.VolumeGroup) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 50 with VolumeGroup

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

the class VolumeGroupService method getVolumeGroupFullCopy.

/**
 * Get the specified volume group full copy.
 *
 * @prereq none
 * @param volumeGroupId The URI of the volume group.
 * @param fullCopyURI The URI of the full copy.
 *
 * @brief Get the specified volume group full copy.
 *
 * @return The full copy volume.
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/protection/full-copies/{fcid}")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public VolumeRestRep getVolumeGroupFullCopy(@PathParam("id") final URI volumeGroupId, @PathParam("fcid") URI fullCopyURI) {
    ArgValidator.checkFieldUriType(volumeGroupId, VolumeGroup.class, "id");
    // Query Volume Group
    final VolumeGroup volumeGroup = (VolumeGroup) queryResource(volumeGroupId);
    // validate replica operation for volume group
    validateCopyOperationForVolumeGroup(volumeGroup, ReplicaTypeEnum.FULL_COPY);
    Volume fullCopyVolume = (Volume) BlockFullCopyUtils.queryFullCopyResource(fullCopyURI, uriInfo, false, _dbClient);
    verifyReplicaForCopyRequest(fullCopyVolume, volumeGroupId);
    // Get and return the full copy.
    return BlockMapper.map(_dbClient, fullCopyVolume);
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) VolumeGroup(com.emc.storageos.db.client.model.VolumeGroup) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

VolumeGroup (com.emc.storageos.db.client.model.VolumeGroup)52 Volume (com.emc.storageos.db.client.model.Volume)35 Produces (javax.ws.rs.Produces)29 Path (javax.ws.rs.Path)27 URI (java.net.URI)26 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)21 ArrayList (java.util.ArrayList)20 TaskList (com.emc.storageos.model.TaskList)15 GET (javax.ws.rs.GET)15 NullColumnValueGetter.isNullURI (com.emc.storageos.db.client.util.NullColumnValueGetter.isNullURI)14 Consumes (javax.ws.rs.Consumes)13 POST (javax.ws.rs.POST)13 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)12 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)10 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)10 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)9 VolumeGroupCopySetList (com.emc.storageos.model.application.VolumeGroupCopySetList)9 NamedURI (com.emc.storageos.db.client.model.NamedURI)8 SnapshotList (com.emc.storageos.model.SnapshotList)8 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)8