Search in sources :

Example 26 with VolumeRestRep

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

the class VolumeWWNUtilsTest method testPartial.

@Test
public void testPartial() throws Exception {
    VolumeRestRep blockObject = new VolumeRestRep();
    blockObject.setWwn("514abcdef0123456");
    String actualWwn = "514abcdef0123456";
    assertTrue(VolumeWWNUtils.wwnMatches(actualWwn, blockObject.getWwn()));
}
Also used : VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) Test(org.junit.Test)

Example 27 with VolumeRestRep

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

the class VolumeWWNUtilsTest method testPartialAtEnd.

@Test
public void testPartialAtEnd() throws Exception {
    VolumeRestRep blockObject = new VolumeRestRep();
    blockObject.setWwn("514abcdef0123456");
    String actualWwn = "12345514abcdef0123456";
    assertTrue(VolumeWWNUtils.wwnMatches(actualWwn, blockObject.getWwn()));
}
Also used : VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) Test(org.junit.Test)

Example 28 with VolumeRestRep

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

the class VolumeWWNUtilsTest method testMatchingWWNs.

@Test
public void testMatchingWWNs() throws Exception {
    VolumeRestRep blockObject = new VolumeRestRep();
    blockObject.setWwn("60060abcdef0123456789abcdef01234");
    String actualWwn = "60060abcdef0123456789abcdef01234";
    assertTrue(VolumeWWNUtils.wwnMatches(actualWwn, blockObject.getWwn()));
}
Also used : VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) Test(org.junit.Test)

Example 29 with VolumeRestRep

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

the class BlockProvider method createVolumeOptions.

protected static List<AssetOption> createVolumeOptions(ViPRCoreClient client, URI project, URI hostId, Collection<? extends BlockObjectRestRep> blockObjects) {
    Map<URI, VolumeRestRep> volumeNames = getProjectVolumeNames(client, project);
    List<AssetOption> options = Lists.newArrayList();
    for (BlockObjectRestRep blockObject : blockObjects) {
        options.add(createVolumeOption(client, hostId, blockObject, volumeNames));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 30 with VolumeRestRep

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

the class BlockProvider method getVolumesWithFullCopies.

@Asset("volumeWithFullCopies")
@AssetDependencies({ "project", "blockVolumeOrConsistencyType" })
public List<AssetOption> getVolumesWithFullCopies(AssetOptionsContext ctx, URI project, String volumeOrConsistencyType) {
    final ViPRCoreClient client = api(ctx);
    if (isVolumeType(volumeOrConsistencyType)) {
        List<VolumeRestRep> volumes = findVolumesByProject(client, project);
        List<VolumeRestRep> filteredVols = new ArrayList<>();
        for (VolumeRestRep vol : volumes) {
            if (vol.getProtection() == null || vol.getProtection().getFullCopyRep() == null || vol.getProtection().getFullCopyRep().getFullCopyVolumes() == null || vol.getProtection().getFullCopyRep().getFullCopyVolumes().isEmpty() || !StringUtils.isEmpty(vol.getReplicationGroupInstance())) {
                continue;
            }
            filteredVols.add(vol);
        }
        log.info("Got volumes with full copies: [{}]", filteredVols.size());
        return createVolumeOptions(client, filteredVols);
    } else {
        List<BlockConsistencyGroupRestRep> consistencyGroups = api(ctx).blockConsistencyGroups().search().byProject(project).run();
        return createBaseResourceOptions(consistencyGroups);
    }
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockConsistencyGroupRestRep(com.emc.storageos.model.block.BlockConsistencyGroupRestRep) ArrayList(java.util.ArrayList) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

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