use of com.emc.storageos.model.block.BlockSnapshotRestRep in project coprhd-controller by CoprHD.
the class AddVolumesToConsistencyGroupService method getSnapshots.
/**
* Get snapshots for a given volume id
*
* @param volumeId the volume id to use
* @return list of snapshot ids
*/
public List<URI> getSnapshots(URI volumeId) {
List<URI> blockSnapshots = Lists.newArrayList();
List<BlockSnapshotRestRep> blockSnapshotRestReps = execute(new GetActiveSnapshotsForVolume(volumeId));
for (BlockSnapshotRestRep blockSnapshotId : blockSnapshotRestReps) {
blockSnapshots.add(blockSnapshotId.getId());
}
return blockSnapshots;
}
use of com.emc.storageos.model.block.BlockSnapshotRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method isVMAXUsePortGroupEnabled.
public static boolean isVMAXUsePortGroupEnabled(URI resourceId) {
SimpleValueRep value = execute(new GetVMAXUsePortGroupEnabledConfig());
if (value.getValue().equalsIgnoreCase("true")) {
if (ResourceType.isType(ResourceType.VOLUME, resourceId)) {
BlockObjectRestRep obj = getVolume(resourceId);
if (obj instanceof VolumeRestRep) {
VolumeRestRep volume = (VolumeRestRep) obj;
boolean isVMAX = StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax3.name());
boolean isRPOrVPlex = isVplexOrRPVolume(volume);
if (isVMAX && !isRPOrVPlex) {
return true;
}
}
if (obj instanceof BlockSnapshotRestRep) {
BlockSnapshotRestRep snapshot = (BlockSnapshotRestRep) obj;
BlockObjectRestRep parent = getVolume(snapshot.getParent().getId());
if (parent instanceof VolumeRestRep) {
VolumeRestRep volume = (VolumeRestRep) obj;
if (StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
return true;
}
}
if (parent instanceof BlockMirrorRestRep) {
BlockMirrorRestRep mirror = (BlockMirrorRestRep) obj;
if (StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
return true;
}
}
}
if (obj instanceof BlockMirrorRestRep) {
BlockMirrorRestRep mirror = (BlockMirrorRestRep) obj;
if (StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
return true;
}
}
}
if (ResourceType.isType(ResourceType.VIRTUAL_POOL, resourceId)) {
BlockVirtualPoolRestRep virtualPool = execute(new GetBlockVirtualPool(resourceId));
boolean isVMAX = StringUtils.equalsIgnoreCase(virtualPool.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(virtualPool.getSystemType(), DiscoveredDataObject.Type.vmax3.name());
boolean isVPLEX = virtualPool.getHighAvailability() != null;
if (isVMAX && !isVPLEX) {
return true;
}
}
}
return false;
}
use of com.emc.storageos.model.block.BlockSnapshotRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method removeSnapshot.
public static void removeSnapshot(URI snapshotId, VolumeDeleteTypeEnum type) {
Tasks<BlockSnapshotRestRep> task = execute(new DeactivateBlockSnapshot(snapshotId, type));
addAffectedResources(task);
}
use of com.emc.storageos.model.block.BlockSnapshotRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getSingleSnapshotPerSubGroupAndStorageSystem.
public static List<URI> getSingleSnapshotPerSubGroupAndStorageSystem(URI applicationId, String copySet, List<String> subGroups) {
List<URI> snapshotIds = Lists.newArrayList();
Table<URI, String, BlockSnapshotRestRep> results = getReplicationGroupSnapshots(execute(new GetBlockSnapshotSet(applicationId, copySet)).getSnapList());
for (Cell<URI, String, BlockSnapshotRestRep> cell : results.cellSet()) {
if (subGroups.contains(BlockStorageUtils.stripRPTargetFromReplicationGroup(cell.getColumnKey()))) {
snapshotIds.add(cell.getValue().getId());
}
}
return snapshotIds;
}
use of com.emc.storageos.model.block.BlockSnapshotRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getReplicationGroupSnapshots.
public static Table<URI, String, BlockSnapshotRestRep> getReplicationGroupSnapshots(List<NamedRelatedResourceRep> volumeUris) {
Table<URI, String, BlockSnapshotRestRep> storageRgToVolumes = HashBasedTable.create();
for (NamedRelatedResourceRep volumeUri : volumeUris) {
BlockSnapshotRestRep snapshot = execute(new GetBlockSnapshot(volumeUri.getId()));
VolumeRestRep volume = execute(new GetBlockVolume(snapshot.getParent().getId()));
String rgName = volume.getReplicationGroupInstance();
URI storage = volume.getStorageController();
if (!storageRgToVolumes.contains(storage, rgName)) {
storageRgToVolumes.put(storage, rgName, snapshot);
}
}
return storageRgToVolumes;
}
Aggregations