Search in sources :

Example 1 with UnManagedVolumeRestRep

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

the class ApiSystemTestUtil method ingestUnManagedVolume.

public List<String> ingestUnManagedVolume(List<URI> volumes, URI project, URI varray, URI vpool) {
    List<String> nativeGuids = new ArrayList<String>();
    try {
        VolumeIngest input = new VolumeIngest();
        input.setProject(project);
        ;
        input.setVarray(varray);
        ;
        input.setVpool(vpool);
        input.setUnManagedVolumes(volumes);
        ;
        Tasks<UnManagedVolumeRestRep> rep = client.unmanagedVolumes().ingest(input);
        for (UnManagedVolumeRestRep uvol : rep.get()) {
            log.info(String.format("Unmanaged volume %s ", uvol.getNativeGuid()));
            nativeGuids.add(uvol.getNativeGuid());
        }
        return nativeGuids;
    } catch (ServiceErrorException ex) {
        log.error("Exception discovering storage system " + ex.getMessage(), ex);
        throw ex;
    }
}
Also used : VolumeIngest(com.emc.storageos.model.block.VolumeIngest) ArrayList(java.util.ArrayList) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException)

Example 2 with UnManagedVolumeRestRep

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

the class RPIngestionTest 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 3 with UnManagedVolumeRestRep

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

the class RPIngestionTest method test1.

@Ignore
@Test
public void test1() {
    printLog("test1");
    URI vpool = util.getURIFromLabel(VirtualPool.class, properties.getProperty(RP_CDP_VPOOL));
    URI varray = util.getURIFromLabel(VirtualArray.class, properties.getProperty(LOCAL_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("test1NativeId"))) {
            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("Test1 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 4 with UnManagedVolumeRestRep

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

the class VPlexIngestionTest method test1.

@Ignore
@Test
public void test1() {
    printLog("test1");
    URI vpool = util.getURIFromLabel(VirtualPool.class, properties.getProperty(LOCAL_VPOOL));
    URI varray = util.getURIFromLabel(VirtualArray.class, properties.getProperty(LOCAL_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("test1NativeId"))) {
            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("Test1 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 5 with UnManagedVolumeRestRep

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

the class BlockMapper method map.

public static UnManagedVolumeRestRep map(UnManagedVolume from) {
    if (from == null) {
        return null;
    }
    UnManagedVolumeRestRep to = new UnManagedVolumeRestRep();
    mapDataObjectFields(from, to);
    to.setNativeGuid(from.getNativeGuid());
    try {
        to.setVolumeInformation(new StringSetMapAdapter().marshal(from.getVolumeInformation()));
    } catch (Exception e) {
    // Intentionally ignored
    }
    to.setVolumeCharacteristics(new StringMapAdapter().marshal(from.getVolumeCharacterstics()));
    to.setStorageSystem(toRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, from.getStorageSystemUri()));
    to.setStoragePool(toRelatedResource(ResourceTypeEnum.STORAGE_POOL, from.getStoragePoolUri()));
    List<String> uems = new ArrayList<String>();
    for (String uem : from.getUnmanagedExportMasks()) {
        uems.add(uem);
    }
    to.setUnManagedExportMasks(uems);
    List<String> initiatorUris = new ArrayList<String>();
    for (String uri : from.getInitiatorUris()) {
        initiatorUris.add(uri);
    }
    to.setInitiatorUris(initiatorUris);
    List<String> initiatorNetworkIds = new ArrayList<String>();
    for (String id : from.getInitiatorNetworkIds()) {
        initiatorNetworkIds.add(id);
    }
    to.setInitiatorNetworkIds(initiatorNetworkIds);
    List<String> storagePortUris = new ArrayList<String>();
    for (String uri : from.getStoragePortUris()) {
        storagePortUris.add(uri);
    }
    to.setStoragePortUris(storagePortUris);
    List<String> supportedVPoolUris = new ArrayList<String>();
    for (String uri : from.getSupportedVpoolUris()) {
        supportedVPoolUris.add(uri);
    }
    to.setSupportedVPoolUris(supportedVPoolUris);
    to.setWWN(from.getWwn());
    return to;
}
Also used : StringSetMapAdapter(com.emc.storageos.model.adapters.StringSetMapAdapter) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) ArrayList(java.util.ArrayList) StringMapAdapter(com.emc.storageos.model.adapters.StringMapAdapter)

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