use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getLocalSnapshotBlockVolumes.
@Asset("localSnapshotBlockVolume")
@AssetDependencies({ "project" })
public List<AssetOption> getLocalSnapshotBlockVolumes(AssetOptionsContext context, URI project) {
final ViPRCoreClient client = api(context);
List<VolumeRestRep> volumes = listVolumes(client, project);
List<VolumeDetail> volumeDetails = getVolumeDetails(client, volumes);
Map<URI, VolumeRestRep> volumeNames = ResourceUtils.mapById(volumes);
List<AssetOption> options = Lists.newArrayList();
for (VolumeDetail detail : volumeDetails) {
if (isLocalSnapshotSupported(detail.vpool)) {
options.add(createVolumeOption(client, null, detail.volume, volumeNames));
}
}
return options;
}
use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class VMWareProvider method getUnassignedDatastores.
@Asset("unassignedBlockDatastore")
@AssetDependencies({ "esxHost", "project" })
public List<AssetOption> getUnassignedDatastores(AssetOptionsContext ctx, URI hostOrClusterId, final URI projectId) {
ViPRCoreClient client = api(ctx);
Set<URI> exportedBlockResources = BlockProvider.getExportedVolumes(api(ctx), projectId, hostOrClusterId, null);
UnexportedBlockResourceFilter<VolumeRestRep> unexportedFilter = new UnexportedBlockResourceFilter<VolumeRestRep>(exportedBlockResources);
SourceTargetVolumesFilter sourceTargetVolumesFilter = new SourceTargetVolumesFilter();
BlockVolumeBootVolumeFilter bootVolumeFilter = new BlockVolumeBootVolumeFilter();
List<VolumeRestRep> volumes = client.blockVolumes().findByProject(projectId, unexportedFilter.and(sourceTargetVolumesFilter).and(bootVolumeFilter.not()));
return createBlockVolumeDatastoreOptions(volumes, hostOrClusterId);
}
use of com.emc.storageos.model.block.VolumeRestRep in project coprhd-controller by CoprHD.
the class RestoreApplicationFullCopy method doExecute.
@Override
protected Tasks<TaskResourceRep> doExecute() throws Exception {
List<URI> volumeIds = new ArrayList<URI>();
List<VolumeRestRep> allCopyVols = getClient().blockVolumes().getByRefs(getClient().application().getFullCopiesByApplication(applicationId).getVolumes());
List<VolumeRestRep> volsForCopy = filterByCopyName(allCopyVols);
if (volsForCopy != null && !volsForCopy.isEmpty()) {
for (String subGroup : applicationSubGroup) {
URI volInSubGroup = findVolumeInSubGroup(volsForCopy, subGroup);
if (volInSubGroup != null) {
volumeIds.add(volInSubGroup);
}
}
}
if (volumeIds.isEmpty()) {
ExecutionUtils.fail("failTask.RestoreApplicationFullCopyService.volumeId.precheck", new Object[] {});
}
VolumeGroupFullCopyRestoreParam input = new VolumeGroupFullCopyRestoreParam(true, volumeIds);
TaskList taskList = getClient().application().restoreApplicationFullCopy(applicationId, input);
return new Tasks<TaskResourceRep>(getClient().auth().getClient(), taskList.getTaskList(), TaskResourceRep.class);
}
use of com.emc.storageos.model.block.VolumeRestRep 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.VolumeRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method startFullCopy.
public static void startFullCopy(URI fullCopyId) {
Tasks<VolumeRestRep> task = execute(new StartFullCopy(fullCopyId));
addAffectedResources(task);
}
Aggregations