use of com.emc.storageos.model.block.BlockSnapshotRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getProjectBlockResources.
protected List<BlockObjectRestRep> getProjectBlockResources(ViPRCoreClient client, URI hostOrClusterId, URI project, boolean onlyMounted) {
List<BlockObjectRestRep> blockObjects = Lists.newArrayList();
// the list of host ids that the volume could be mounted to
List<URI> hostIds = getHostIds(client, hostOrClusterId, onlyMounted);
// get a list of all volumes and snapshots in the project
List<VolumeRestRep> projectVolumes = client.blockVolumes().findByProject(project);
List<BlockSnapshotRestRep> projectSnapshots = client.blockSnapshots().findByProject(project);
// cycle through every volume in the project and add the volume and its snapshots
for (VolumeRestRep volume : projectVolumes) {
boolean isMounted = isMounted(hostIds, volume);
if ((onlyMounted && isMounted) || (!onlyMounted && !isMounted)) {
addVolume(blockObjects, volume, projectSnapshots);
}
}
// remaining snapshots can be added now. We don't know their parent volume but we need them in the list anyway
blockObjects.addAll(projectSnapshots);
return blockObjects;
}
use of com.emc.storageos.model.block.BlockSnapshotRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getExportSnapshotForHostPortGroups.
@Asset("exportSnapshotForHostPortGroups")
@AssetDependencies({ "unassignedBlockSnapshot", "host", "project" })
public List<AssetOption> getExportSnapshotForHostPortGroups(AssetOptionsContext ctx, String selectedSnapshots, URI hostOrClusterId, URI projectId) {
final ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
SimpleValueRep value = client.customConfigs().getCustomConfigTypeValue(VMAX_PORT_GROUP_ENABLED, VMAX);
if (value.getValue().equalsIgnoreCase("true")) {
List<URI> snapshotIds = Lists.newArrayList();
info("Snapshots selected by user: %s", selectedSnapshots);
List<String> parsedSnapshotIds = TextUtils.parseCSV(selectedSnapshots);
for (String id : parsedSnapshotIds) {
snapshotIds.add(uri(id));
}
List<BlockSnapshotRestRep> snapshots = client.blockSnapshots().getByIds(snapshotIds);
Set<URI> virtualArrays = new HashSet<URI>();
Set<URI> storageSystems = new HashSet<URI>();
for (BlockSnapshotRestRep snapshot : snapshots) {
virtualArrays.add(snapshot.getVirtualArray().getId());
storageSystems.add(snapshot.getStorageController());
}
if (virtualArrays.size() == 1 && storageSystems.size() == 1) {
Iterator<URI> it = virtualArrays.iterator();
URI varrayId = it.next();
ExportGroupRestRep export = findExportGroup(hostOrClusterId, projectId, varrayId, client);
Iterator<URI> ssIt = storageSystems.iterator();
StoragePortGroupRestRepList portGroups = client.varrays().getStoragePortGroups(varrayId, export != null ? export.getId() : null, ssIt.next(), null, null, true);
return createPortGroupOptions(portGroups.getStoragePortGroups());
}
}
return options;
}
use of com.emc.storageos.model.block.BlockSnapshotRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method startSnapshot.
public static void startSnapshot(URI snapshotId) {
Task<BlockSnapshotRestRep> task = execute(new StartBlockSnapshot(snapshotId));
addAffectedResource(task);
}
use of com.emc.storageos.model.block.BlockSnapshotRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method createSnapshotFullCopy.
public static Tasks<BlockSnapshotRestRep> createSnapshotFullCopy(URI snapshotId, String name, Integer count) {
int countValue = (count != null) ? count : 1;
Tasks<BlockSnapshotRestRep> copyTasks = ViPRExecutionUtils.execute(new CreateSnapshotFullCopy(snapshotId, name, countValue));
addAffectedResources(copyTasks);
return copyTasks;
}
use of com.emc.storageos.model.block.BlockSnapshotRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method deactivateSnapshot.
private static void deactivateSnapshot(URI snapshotId, VolumeDeleteTypeEnum type) {
Tasks<BlockSnapshotRestRep> tasks = execute(new DeactivateBlockSnapshot(snapshotId, type));
addAffectedResources(tasks);
}
Aggregations