use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method createFullCopy.
public static Tasks<VolumeRestRep> createFullCopy(URI volumeId, String name, Integer count) {
int countValue = (count != null) ? count : 1;
Tasks<VolumeRestRep> copies = execute(new CreateFullCopy(volumeId, name, countValue));
addAffectedResources(copies);
return copies;
}
use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getVolumesBySite.
public static NamedVolumesList getVolumesBySite(ViPRCoreClient client, String virtualArrayId, URI applicationId) {
boolean isTarget = false;
URI virtualArray = null;
if (virtualArrayId != null && StringUtils.split(virtualArrayId, ':')[0].equals("tgt")) {
virtualArray = URI.create(StringUtils.substringAfter(virtualArrayId, ":"));
isTarget = true;
} else {
isTarget = false;
}
NamedVolumesList applicationVolumes = client.application().getVolumeByApplication(applicationId);
NamedVolumesList volumesToUse = new NamedVolumesList();
for (NamedRelatedResourceRep volumeId : applicationVolumes.getVolumes()) {
VolumeRestRep parentVolume = client.blockVolumes().get(volumeId);
if (isTarget) {
if (isRPTargetVolume(parentVolume) && parentVolume.getVirtualArray().getId().equals(virtualArray)) {
volumesToUse.getVolumes().add(volumeId);
}
} else {
if (!BlockStorageUtils.isRPVolume(parentVolume) || BlockStorageUtils.isRPSourceVolume(parentVolume)) {
volumesToUse.getVolumes().add(volumeId);
}
}
}
return volumesToUse;
}
use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getReplicationGroupVolumes.
public static Table<URI, String, VolumeRestRep> getReplicationGroupVolumes(List<NamedRelatedResourceRep> volumeUris) {
// Group volumes by storage system and replication group
Table<URI, String, VolumeRestRep> storageRgToVolumes = HashBasedTable.create();
for (NamedRelatedResourceRep volumeUri : volumeUris) {
VolumeRestRep vplexVolume = null;
VolumeRestRep volume = execute(new GetBlockVolume(volumeUri.getId()));
boolean isVPlex = volume.getSystemType().equals("vplex");
if (isVPlex) {
vplexVolume = volume;
volume = getSourceVolume(volume);
}
String rgName = BlockStorageUtils.stripRPTargetFromReplicationGroup(volume.getReplicationGroupInstance());
URI storage = volume.getStorageController();
if (!storageRgToVolumes.contains(storage, rgName)) {
if (isVPlex) {
storageRgToVolumes.put(storage, rgName, vplexVolume);
} else {
storageRgToVolumes.put(storage, rgName, volume);
}
}
}
return storageRgToVolumes;
}
use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method removeContinuousCopy.
private static void removeContinuousCopy(URI volumeId, URI continuousCopyId, VolumeDeleteTypeEnum type) {
if (VolumeDeleteTypeEnum.VIPR_ONLY != type) {
BlockObjectRestRep obj = getVolume(volumeId);
if (obj instanceof VolumeRestRep) {
VolumeRestRep volume = (VolumeRestRep) obj;
if (!StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vplex.name())) {
execute(new PauseContinuousCopy(volumeId, continuousCopyId, COPY_NATIVE));
}
}
}
Tasks<VolumeRestRep> tasks = execute(new DeactivateContinuousCopy(volumeId, continuousCopyId, COPY_NATIVE, type));
addAffectedResources(tasks);
}
use of com.emc.storageos.model.block.VolumeRestRep 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