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;
}
}
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()));
}
}
}
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()));
}
}
}
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()));
}
}
}
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;
}
Aggregations