Search in sources :

Example 11 with UnManagedVolumeRestRep

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

the class VirtualDataCenterProvider method getVolumeFilter.

@Asset("volumeFilter")
@AssetDependencies({ "unmanagedBlockStorageSystem", "blockVirtualPool" })
public List<AssetOption> getVolumeFilter(AssetOptionsContext ctx, URI storageSystemId, URI vpool) {
    List<String> volumeNames = Lists.newArrayList();
    for (UnManagedVolumeRestRep volume : listUnmanagedVolumes(ctx, storageSystemId, vpool)) {
        if (!isNonRPExported(volume.getVolumeCharacteristics())) {
            volumeNames.add(getLabel(volume));
        }
    }
    Collections.sort(volumeNames, new StringComparator(false));
    return getVolumeFilterOptions(volumeNames);
}
Also used : UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) StringComparator(com.emc.sa.util.StringComparator) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 12 with UnManagedVolumeRestRep

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

the class RPIngestionTest method test3.

@Ignore
@Test
public void test3() {
    printLog("test3");
    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));
    URI cg = util.getURIFromLabel(BlockConsistencyGroup.class, properties.getProperty(CONSISTENCY_GROUP));
    URI vplexURI = util.getURIFromLabel(StorageSystem.class, properties.getProperty(VPLEX_GUID));
    // Look up the unmanaged volume by nativeId.
    List<UnManagedVolumeRestRep> uvols = client.unmanagedVolumes().getByStorageSystem(vplexURI);
    List<URI> uvolId = new ArrayList<URI>();
    for (UnManagedVolumeRestRep uvol : uvols) {
        if (uvol.getNativeGuid().equals(args.get("test3NativeId"))) {
            printLog("UnManagedVolume: " + uvol.getNativeGuid());
            uvolId.add(uvol.getId());
        }
    }
    Assert.assertFalse("Unmanaged volume id null", uvolId.isEmpty());
    // Do ingestion of virtual volume.
    start();
    List<String> nativeGuids = util.ingestUnManagedVolume(uvolId, project, varray, vpool);
    stop("Test3 ingestion of volume: " + uvolId);
    // Lookup the volumes in the database.
    List<Volume> volumes = util.findVolumesByNativeGuid(vplexURI, nativeGuids);
    for (Volume vvol : volumes) {
        printLog(String.format("Volume %s %s %s", vvol.getLabel(), vvol.getNativeGuid(), vvol.getId()));
        Assert.assertNotNull("No associated volumes", vvol.getAssociatedVolumes());
        Assert.assertFalse("Associated volumes empty", vvol.getAssociatedVolumes().isEmpty());
        for (String assocVolume : vvol.getAssociatedVolumes()) {
            Volume bvol = dbClient.queryObject(Volume.class, URI.create(assocVolume));
            printLog(String.format("  Backend Volume %s %s %s", bvol.getLabel(), bvol.getNativeGuid(), bvol.getId()));
        }
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) ArrayList(java.util.ArrayList) URI(java.net.URI) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 13 with UnManagedVolumeRestRep

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

the class VPlexIngestionTest method test2.

@Ignore
@Test
public void test2() {
    printLog("test2");
    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));
    URI cg = util.getURIFromLabel(BlockConsistencyGroup.class, properties.getProperty(CONSISTENCY_GROUP));
    URI vplexURI = util.getURIFromLabel(StorageSystem.class, properties.getProperty(VPLEX_GUID));
    // Look up the unmanaged volume by nativeId.
    List<UnManagedVolumeRestRep> uvols = client.unmanagedVolumes().getByStorageSystem(vplexURI);
    List<URI> uvolId = new ArrayList<URI>();
    for (UnManagedVolumeRestRep uvol : uvols) {
        if (uvol.getNativeGuid().equals(args.get("test2NativeId"))) {
            printLog("UnManagedVolume: " + uvol.getNativeGuid());
            uvolId.add(uvol.getId());
        }
    }
    Assert.assertFalse("Unmanaged volume id null", uvolId.isEmpty());
    // Do ingestion of virtual volume.
    start();
    List<String> nativeGuids = util.ingestUnManagedVolume(uvolId, project, varray, vpool);
    stop("Test2 ingestion of virtual volume: " + uvolId);
    // Lookup the volumes in the database.
    List<Volume> volumes = util.findVolumesByNativeGuid(vplexURI, nativeGuids);
    for (Volume vvol : volumes) {
        printLog(String.format("Volume %s %s %s", vvol.getLabel(), vvol.getNativeGuid(), vvol.getId()));
        Assert.assertNotNull("No associated volumes", vvol.getAssociatedVolumes());
        Assert.assertFalse("Associated volumes empty", vvol.getAssociatedVolumes().isEmpty());
        for (String assocVolume : vvol.getAssociatedVolumes()) {
            Volume bvol = dbClient.queryObject(Volume.class, URI.create(assocVolume));
            printLog(String.format("  Backend Volume %s %s %s", bvol.getLabel(), bvol.getNativeGuid(), bvol.getId()));
        }
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) ArrayList(java.util.ArrayList) URI(java.net.URI) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 14 with UnManagedVolumeRestRep

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

the class VPlexIngestionTest method test3.

@Test
public void test3() {
    printLog("test3");
    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));
    URI cg = util.getURIFromLabel(BlockConsistencyGroup.class, properties.getProperty(CONSISTENCY_GROUP));
    URI vplexURI = util.getURIFromLabel(StorageSystem.class, properties.getProperty(VPLEX_GUID));
    // Look up the unmanaged volume by nativeId.
    List<UnManagedVolumeRestRep> uvols = client.unmanagedVolumes().getByStorageSystem(vplexURI);
    List<URI> uvolId = new ArrayList<URI>();
    for (UnManagedVolumeRestRep uvol : uvols) {
        if (uvol.getNativeGuid().equals(args.get("test3NativeId"))) {
            printLog("UnManagedVolume: " + uvol.getNativeGuid());
            uvolId.add(uvol.getId());
        }
    }
    Assert.assertFalse("Unmanaged volume id null", uvolId.isEmpty());
    // Do ingestion of virtual volume.
    start();
    List<String> nativeGuids = util.ingestUnManagedVolume(uvolId, project, varray, vpool);
    stop("Test3 ingestion of volume: " + uvolId);
    // Lookup the volumes in the database.
    List<Volume> volumes = util.findVolumesByNativeGuid(vplexURI, nativeGuids);
    for (Volume vvol : volumes) {
        printLog(String.format("Volume %s %s %s", vvol.getLabel(), vvol.getNativeGuid(), vvol.getId()));
        Assert.assertNotNull("No associated volumes", vvol.getAssociatedVolumes());
        Assert.assertFalse("Associated volumes empty", vvol.getAssociatedVolumes().isEmpty());
        for (String assocVolume : vvol.getAssociatedVolumes()) {
            Volume bvol = dbClient.queryObject(Volume.class, URI.create(assocVolume));
            printLog(String.format("  Backend Volume %s %s %s", bvol.getLabel(), bvol.getNativeGuid(), bvol.getId()));
        }
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) ArrayList(java.util.ArrayList) URI(java.net.URI) Test(org.junit.Test)

Example 15 with UnManagedVolumeRestRep

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

the class MobilityGroupMigrationService method ingestVolumes.

private void ingestVolumes() {
    List<NamedRelatedResourceRep> hostsOrClusters = Lists.newArrayList();
    if (mobilityGroup.getMigrationGroupBy().equals(VolumeGroup.MigrationGroupBy.HOSTS.name())) {
        hostsOrClusters = execute(new GetMobilityGroupHosts(mobilityGroup.getId()));
    } else if (mobilityGroup.getMigrationGroupBy().equals(VolumeGroup.MigrationGroupBy.CLUSTERS.name())) {
        hostsOrClusters = execute(new GetMobilityGroupClusters(mobilityGroup.getId()));
    }
    for (NamedRelatedResourceRep hostOrCluster : hostsOrClusters) {
        int remaining = execute(new GetUnmanagedVolumesByHostOrCluster(hostOrCluster.getId())).size();
        logInfo("ingest.exported.unmanaged.volume.service.remaining", remaining);
    }
    for (NamedRelatedResourceRep hostOrCluster : hostsOrClusters) {
        URI host = BlockStorageUtils.isHost(hostOrCluster.getId()) ? hostOrCluster.getId() : null;
        URI cluster = BlockStorageUtils.isCluster(hostOrCluster.getId()) ? hostOrCluster.getId() : null;
        List<UnManagedVolumeRestRep> volumeIds = execute(new GetUnmanagedVolumesByHostOrCluster(hostOrCluster.getId()));
        List<URI> ingestVolumeIds = Lists.newArrayList();
        for (UnManagedVolumeRestRep unmanaged : volumeIds) {
            if (VirtualDataCenterProvider.matchesVpool(unmanaged, virtualPool)) {
                ingestVolumeIds.add(unmanaged.getId());
            }
        }
        int succeed = execute(new IngestExportedUnmanagedVolumes(virtualPool, virtualArray, project, host == null ? null : host, cluster == null ? null : cluster, ingestVolumeIds, IngestionMethodEnum.VIRTUAL_VOLUMES_ONLY.toString())).getTasks().size();
        logInfo("ingest.exported.unmanaged.volume.service.ingested", succeed);
        logInfo("ingest.exported.unmanaged.volume.service.skipped", volumeIds.size() - succeed);
    }
}
Also used : IngestExportedUnmanagedVolumes(com.emc.sa.service.vipr.block.tasks.IngestExportedUnmanagedVolumes) GetMobilityGroupClusters(com.emc.sa.service.vipr.block.tasks.GetMobilityGroupClusters) GetMobilityGroupHosts(com.emc.sa.service.vipr.block.tasks.GetMobilityGroupHosts) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) GetUnmanagedVolumesByHostOrCluster(com.emc.sa.service.vipr.block.tasks.GetUnmanagedVolumesByHostOrCluster) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Aggregations

UnManagedVolumeRestRep (com.emc.storageos.model.block.UnManagedVolumeRestRep)18 URI (java.net.URI)9 ArrayList (java.util.ArrayList)8 Asset (com.emc.sa.asset.annotation.Asset)6 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)6 Volume (com.emc.storageos.db.client.model.Volume)6 Test (org.junit.Test)6 Ignore (org.junit.Ignore)5 AssetOption (com.emc.vipr.model.catalog.AssetOption)4 StringComparator (com.emc.sa.util.StringComparator)2 GetMobilityGroupClusters (com.emc.sa.service.vipr.block.tasks.GetMobilityGroupClusters)1 GetMobilityGroupHosts (com.emc.sa.service.vipr.block.tasks.GetMobilityGroupHosts)1 GetUnmanagedVolumes (com.emc.sa.service.vipr.block.tasks.GetUnmanagedVolumes)1 GetUnmanagedVolumesByHostOrCluster (com.emc.sa.service.vipr.block.tasks.GetUnmanagedVolumesByHostOrCluster)1 IngestExportedUnmanagedVolumes (com.emc.sa.service.vipr.block.tasks.IngestExportedUnmanagedVolumes)1 IngestUnexportedUnmanagedVolumes (com.emc.sa.service.vipr.block.tasks.IngestUnexportedUnmanagedVolumes)1 WaitForTasks (com.emc.sa.service.vipr.tasks.WaitForTasks)1 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 StringMapAdapter (com.emc.storageos.model.adapters.StringMapAdapter)1 StringSetMapAdapter (com.emc.storageos.model.adapters.StringSetMapAdapter)1