/** * Creates the BlockObject BlockSnapshot data. * * @param name * @param numSnapshots * @throws Exception */ private void prepareBlockSnapshotData(String name, int numSnapshots) throws Exception { // Create the volume for the snapshots Volume volume = new Volume(); URI volumeURI = URIUtil.createId(Volume.class); StorageSystem storageSystem = createStorageSystem(false); volume.setId(volumeURI); volume.setStorageController(storageSystem.getId()); String volName = "blockSnapshotVolume"; volume.setLabel(volName); BlockConsistencyGroup cg = createBlockConsistencyGroup( "blockSnapshotConsistencyGroup", storageSystem.getId(), Types.LOCAL.name(), true); volume.setConsistencyGroup(cg.getId()); _dbClient.createObject(volume); for (int i = 1; i <= numSnapshots; i++) { BlockSnapshot blockSnapshot = new BlockSnapshot(); URI blockSnapshotURI = URIUtil.createId(BlockSnapshot.class); blockSnapshotURIs.add(blockSnapshotURI); blockSnapshot.setId(blockSnapshotURI); blockSnapshot.setLabel(name + i); blockSnapshot.setSnapsetLabel(name + i); blockSnapshot.setParent(new NamedURI(volume.getId(), name + i)); blockSnapshot.addConsistencyGroup(cg.getId().toString()); _dbClient.createObject(blockSnapshot); } }
/** * Convenience method that creates the BlockObject Volume data. * * @param volumeName * @param numTargets */ private List<Volume> createBlockVolumes(String volumeName, int numVolumes, URI storageSystem) { List<Volume> volumes = new ArrayList<Volume>(); for (int i = 1; i <= numVolumes; i++) { Volume volume = new Volume(); URI volumeURI = URIUtil.createId(Volume.class); blockVolumeURIs.add(volumeURI); volume.setId(volumeURI); volume.setLabel(volumeName + i); volume.setStorageController(storageSystem); _dbClient.createObject(volume); volumes.add(volume); } return volumes; }
/** * Convenience method that creates VPlex volumes. * * @param name * @param numberOfVols * @param storageSystem * @return */ private List<Volume> createVPlexVolumes(String name, int numberOfVols, URI storageSystem) { List<Volume> volumes = new ArrayList<Volume>(); for (int i = 1; i <= numberOfVols; i++) { Volume vplexVolume = new Volume(); URI vplexVolumeUri = URIUtil.createId(Volume.class); vplexVolumeURIs.add(vplexVolumeUri); vplexVolume.setId(vplexVolumeUri); vplexVolume.setLabel(name + i); vplexVolume.setNativeId( "/clusters/cluster-1/virtual-volumes/device_V000195701573-01E7F_vol" + i); vplexVolume.setStorageController(storageSystem); StringSet associatedVolumes = new StringSet(); associatedVolumes.add("associatedVol1"); vplexVolume.setAssociatedVolumes(associatedVolumes); volumes.add(vplexVolume); } return volumes; }
/** * Creates the RP source volume/journal and the specified number of target/journal volumes. * * @param volumeName * @param numTargets */ private List<Volume> createRpVolumes( String volumeName, int numTargets, ProtectionSet protectionSet, boolean isRpVPlex) { List<Volume> volumes = new ArrayList<Volume>(); StringSet associatedVolumes = new StringSet(); associatedVolumes.add("associatedVol1"); StorageSystem storageSystem = null; if (isRpVPlex) { storageSystem = createStorageSystem(true); } else { storageSystem = createStorageSystem(false); } String rsetName = "RSet-" + volumeName; Volume sourceVolume = new Volume(); URI sourceVolumeURI = URIUtil.createId(Volume.class); volumes.add(sourceVolume); sourceVolume.setId(sourceVolumeURI); sourceVolume.setLabel(volumeName); sourceVolume.setPersonality(Volume.PersonalityTypes.SOURCE.toString()); sourceVolume.setRSetName(rsetName); sourceVolume.setProtectionSet(new NamedURI(protectionSet.getId(), sourceVolume.getLabel())); sourceVolume.setStorageController(storageSystem.getId()); if (isRpVPlex) { sourceVolume.setAssociatedVolumes(associatedVolumes); sourceVolume.setNativeId( "/clusters/cluster-1/virtual-volumes/device_V000195701573-01E7A_vol"); // Create a VPLEX ViPR BlockConsistencyGroup for the source volume BlockConsistencyGroup sourceVolumeCg = createBlockConsistencyGroup( sourceVolume.getLabel() + "-CG", storageSystem.getId(), Types.VPLEX.name(), true); addVolumeToBlockConsistencyGroup(sourceVolumeCg.getId(), sourceVolume); rpVplexVolumeToCgMapping.put(sourceVolumeURI, sourceVolumeCg.getId()); } else { rpVolumeURIs.add(sourceVolumeURI); } _dbClient.createObject(sourceVolume); Volume sourceVolumeJournal = new Volume(); URI sourceVolumeJournalURI = URIUtil.createId(Volume.class); volumes.add(sourceVolumeJournal); sourceVolumeJournal.setId(sourceVolumeJournalURI); sourceVolumeJournal.setLabel(volumeName + RP_SRC_JOURNAL_APPEND); sourceVolumeJournal.setPersonality(Volume.PersonalityTypes.METADATA.toString()); sourceVolumeJournal.setProtectionSet( new NamedURI(protectionSet.getId(), sourceVolumeJournal.getLabel())); sourceVolumeJournal.setStorageController(storageSystem.getId()); if (isRpVPlex) { sourceVolumeJournal.setAssociatedVolumes(associatedVolumes); sourceVolumeJournal.setNativeId( "/clusters/cluster-1/virtual-volumes/device_V000195701573-01E7B_vol"); // Create a VPLEX ViPR BlockConsistencyGroup for the source journal volume BlockConsistencyGroup sourceVolumeJournalCg = createBlockConsistencyGroup( sourceVolumeJournal.getLabel() + "-CG", storageSystem.getId(), Types.VPLEX.name(), true); addVolumeToBlockConsistencyGroup(sourceVolumeJournalCg.getId(), sourceVolumeJournal); rpVplexVolumeToCgMapping.put(sourceVolumeJournalURI, sourceVolumeJournalCg.getId()); } else { rpVolumeURIs.add(sourceVolumeJournalURI); } _dbClient.createObject(sourceVolumeJournal); for (int i = 1; i <= numTargets; i++) { Volume sourceVolumeTarget = new Volume(); URI sourceVolumeTargetURI = URIUtil.createId(Volume.class); volumes.add(sourceVolumeTarget); sourceVolumeTarget.setId(sourceVolumeTargetURI); sourceVolumeTarget.setLabel(volumeName + RP_TGT_APPEND + "vArray" + i); sourceVolumeTarget.setPersonality(Volume.PersonalityTypes.TARGET.toString()); sourceVolumeTarget.setRSetName(rsetName); sourceVolumeTarget.setProtectionSet( new NamedURI(protectionSet.getId(), sourceVolumeTarget.getLabel())); sourceVolumeTarget.setStorageController(storageSystem.getId()); if (isRpVPlex) { sourceVolumeTarget.setAssociatedVolumes(associatedVolumes); sourceVolumeTarget.setNativeId( "/clusters/cluster-2/virtual-volumes/device_V000195701573-01E7C_vol" + i); // Create a VPLEX ViPR BlockConsistencyGroup for the target volume BlockConsistencyGroup sourceVolumeTargetCg = createBlockConsistencyGroup( sourceVolumeTarget.getLabel() + "-CG", storageSystem.getId(), Types.VPLEX.name(), true); addVolumeToBlockConsistencyGroup(sourceVolumeTargetCg.getId(), sourceVolumeTarget); rpVplexVolumeToCgMapping.put(sourceVolumeTargetURI, sourceVolumeTargetCg.getId()); } else { rpVolumeURIs.add(sourceVolumeTargetURI); } _dbClient.createObject(sourceVolumeTarget); Volume sourceVolumeTargetJournal = new Volume(); URI sourceVolumeTargetJournalURI = URIUtil.createId(Volume.class); volumes.add(sourceVolumeTargetJournal); sourceVolumeTargetJournal.setId(sourceVolumeTargetJournalURI); sourceVolumeTargetJournal.setLabel(volumeName + RP_TGT_JOURNAL_APPEND + "vArray" + i); sourceVolumeTargetJournal.setPersonality(Volume.PersonalityTypes.METADATA.toString()); sourceVolumeTargetJournal.setProtectionSet( new NamedURI(protectionSet.getId(), sourceVolumeTargetJournal.getLabel())); sourceVolumeTargetJournal.setStorageController(storageSystem.getId()); if (isRpVPlex) { sourceVolumeTargetJournal.setAssociatedVolumes(associatedVolumes); sourceVolumeTargetJournal.setNativeId( "/clusters/cluster-2/virtual-volumes/device_V000195701573-01ED_vol" + i); // Create a VPLEX ViPR BlockConsistencyGroup for the source target journal volume BlockConsistencyGroup sourceVolumeTargetJournalCg = createBlockConsistencyGroup( sourceVolumeTargetJournal.getLabel() + "-CG", storageSystem.getId(), Types.VPLEX.name(), true); addVolumeToBlockConsistencyGroup( sourceVolumeTargetJournalCg.getId(), sourceVolumeTargetJournal); rpVplexVolumeToCgMapping.put( sourceVolumeTargetJournalURI, sourceVolumeTargetJournalCg.getId()); } else { rpVolumeURIs.add(sourceVolumeTargetJournalURI); } _dbClient.createObject(sourceVolumeTargetJournal); } return volumes; }