use of com.emc.vipr.client.ViPRCoreClient 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.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class VirtualArrayProvider method getVirtualArray.
@Asset("virtualArray")
@AssetDependencies({ "host" })
public List<AssetOption> getVirtualArray(AssetOptionsContext context, URI hostOrClusterId) {
ViPRCoreClient client = api(context);
List<URI> hostIds = HostProvider.getHostIds(client, hostOrClusterId);
Map<URI, VirtualArrayRestRep> virtualArrays = null;
Map<URI, VirtualArrayRestRep> allVirtualArrays = Maps.newHashMap();
for (URI hostId : hostIds) {
Map<URI, VirtualArrayRestRep> connectedVirtualArrays = ResourceUtils.mapById(client.varrays().findByConnectedHost(hostId));
if (virtualArrays == null) {
virtualArrays = connectedVirtualArrays;
} else {
virtualArrays.keySet().retainAll(connectedVirtualArrays.keySet());
}
allVirtualArrays.putAll(connectedVirtualArrays);
}
// Creates options for the virtual arrays, showing an indication whether the virtual array is only
// partially connected to the cluster
List<AssetOption> fullyConnectedOptions = new ArrayList<>();
List<AssetOption> partiallyConnectedOptions = new ArrayList<>();
List<VirtualArrayRestRep> varraysByTenant = client.varrays().getByTenant(context.getTenant());
for (VirtualArrayRestRep varray : allVirtualArrays.values()) {
if (!contains(varray.getId(), varraysByTenant)) {
continue;
}
boolean fullyConnected = virtualArrays.containsKey(varray.getId());
if (fullyConnected) {
fullyConnectedOptions.add(new AssetOption(varray.getId(), varray.getName()));
} else {
String label = getMessage("virtualArray.partiallyConnected", varray.getName());
partiallyConnectedOptions.add(new AssetOption(varray.getId(), label));
}
}
AssetOptionsUtils.sortOptionsByLabel(fullyConnectedOptions);
AssetOptionsUtils.sortOptionsByLabel(partiallyConnectedOptions);
// Place the fully connected options first
List<AssetOption> options = new ArrayList<>();
options.addAll(fullyConnectedOptions);
options.addAll(partiallyConnectedOptions);
return options;
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class VirtualArrayProvider method getFileVirtualArrays.
@Asset("fileVirtualArray")
public List<AssetOption> getFileVirtualArrays(AssetOptionsContext context) {
ViPRCoreClient client = api(context);
// Get the set of virtual arrays that are associated with file vpools
Set<URI> varrayIds = new HashSet<>();
for (FileVirtualPoolRestRep vpool : client.fileVpools().getByTenant(context.getTenant())) {
varrayIds.addAll(ResourceUtils.refIds(vpool.getVirtualArrays()));
}
filterByContextTenant(varrayIds, client.varrays().getByTenant(context.getTenant()));
return createBaseResourceOptions(client.varrays().getByIds(varrayIds));
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class VirtualArrayProvider method getTargetVirtualArrays.
@Asset("fileTargetVirtualArray")
@AssetDependencies({ "fileFilePolicy", "unprotectedFilesystem" })
public List<AssetOption> getTargetVirtualArrays(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);
}
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class VirtualDataCenterProvider method getUnexportedIngestionMethod.
@Asset("unexportedIngestionMethod")
@AssetDependencies({ "unmanagedBlockStorageSystem" })
public List<AssetOption> getUnexportedIngestionMethod(AssetOptionsContext ctx, URI storageSystemId) {
ViPRCoreClient client = api(ctx);
StorageSystemRestRep storageSystemRestRep = client.storageSystems().get(storageSystemId);
List<AssetOption> options = Lists.newArrayList();
options.add(newAssetOption(IngestionMethodEnum.FULL.toString(), "unmanagedVolume.ingestMethod.full"));
if (BlockProviderUtils.isVplex(storageSystemRestRep)) {
options.add(newAssetOption(IngestionMethodEnum.VIRTUAL_VOLUMES_ONLY.toString(), "unmanagedVolume.ingestMethod.virtualVolumesOnly"));
}
return options;
}
Aggregations