use of com.emc.storageos.db.client.model.ProtectionSet in project coprhd-controller by CoprHD.
the class BlockObjectMultipleConsistencyGroupsMigrationTest method prepareProtectionSetWithAllStaleVolumes.
/**
* Prepares a ProtectionSet with volume references to volumes that do not
* exist in the DB.
*
* @throws Exception
*/
private void prepareProtectionSetWithAllStaleVolumes() throws Exception {
String cgName = "staleVolumeTest";
ProtectionSet protectionSet = createProtectionSet(cgName, projectURI);
staleProtectionSetURI = protectionSet.getId();
URI volumeURI1 = URIUtil.createId(Volume.class);
URI volumeURI2 = URIUtil.createId(Volume.class);
URI volumeURI3 = URIUtil.createId(Volume.class);
StringSet volumes = new StringSet();
volumes.add(volumeURI1.toString());
volumes.add(volumeURI2.toString());
volumes.add(volumeURI3.toString());
protectionSet.setVolumes(volumes);
_dbClient.persistObject(protectionSet);
}
use of com.emc.storageos.db.client.model.ProtectionSet in project coprhd-controller by CoprHD.
the class BlockObjectMultipleConsistencyGroupsMigrationTest method addProtectionSetAndVolumes.
/**
* adds new protection set with volumes to a CG; it's intentional that the protection set name is
* not unique
*
* @param rpCg
* @param prefix
* @throws Exception
*/
private void addProtectionSetAndVolumes(BlockConsistencyGroup rpCg, String prefix, int numberOfSnaps) throws Exception {
// Create the ProtectionSet that the RP volumes will belong to.
ProtectionSet cg2ps = createProtectionSet(prefix + "ProtectionSet", projectURI);
// Create all the RP volumes
List<Volume> rpCgVolumes = createRpVolumes(prefix + "VolumeA", 2, cg2ps, false);
rpCgVolumes.addAll(createRpVolumes(prefix + "VolumeB", 2, cg2ps, false));
// Add the RP volumes to the RP consistency group
addVolumesToBlockConsistencyGroup(rpCg.getId(), rpCgVolumes);
// Add the RP volumes to the protection set
addVolumesToProtectionSet(cg2ps.getId(), rpCgVolumes);
// add some snapshots
addSnapshots(numberOfSnaps, rpCgVolumes.iterator().next(), rpCg, cg2ps, prefix + "SnapVolmeA");
}
use of com.emc.storageos.db.client.model.ProtectionSet in project coprhd-controller by CoprHD.
the class BlockObjectMultipleConsistencyGroupsMigrationTest method prepareRPConsistencyGroupDataWithStaleVolumes.
/**
* Prepare the RecoverPoint only volumes and associated consistency group data.
*
* @throws Exception
*/
private void prepareRPConsistencyGroupDataWithStaleVolumes() throws Exception {
String cg2Name = "rpCg2";
// Create the RecoverPoint BlockConsistencyGroup that will be shared by all the
// RP volumes.
BlockConsistencyGroup rpCg = createBlockConsistencyGroup(cg2Name, null, Types.RP.name(), true);
// Save the CG references for migration verification.
rpConsistencyGroupURI2 = rpCg.getId();
// Create the ProtectionSet that the RP volumes will belong to.
ProtectionSet cg2ps = createProtectionSet("rpCg2ProtectionSet", projectURI);
// Create all the RP volumes
List<Volume> rpCg2Volumes = createRpVolumes("rpCg2VolumeA", 2, cg2ps, false);
rpCg2Volumes.addAll(createRpVolumes("rpCg2VolumeB", 2, cg2ps, false));
// Add the RP volumes to the RP consistency group
addVolumesToBlockConsistencyGroup(rpCg.getId(), rpCg2Volumes);
// Add the RP volumes to the protection set
addVolumesToProtectionSet(cg2ps.getId(), rpCg2Volumes);
// Add stale volume references
URI staleVolumeURI1 = URIUtil.createId(Volume.class);
URI staleVolumeURI2 = URIUtil.createId(Volume.class);
ProtectionSet ps = _dbClient.queryObject(ProtectionSet.class, cg2ps.getId());
StringSet vols = ps.getVolumes();
vols.add(staleVolumeURI1.toString());
vols.add(staleVolumeURI2.toString());
staleProtectionSetURI2 = cg2ps.getId();
staleProtectionSetVolumeURIs.add(staleVolumeURI1.toString());
staleProtectionSetVolumeURIs.add(staleVolumeURI2.toString());
_dbClient.persistObject(ps);
}
use of com.emc.storageos.db.client.model.ProtectionSet in project coprhd-controller by CoprHD.
the class BlockObjectMultipleConsistencyGroupsMigrationTest method verifyProtectionSetWith2StaleVolumes.
/**
* Verifies that stale volumes have been removed from the ProtectionSet.
*/
private void verifyProtectionSetWith2StaleVolumes() {
ProtectionSet protectionSet = _dbClient.queryObject(ProtectionSet.class, staleProtectionSetURI2);
StringSet psVolumes = protectionSet.getVolumes();
for (String staleVolume : staleProtectionSetVolumeURIs) {
// verify the stale volumes were removed
Assert.assertFalse("ProtectionSet " + staleProtectionSetURI2 + " should not contain stale volume " + staleVolume, psVolumes.contains(staleVolume));
}
}
use of com.emc.storageos.db.client.model.ProtectionSet in project coprhd-controller by CoprHD.
the class BlockObjectMultipleConsistencyGroupsMigrationTest method addVolumesToProtectionSet.
/**
* Convenience method that adds volumes to a protection set.
*
* @param protectionSetURI
* @param volumes
*/
private void addVolumesToProtectionSet(URI protectionSetURI, List<Volume> volumes) {
ProtectionSet protectionSet = _dbClient.queryObject(ProtectionSet.class, protectionSetURI);
StringSet vols = new StringSet();
for (Volume volume : volumes) {
vols.add(volume.getId().toString());
}
protectionSet.setVolumes(vols);
_dbClient.persistObject(protectionSet);
}
Aggregations