use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.
the class BlockProvider method getBlockJournalSize.
@Asset("blockJournalSize")
@AssetDependencies("rpConsistencyGroupByProject")
public List<AssetOption> getBlockJournalSize(AssetOptionsContext ctx, URI consistencyGroup) {
String minimumSize = null;
BlockConsistencyGroupRestRep cg = api(ctx).blockConsistencyGroups().get(consistencyGroup);
// Get the first volume in the consistency group. All volumes will be source volumes
RelatedResourceRep vol = cg.getVolumes().get(0);
VolumeRestRep volume = api(ctx).blockVolumes().get(vol);
if (volume.getProtection() != null && volume.getProtection().getRpRep() != null && volume.getProtection().getRpRep().getProtectionSet() != null) {
RelatedResourceRep protectionSetId = volume.getProtection().getRpRep().getProtectionSet();
ProtectionSetRestRep protectionSet = api(ctx).blockVolumes().getProtectionSet(volume.getId(), protectionSetId.getId());
List<URI> protectionSetVolumeIds = new ArrayList<URI>();
for (RelatedResourceRep protectionVolume : protectionSet.getVolumes()) {
protectionSetVolumeIds.add(protectionVolume.getId());
}
List<VolumeRestRep> protectionSetVolumes = api(ctx).blockVolumes().withInternal(true).getByIds(protectionSetVolumeIds, null);
for (VolumeRestRep protectionVolume : protectionSetVolumes) {
if (protectionVolume.getProtection().getRpRep().getPersonality().equalsIgnoreCase("METADATA")) {
String capacity = protectionVolume.getCapacity();
if (minimumSize == null || Float.parseFloat(capacity) < Float.parseFloat(minimumSize)) {
minimumSize = capacity;
}
}
}
}
if (minimumSize == null) {
return Lists.newArrayList();
} else {
return Lists.newArrayList(newAssetOption(minimumSize, minimumSize));
}
}
use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.
the class BlockProvider method getCurrentExportPortGroups.
@Asset("exportCurrentPortGroup")
@AssetDependencies({ "host", "exportPathExport", "exportPathStorageSystem", "exportPathVirtualArray" })
public List<AssetOption> getCurrentExportPortGroups(AssetOptionsContext ctx, URI hostOrClusterId, URI exportId, URI storageSystemId, URI varrayId) {
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")) {
StoragePortGroupRestRepList portGroups = client.varrays().getStoragePortGroups(varrayId, exportId, storageSystemId, null, null, false);
return createPortGroupOptions(portGroups.getStoragePortGroups());
}
return options;
}
use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.
the class BlockProvider method getExportedVolumes.
@Asset("exportedBlockVolume")
@AssetDependencies("project")
public List<AssetOption> getExportedVolumes(AssetOptionsContext ctx, URI project) {
debug("getting source block volumes (project=%s)", project);
final ViPRCoreClient client = api(ctx);
// Filter volumes that are not RP Metadata
List<URI> volumeIds = getExportedVolumeIds(ctx, project);
FilterChain<VolumeRestRep> filter = new FilterChain<VolumeRestRep>(RecoverPointPersonalityFilter.METADATA.not());
filter.and(new BlockVolumeVMFSDatastoreFilter().not());
filter.and(new BlockVolumeBootVolumeFilter().not());
filter.and(new BlockVolumeMountPointFilter().not());
List<VolumeRestRep> volumes = client.blockVolumes().getByIds(volumeIds, filter);
return createVolumeWithVarrayOptions(client, volumes);
}
use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.
the class BlockProvider method getVolumeFilter.
@Asset("sourceVolumeFilter")
@AssetDependencies({ "project", "blockVirtualPool" })
public List<AssetOption> getVolumeFilter(AssetOptionsContext ctx, URI projectId, URI virtualPoolId) {
List<String> volumeNames = Lists.newArrayList();
for (VolumeRestRep volume : listSourceVolumes(api(ctx), projectId, new VirtualPoolFilter(virtualPoolId))) {
volumeNames.add(volume.getName());
}
Collections.sort(volumeNames, new StringComparator(false));
return VirtualDataCenterProvider.getVolumeFilterOptions(volumeNames);
}
use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.
the class BlockProvider method getBlockVolumes.
@Asset("unassignedVplexBlockVolume")
@AssetDependencies({ "project", "host", "virtualArray" })
public List<AssetOption> getBlockVolumes(AssetOptionsContext ctx, final URI projectId, URI hostOrClusterId, URI virtualArrayId) {
// get a list of all 'source' volumes that :
// - are in this project and not exported to the given host/cluster
// - are a 'source' volume
// - are vplex volumes
ViPRCoreClient client = api(ctx);
Set<URI> exportedBlockResources = BlockProvider.getExportedVolumes(client, projectId, hostOrClusterId, virtualArrayId);
UnexportedBlockResourceFilter<VolumeRestRep> unexportedFilter = new UnexportedBlockResourceFilter<VolumeRestRep>(exportedBlockResources);
SourceTargetVolumesFilter sourceTargetVolumesFilter = new SourceTargetVolumesFilter();
VplexVolumeFilter vplexVolumeFilter = new VplexVolumeFilter();
CachedResources<BlockVirtualPoolRestRep> blockVpools = new CachedResources<>(client.blockVpools());
VplexVolumeVirtualPoolFilter virtualPoolFilter = new VplexVolumeVirtualPoolFilter(blockVpools);
BlockVolumeBootVolumeFilter bootVolumeFilter = new BlockVolumeBootVolumeFilter();
FilterChain<VolumeRestRep> filter = sourceTargetVolumesFilter.and(unexportedFilter).and(bootVolumeFilter.not()).and(vplexVolumeFilter.or(virtualPoolFilter));
// perform the query and apply the filter
List<VolumeRestRep> volumes = client.blockVolumes().findByProject(projectId, filter);
// get a list of all volumes from our list that are in the target VArray, or use the target VArray for protection
List<BlockObjectRestRep> acceptedVolumes = getVPlexVolumesInTargetVArray(client, virtualArrayId, volumes);
return createVolumeOptions(client, acceptedVolumes);
}
Aggregations