use of com.emc.storageos.model.block.BlockObjectRestRep 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.BlockObjectRestRep in project coprhd-controller by CoprHD.
the class CreateAndMountVolumeService method execute.
@Override
public void execute() throws Exception {
BlockObjectRestRep volume = createVolume();
acquireHostsLock();
ViPRService.artificialFailure(ArtificialFailures.ARTIFICIAL_FAILURE_AIX_MOUNT_VOLUME);
mountVolume(volume);
}
use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.
the class CreateAndMountVolumeService method execute.
@Override
public void execute() throws Exception {
BlockObjectRestRep volume = createVolume();
acquireHostsLock();
ViPRService.artificialFailure(ArtificialFailures.ARTIFICIAL_FAILURE_HPUX_MOUNT_VOLUME);
mountVolume(volume);
}
use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method removeBlockResources.
public static void removeBlockResources(Collection<URI> blockResourceIds, VolumeDeleteTypeEnum type) {
List<URI> allBlockResources = Lists.newArrayList(blockResourceIds);
for (URI volumeId : blockResourceIds) {
BlockObjectRestRep volume = getVolume(volumeId);
allBlockResources.addAll(getSrdfTargetVolumes(volume));
}
// export groups/masks if the volume is exported.
if (VolumeDeleteTypeEnum.VIPR_ONLY != type) {
removeBlockResourcesFromExports(allBlockResources);
}
for (URI volumeId : allBlockResources) {
if (canRemoveReplicas(volumeId)) {
removeSnapshotsForVolume(volumeId, type);
removeSnapshotSessionsForVolume(volumeId, type);
removeContinuousCopiesForVolume(volumeId, type);
removeFullCopiesForVolume(volumeId, blockResourceIds, type);
} else {
unexportReplicas(volumeId, blockResourceIds, type);
}
}
deactivateBlockResources(blockResourceIds, type);
}
use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getVolumeTagCommand.
/**
* Returns the viprcli command for adding a tag to a block volume
*
* @param blockObjectId the id of the block object
* @param tagName the tag name
* @param tagValue the tag value
* @return viprcli command
*/
public static String getVolumeTagCommand(URI blockObjectId, String tagName, String tagValue) {
BlockObjectRestRep blockObject = getBlockResource(blockObjectId);
URI projectId = getProjectId(blockObject);
ProjectRestRep project = getProject(projectId);
TenantOrgRestRep tenant = getTenant(project.getTenant().getId());
return ExecutionUtils.getMessage("viprcli.volume.tag", blockObject.getName(), tenant.getName(), project.getName(), tagName, tagValue);
}
Aggregations