use of com.emc.storageos.model.vpool.BlockVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getVPlexVolumesInTargetVArray.
/**
* Gets all {@link VolumeRestRep}s that are either in the target VArray or use the target VArray for protection
*
* @param client the ViPR client instance.
* @param targetVArrayId the target VArray ID.
* @param volumes the volumes we are concerned with. (These should be VPlex volumes)
* @return List of {@link VolumeRestRep}s that are VPlex volumes that are in the target VArray
*/
public static List<BlockObjectRestRep> getVPlexVolumesInTargetVArray(ViPRCoreClient client, URI targetVArrayId, List<VolumeRestRep> volumes) {
// collect vpools used by these volumes
Map<URI, BlockVirtualPoolRestRep> vpools = getVpoolsForVolumes(client, volumes);
// sift through the volumes to find ones with the correct VArray
List<BlockObjectRestRep> acceptedVolumes = Lists.newArrayList();
for (VolumeRestRep volume : volumes) {
if (volume.getVirtualArray().getId().equals(targetVArrayId)) {
addVolume(acceptedVolumes, volume);
} else {
// if this volume's HA type is 'distributed' and its distributed VArray matches the target VArray we can accept the volume
URI vpoolId = volume.getVirtualPool().getId();
BlockVirtualPoolRestRep volumeVpool = vpools.get(vpoolId);
if (volumeVpool != null && isVpoolProtectedByVarray(volumeVpool, targetVArrayId)) {
addVolume(acceptedVolumes, volume);
}
}
}
return acceptedVolumes;
}
use of com.emc.storageos.model.vpool.BlockVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class VirtualArrayProvider method getBlockVirtualArrays.
@Asset("blockVirtualArray")
public List<AssetOption> getBlockVirtualArrays(AssetOptionsContext context) {
ViPRCoreClient client = api(context);
// Get the set of virtual arrays that are associated with block vpools
Set<URI> varrayIds = new HashSet<>();
for (BlockVirtualPoolRestRep vpool : client.blockVpools().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.storageos.model.vpool.BlockVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class VirtualDataCenterProvider method getExportedIngestionMethod.
@Asset("exportedIngestionMethod")
@AssetDependencies({ "unmanagedBlockVirtualPool" })
public List<AssetOption> getExportedIngestionMethod(AssetOptionsContext ctx, URI virtualPoolId) {
ViPRCoreClient client = api(ctx);
BlockVirtualPoolRestRep virtualPoolRestRep = client.blockVpools().get(virtualPoolId);
List<AssetOption> options = Lists.newArrayList();
options.add(newAssetOption(IngestionMethodEnum.FULL.toString(), "unmanagedVolume.ingestMethod.full"));
if (virtualPoolRestRep.getHighAvailability() != null) {
options.add(newAssetOption(IngestionMethodEnum.VIRTUAL_VOLUMES_ONLY.toString(), "unmanagedVolume.ingestMethod.virtualVolumesOnly"));
}
return options;
}
use of com.emc.storageos.model.vpool.BlockVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class VirtualDataCenterProvider method getUnmanagedVolumeVirtualPools.
@Asset("unmanagedBlockVirtualPool")
@AssetDependencies({ "unmanagedBlockStorageSystem" })
public List<AssetOption> getUnmanagedVolumeVirtualPools(AssetOptionsContext ctx, URI storageSystem) {
Map<URI, Integer> vpools = getBlockVirtualPools(listUnmanagedVolumes(ctx, storageSystem));
Map<URI, BlockVirtualPoolRestRep> virtualPoolMap = BlockProvider.getBlockVirtualPools(api(ctx), vpools.keySet());
List<AssetOption> options = Lists.newArrayList();
for (Map.Entry<URI, Integer> entry : vpools.entrySet()) {
BlockVirtualPoolRestRep vpool = virtualPoolMap.get(entry.getKey());
if (vpool != null) {
options.add(newAssetOption(vpool.getId().toString(), "block.virtualPool.unmanaged", vpool.getName(), entry.getValue()));
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.vpool.BlockVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class ViPRClientApp method createBlockVolumeForHost.
public void createBlockVolumeForHost() {
List<HostRestRep> hosts = client.hosts().getByUserTenant(HostTypeFilter.ESX.not());
// User choice
HostRestRep selectedHost = chooseHost(hosts);
List<VirtualArrayRestRep> virtualArrays = client.varrays().findByConnectedHost(selectedHost);
// User choice
VirtualArrayRestRep selectedVirtualArray = chooseVirtualArray(virtualArrays);
List<BlockVirtualPoolRestRep> virtualPools = client.blockVpools().getByVirtualArray(selectedVirtualArray.getId());
// User choice
BlockVirtualPoolRestRep selectedVirtualPool = chooseVirtualPool(virtualPools);
List<ProjectRestRep> projects = client.projects().getByUserTenant();
// User choice
ProjectRestRep selectedProject = chooseProject(projects);
URI volumeId = createVolume(selectedVirtualArray, selectedVirtualPool, selectedProject);
List<ExportGroupRestRep> exports = new ArrayList<>();
if (exports.isEmpty()) {
createExport(volumeId, selectedHost, selectedVirtualArray, selectedProject);
} else {
addVolumeToExport(volumeId, exports.get(0));
}
}
Aggregations