use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.
the class BlockProvider method getExportPathStorageSystem.
@SuppressWarnings("incomplete-switch")
@Asset("exportPathStorageSystem")
@AssetDependencies({ "exportPathExport" })
public List<AssetOption> getExportPathStorageSystem(AssetOptionsContext ctx, URI exportId) {
ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
List<URI> storageSystemIds = new ArrayList<URI>();
ExportGroupRestRep export = client.blockExports().get(exportId);
List<ExportBlockParam> volumes = export.getVolumes();
for (ExportBlockParam volume : volumes) {
URI resourceId = volume.getId();
ResourceType volumeType = ResourceType.fromResourceId(resourceId.toString());
switch(volumeType) {
case VOLUME:
VolumeRestRep v = client.blockVolumes().get(resourceId);
if (v != null) {
storageSystemIds.add(v.getStorageController());
}
break;
case BLOCK_SNAPSHOT:
BlockSnapshotRestRep s = client.blockSnapshots().get(resourceId);
if (s != null) {
storageSystemIds.add(s.getStorageController());
}
break;
}
}
List<StorageSystemRestRep> storageSystems = client.storageSystems().getByIds(storageSystemIds);
for (StorageSystemRestRep storageSystem : storageSystems) {
String systemType = storageSystem.getSystemType();
if (Type.vmax.name().equalsIgnoreCase(systemType) || Type.vplex.name().equalsIgnoreCase(systemType)) {
options.add(new AssetOption(storageSystem.getId(), storageSystem.getName()));
}
}
return options;
}
use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.
the class BlockProvider method getPreviewStorageSystem.
@Asset("exportPathPreviewStorageSystem")
@AssetDependencies({ "host", "exportPathVirtualArray", "exportPathExport", "exportPathMinPathsOptions", "exportPathMaxPathsOptions", "exportPathPathsPerInitiatorOptions", "exportPathExistingPath", "exportPathStorageSystem", "exportPathPorts" })
public List<AssetOption> getPreviewStorageSystem(AssetOptionsContext ctx, URI hostOrClusterId, URI vArrayId, URI exportId, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, String useExisting, URI storageSystemId, String ports) {
List<AssetOption> options = Lists.newArrayList();
List<URI> exportPathPorts = parseExportPathPorts(ports);
ExportPathsAdjustmentPreviewRestRep portPreview = generateExportPathPreview(ctx, hostOrClusterId, vArrayId, exportId, minPaths, maxPaths, pathsPerInitiator, useExisting, storageSystemId, exportPathPorts);
options.add(new AssetOption(portPreview.getStorageSystem(), portPreview.getStorageSystem()));
return options;
}
use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.
the class BlockProvider method getApplicationVolumes.
@Asset("applicationBlockVolume")
@AssetDependencies("application")
public List<AssetOption> getApplicationVolumes(AssetOptionsContext ctx, URI application) {
final ViPRCoreClient client = api(ctx);
List<NamedRelatedResourceRep> volList = client.application().listVolumes(application);
List<AssetOption> options = new ArrayList<AssetOption>();
if (volList != null && !volList.isEmpty()) {
List<VolumeRestRep> allVols = client.blockVolumes().getByRefs(volList);
Map<String, List<VolumeRestRep>> repGrpVolMap = new HashMap<String, List<VolumeRestRep>>();
for (VolumeRestRep vol : allVols) {
if (!BlockProviderUtils.isRPTargetReplicationGroup(vol.getReplicationGroupInstance())) {
if (repGrpVolMap.get(vol.getReplicationGroupInstance()) == null) {
repGrpVolMap.put(vol.getReplicationGroupInstance(), new ArrayList<VolumeRestRep>());
}
repGrpVolMap.get(vol.getReplicationGroupInstance()).add(vol);
}
}
for (Entry<String, List<VolumeRestRep>> entry : repGrpVolMap.entrySet()) {
for (VolumeRestRep vol : entry.getValue()) {
options.add(new AssetOption(vol.getId(), getMessage("application.volumes.replication_group", vol.getName(), vol.getReplicationGroupInstance())));
}
}
}
return options;
}
use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.
the class BlockProvider method getApplicationFullCopyNamesForSite.
@Asset("siteFullCopyName")
@AssetDependencies({ "application", "applicationVirtualArray" })
public List<AssetOption> getApplicationFullCopyNamesForSite(AssetOptionsContext ctx, URI applicationId, URI applicationVirtualArray) {
List<VolumeRestRep> fullCopies = getFullCopiesForApplication(ctx, applicationId);
Set<String> fullCopyNames = new HashSet<String>();
for (VolumeRestRep vol : fullCopies) {
if (vol != null && vol.getProtection() != null && vol.getProtection().getFullCopyRep() != null && vol.getProtection().getFullCopyRep().getFullCopySetName() != null && (applicationVirtualArray == null || vol.getVirtualArray().getId().equals(applicationVirtualArray))) {
fullCopyNames.add(vol.getProtection().getFullCopyRep().getFullCopySetName());
}
}
return createStringOptions(fullCopyNames);
}
use of com.emc.sa.asset.annotation.AssetDependencies 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;
}
Aggregations