/** {@inheritDoc} */ @Override public void validateSnapshotCreateRequest(Volume requestedVolume, List<Volume> volumesToSnap) { // For VMAX3 you cannot have active snap and full copy sessions, // so verify there are no active full copies for the volume. for (Volume volumeToSnap : volumesToSnap) { // Check if the volume to snap is an active full copy. if ((BlockFullCopyUtils.isVolumeFullCopy(volumeToSnap, _dbClient)) && (!BlockFullCopyUtils.isFullCopyDetached(volumeToSnap, _dbClient)) && (!BlockFullCopyUtils.isFullCopyInactive(volumeToSnap, _dbClient))) { throw APIException.badRequests.noSnapshotsForVMAX3VolumeWithActiveFullCopy(); } // Now check if the volume to be snapped is a full copy source // that has active full copies. StringSet fullCopyIds = volumeToSnap.getFullCopies(); if ((fullCopyIds != null) && (!fullCopyIds.isEmpty())) { Iterator<String> fullCopyIdsIter = fullCopyIds.iterator(); while (fullCopyIdsIter.hasNext()) { URI fullCopyURI = URI.create(fullCopyIdsIter.next()); Volume fullCopyVolume = _dbClient.queryObject(Volume.class, fullCopyURI); if ((fullCopyVolume != null) && (!fullCopyVolume.getInactive()) && (!BlockFullCopyUtils.isFullCopyDetached(fullCopyVolume, _dbClient)) && (!BlockFullCopyUtils.isFullCopyInactive(fullCopyVolume, _dbClient))) { throw APIException.badRequests.noSnapshotsForVMAX3VolumeWithActiveFullCopy(); } } } } }
/** * Add the application to the volume applicationIds attribute * * @param voluri The volume that will be updated * @param dbClient */ protected void addApplicationToVolume(URI voluri, DbClient dbClient) { Volume volume = dbClient.queryObject(Volume.class, voluri); StringSet applications = volume.getVolumeGroupIds(); if (applications == null) { applications = new StringSet(); } applications.add(getId().toString()); volume.setVolumeGroupIds(applications); dbClient.updateObject(volume); // handle clones StringSet fullCopies = volume.getFullCopies(); List<Volume> fullCopiesToUpdate = new ArrayList<Volume>(); if (fullCopies != null && !fullCopies.isEmpty()) { for (String fullCopyId : fullCopies) { Volume fullCopy = dbClient.queryObject(Volume.class, URI.create(fullCopyId)); if (fullCopy != null && NullColumnValueGetter.isNullValue(fullCopy.getFullCopySetName())) { fullCopy.setFullCopySetName(fullCopy.getReplicationGroupInstance()); fullCopiesToUpdate.add(fullCopy); } } } if (!fullCopiesToUpdate.isEmpty()) { dbClient.updateObject(fullCopiesToUpdate); } }