Search in sources :

Example 1 with VolumeRestRep

use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.

the class ApiSystemTestUtil method attachContinuousCopy.

public List<URI> attachContinuousCopy(URI volumeURI, String copyName) {
    try {
        List<URI> mirrors = new ArrayList<URI>();
        Copy copy = new Copy("native", Copy.SyncDirection.SOURCE_TO_TARGET.name(), null, copyName, 1);
        CopiesParam input = new CopiesParam();
        List<Copy> copies = input.getCopies();
        copies.add(copy);
        input.setCopies((copies));
        ;
        Tasks<VolumeRestRep> tasks = client.blockVolumes().startContinuousCopies(volumeURI, input);
        for (VolumeRestRep volumeRestRep : tasks.get()) {
            log.info(String.format("Mirror %s (%s)", volumeRestRep.getName(), volumeRestRep.getNativeId()));
            mirrors.add(volumeRestRep.getId());
        }
        return mirrors;
    } catch (ServiceErrorException ex) {
        log.info(String.format("Could not attach mirror %s to volume %s", copyName, volumeURI));
        throw ex;
    }
}
Also used : Copy(com.emc.storageos.model.block.Copy) ArrayList(java.util.ArrayList) CopiesParam(com.emc.storageos.model.block.CopiesParam) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) URI(java.net.URI)

Example 2 with VolumeRestRep

use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.

the class ApiSystemTestUtil method deleteVolumes.

public void deleteVolumes(List<URI> volumes, boolean inventoryOnly) {
    try {
        Tasks<VolumeRestRep> tasks = client.blockVolumes().deactivate(volumes, (inventoryOnly ? VolumeDeleteTypeEnum.VIPR_ONLY : VolumeDeleteTypeEnum.FULL));
        for (VolumeRestRep volumeRestRep : tasks.get()) {
            log.info(String.format("Volume %s (%s) deleted", volumeRestRep.getName(), volumeRestRep.getId()));
            volumes.add(volumeRestRep.getId());
        }
    } catch (ServiceErrorException ex) {
        log.error("Exception creating deleting volumes " + ex.getMessage(), ex);
        throw ex;
    }
}
Also used : VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException)

Example 3 with VolumeRestRep

use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.

the class RPIngestionTest method prepare2.

@Ignore
@Test
public // test2a creates unmanaged  distributed local volume create. Ingestion handled in test2b.
void prepare2() {
    // Create the volume to be ingested
    start();
    String timeInt = getTimeInt();
    String volumeName = "vpingest" + timeInt;
    printLog("Creating virtual volume: " + volumeName);
    URI vpool = util.getURIFromLabel(VirtualPool.class, properties.getProperty(DIST_VPOOL));
    URI varray = util.getURIFromLabel(VirtualArray.class, properties.getProperty(DIST_VARRAY));
    URI project = util.getURIFromLabel(Project.class, properties.getProperty(PROJECT));
    String cgName = properties.getProperty(CONSISTENCY_GROUP) + timeInt;
    URI cg = null;
    if (cgName != null) {
        cg = util.createConsistencyGroup(cgName, project);
    }
    List<URI> volumeURIs = util.createVolume(volumeName, "1GB", 1, vpool, varray, project, cg);
    // Look up the volume
    VolumeRestRep volume = client.blockVolumes().get(volumeURIs.get(0));
    String nativeId = volume.getNativeId();
    args.put("test2NativeId", nativeId);
    printLog("Virtual volume: " + nativeId);
    stop("Test 2 virtual volume creation: " + volumeName);
    // Inventory only delete it.
    util.deleteVolumes(volumeURIs, true);
}
Also used : VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) URI(java.net.URI) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 4 with VolumeRestRep

use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.

the class VPlexIngestionTest method prepare3.

@Test
public // test3a creates unmanaged  vplex local volume create. Ingestion handled in test1b.
void prepare3() {
    // Create the volume to be ingested
    start();
    String timeInt = getTimeInt();
    String volumeName = "vpingest" + timeInt;
    printLog("Creating virtual volume: " + volumeName);
    URI vpool = util.getURIFromLabel(VirtualPool.class, properties.getProperty(MIRROR_VPOOL));
    URI varray = util.getURIFromLabel(VirtualArray.class, properties.getProperty(MIRROR_VARRAY));
    URI project = util.getURIFromLabel(Project.class, properties.getProperty(PROJECT));
    String cgName = properties.getProperty(CONSISTENCY_GROUP) + timeInt;
    URI cg = null;
    if (cgName != null) {
        cg = util.createConsistencyGroup(cgName, project);
    }
    List<URI> volumeURIs = util.createVolume(volumeName, "1GB", 1, vpool, varray, project, null);
    // Look up the volume
    VolumeRestRep volume = client.blockVolumes().get(volumeURIs.get(0));
    String nativeId = volume.getNativeId();
    args.put("test3NativeId", nativeId);
    printLog("Virtual volume: " + nativeId);
    stop("Test 3 virtual volume creation: " + volumeName);
    // Attach the mirror
    List<URI> mirrorURIs = util.attachContinuousCopy(volumeURIs.get(0), volumeName + "-mirror");
    printLog("Mirror volume: " + mirrorURIs.get(0).toString());
    // Inventory only delete it.
    // N.B. There is currently a problem... the VplexMirror object is not currently being deleted
    // by inventory delete.
    util.deleteVolumes(volumeURIs, true);
}
Also used : VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) URI(java.net.URI) Test(org.junit.Test)

Example 5 with VolumeRestRep

use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.

the class VPlexIngestionTest method prepare2.

@Ignore
@Test
public // test2a creates unmanaged  distributed local volume create. Ingestion handled in test2b.
void prepare2() {
    // Create the volume to be ingested
    start();
    String timeInt = getTimeInt();
    String volumeName = "vpingest" + timeInt;
    printLog("Creating virtual volume: " + volumeName);
    URI vpool = util.getURIFromLabel(VirtualPool.class, properties.getProperty(DIST_VPOOL));
    URI varray = util.getURIFromLabel(VirtualArray.class, properties.getProperty(DIST_VARRAY));
    URI project = util.getURIFromLabel(Project.class, properties.getProperty(PROJECT));
    String cgName = properties.getProperty(CONSISTENCY_GROUP) + timeInt;
    URI cg = null;
    if (cgName != null) {
        cg = util.createConsistencyGroup(cgName, project);
    }
    List<URI> volumeURIs = util.createVolume(volumeName, "1GB", 1, vpool, varray, project, cg);
    // Look up the volume
    VolumeRestRep volume = client.blockVolumes().get(volumeURIs.get(0));
    String nativeId = volume.getNativeId();
    args.put("test2NativeId", nativeId);
    printLog("Virtual volume: " + nativeId);
    stop("Test 2 virtual volume creation: " + volumeName);
    // Inventory only delete it.
    util.deleteVolumes(volumeURIs, true);
}
Also used : VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) URI(java.net.URI) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)136 URI (java.net.URI)74 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)49 Asset (com.emc.sa.asset.annotation.Asset)35 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)35 ArrayList (java.util.ArrayList)25 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)23 AssetOption (com.emc.vipr.model.catalog.AssetOption)20 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)13 HashSet (java.util.HashSet)13 UnManagedVolumeRestRep (com.emc.storageos.model.block.UnManagedVolumeRestRep)12 Test (org.junit.Test)12 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)11 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)10 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)9 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)8 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)7 VolumeCreate (com.emc.storageos.model.block.VolumeCreate)7 List (java.util.List)7 SnapshotList (com.emc.storageos.model.SnapshotList)6