use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getApplicationSnapshotVirtualArrays.
@Asset("applicationSnapshotVirtualArray")
@AssetDependencies("application")
public List<AssetOption> getApplicationSnapshotVirtualArrays(AssetOptionsContext ctx, URI applicationId) {
final ViPRCoreClient client = api(ctx);
List<NamedRelatedResourceRep> volList = client.application().listVolumes(applicationId);
List<AssetOption> options = new ArrayList<AssetOption>();
boolean isVplex = false;
boolean isRP = false;
URI sourceVarrayId = null;
List<VolumeRestRep> allRPSourceVols = null;
if (volList != null && !volList.isEmpty()) {
VolumeRestRep vol = client.blockVolumes().get(volList.get(0));
StorageSystemRestRep sys = client.storageSystems().get(vol.getStorageController());
if (sys.getSystemType().equals("vplex")) {
isVplex = true;
sourceVarrayId = vol.getVirtualArray().getId();
}
if (BlockProviderUtils.isVolumeRP(vol)) {
isRP = true;
allRPSourceVols = client.blockVolumes().getByRefs(volList, RecoverPointPersonalityFilter.SOURCE);
if (allRPSourceVols != null && !allRPSourceVols.isEmpty()) {
VolumeRestRep rpvol = allRPSourceVols.get(0);
sourceVarrayId = rpvol.getVirtualArray().getId();
}
}
} else {
return options;
}
// if it's neither RP nor vplex, it's just a simple block volume application; site is not needed
if (!isVplex && !isRP) {
options.add(newAssetOption(URI.create("none"), "None"));
}
// if the volumes are vplex or RP display source as an option
if (isVplex || isRP) {
options.add(newAssetOption(sourceVarrayId, "protection.site.type.source"));
}
// if the volumes are RP (vplex or not) add the RP targets as options
if (isRP) {
Set<URI> targetVarrayIds = new HashSet<URI>();
List<AssetOption> targetOptions = new ArrayList<AssetOption>();
List<VolumeRestRep> allRPTargetVols = client.blockVolumes().getByRefs(volList, RecoverPointPersonalityFilter.TARGET);
for (VolumeRestRep targetVol : allRPTargetVols) {
targetVarrayIds.add(targetVol.getVirtualArray().getId());
}
List<VirtualArrayRestRep> targetVarrays = client.varrays().getByIds(targetVarrayIds);
for (VirtualArrayRestRep targetVarray : targetVarrays) {
targetOptions.add(newAssetOption(String.format("tgt:%s", targetVarray.getId().toString()), "protection.site.type.target", targetVarray.getName()));
}
// sort the targets
AssetOptionsUtils.sortOptionsByLabel(targetOptions);
options.addAll(targetOptions);
}
return options;
}
use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getFileFilesystemSourceArrayForAssociation.
@Asset("fileFilesystemSourceArray")
@AssetDependencies("fileFilesystemAssociation")
public List<AssetOption> getFileFilesystemSourceArrayForAssociation(AssetOptionsContext ctx, URI fsId) {
ViPRCoreClient client = api(ctx);
VirtualArrayRestRep vArray = null;
List<AssetOption> options = Lists.newArrayList();
FileShareRestRep fsObj = client.fileSystems().get(fsId);
if (fsObj != null) {
vArray = client.varrays().get(fsObj.getVirtualArray().getId());
options.add(createBaseResourceOption(vArray));
}
return options;
}
use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getSrdfFailoverTargets.
protected List<AssetOption> getSrdfFailoverTargets(ViPRCoreClient client, VolumeRestRep volume) {
Map<String, String> targetVolumes = Maps.newLinkedHashMap();
CachedResources<VirtualArrayRestRep> virtualArrays = new CachedResources<VirtualArrayRestRep>(client.varrays());
List<VirtualArrayRelatedResourceRep> srdfTargets = volume.getProtection().getSrdfRep().getSRDFTargetVolumes();
for (VolumeRestRep protectionSetVolume : client.blockVolumes().getByRefs(srdfTargets, new SRDFTargetFilter())) {
VirtualArrayRestRep virtualArray = virtualArrays.get(protectionSetVolume.getVirtualArray());
String label = getMessage("srdf.target", name(protectionSetVolume), name(virtualArray));
targetVolumes.put(stringId(protectionSetVolume), label);
}
List<AssetOption> options = Lists.newArrayList();
for (Map.Entry<String, String> entry : targetVolumes.entrySet()) {
options.add(new AssetOption(entry.getKey(), entry.getValue()));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.
the class VirtualArrayProvider method getVirtualArrayForStorageSystem.
protected List<AssetOption> getVirtualArrayForStorageSystem(AssetOptionsContext context, URI storageSystem) {
ViPRCoreClient client = api(context);
Set<String> virtualArrayIds = Sets.newHashSet();
for (StoragePortRestRep storagePortRestRep : client.storagePorts().getByStorageSystem(storageSystem)) {
virtualArrayIds.addAll(storagePortRestRep.getAssignedVirtualArrays());
virtualArrayIds.addAll(storagePortRestRep.getConnectedVirtualArrays());
}
List<VirtualArrayRestRep> virtualArrays = client.varrays().getByIds(ResourceUtils.uris(virtualArrayIds));
filterByContextTenant(virtualArrays, client.varrays().getByTenant(context.getTenant()));
return createBaseResourceOptions(virtualArrays);
}
use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.
the class VirtualArrayProvider method getFileTargetVirtualArrays.
@Asset("fileTargetVirtualArray")
@AssetDependencies({ "fileFilePolicy", "fileFilesystemAssociation" })
public List<AssetOption> getFileTargetVirtualArrays(AssetOptionsContext context, URI filePolicy, URI fsId) {
ViPRCoreClient client = api(context);
FilePolicyRestRep policyRest = client.fileProtectionPolicies().getFilePolicy(filePolicy);
if (policyRest.getType().equals("file_snapshot")) {
VirtualArrayRestRep vArray = null;
List<AssetOption> options = Lists.newArrayList();
FileShareRestRep fsObj = client.fileSystems().get(fsId);
if (fsObj != null) {
vArray = client.varrays().get(fsObj.getVirtualArray().getId());
options.add(createBaseResourceOption(vArray));
}
return options;
} else {
return getFileVirtualArrays(context);
}
}
Aggregations