Search in sources :

Example 31 with ProtectionSet

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);
}
Also used : ProtectionSet(com.emc.storageos.db.client.model.ProtectionSet) StringSet(com.emc.storageos.db.client.model.StringSet) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI)

Example 32 with 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");
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) ProtectionSet(com.emc.storageos.db.client.model.ProtectionSet)

Example 33 with ProtectionSet

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);
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) ProtectionSet(com.emc.storageos.db.client.model.ProtectionSet) StringSet(com.emc.storageos.db.client.model.StringSet) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup)

Example 34 with ProtectionSet

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));
    }
}
Also used : ProtectionSet(com.emc.storageos.db.client.model.ProtectionSet) StringSet(com.emc.storageos.db.client.model.StringSet)

Example 35 with ProtectionSet

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);
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) ProtectionSet(com.emc.storageos.db.client.model.ProtectionSet) StringSet(com.emc.storageos.db.client.model.StringSet)

Aggregations

ProtectionSet (com.emc.storageos.db.client.model.ProtectionSet)57 Volume (com.emc.storageos.db.client.model.Volume)39 URI (java.net.URI)30 NamedURI (com.emc.storageos.db.client.model.NamedURI)26 ArrayList (java.util.ArrayList)25 StringSet (com.emc.storageos.db.client.model.StringSet)18 UnManagedProtectionSet (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet)14 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)13 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)11 URISyntaxException (java.net.URISyntaxException)10 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)9 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)9 ProtectionSystem (com.emc.storageos.db.client.model.ProtectionSystem)9 RecoverPointClient (com.emc.storageos.recoverpoint.impl.RecoverPointClient)9 HashSet (java.util.HashSet)8 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)7 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)7 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)6 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)6 RecoverPointVolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RecoverPointVolumeIngestionContext)6