use of com.emc.storageos.model.TaskList in project coprhd-controller by CoprHD.
the class SMISProviderService method scanSMISProviders.
/**
* Scan all SMI-S providers.
* <p>
* The method is deprecated. Use /vdc/storage-providers/scan instead.
*
* @brief Scan SMI-S providers
* @return TasList of all created asynchronous tasks
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN })
@Path("/scan")
public TaskList scanSMISProviders() {
TaskList taskList = new TaskList();
List<StorageProvider> providerList = CustomQueryUtility.getActiveStorageProvidersByInterfaceType(_dbClient, StorageProvider.InterfaceType.smis.name());
if (providerList == null || providerList.isEmpty()) {
return taskList;
}
BlockController controller = getController(BlockController.class, "vnxblock");
DiscoveredObjectTaskScheduler scheduler = new DiscoveredObjectTaskScheduler(_dbClient, new ScanJobExec(controller));
ArrayList<AsyncTask> tasks = new ArrayList<AsyncTask>();
for (StorageProvider smisProvider : providerList) {
String taskId = UUID.randomUUID().toString();
tasks.add(new AsyncTask(StorageProvider.class, smisProvider.getId(), taskId));
}
taskList = scheduler.scheduleAsyncTasks(tasks);
return taskList;
}
use of com.emc.storageos.model.TaskList in project coprhd-controller by CoprHD.
the class SRDFBlockServiceApiImpl method changeVolumeVirtualPool.
@Override
public TaskList changeVolumeVirtualPool(List<Volume> volumes, VirtualPool vpool, VirtualPoolChangeParam vpoolChangeParam, String taskId) throws InternalException {
TaskList taskList = createTasksForVolumes(vpool, volumes, taskId);
// Check for common Vpool updates handled by generic code. It returns true if handled.
if (checkCommonVpoolUpdates(volumes, vpool, taskId)) {
return taskList;
}
// TODO Modified the code for COP-20817 Needs to revisit this code flow post release.
// Run placement algorithm and collect all volume descriptors to create srdf target volumes in array.
List<VolumeDescriptor> volumeDescriptorsList = new ArrayList<>();
for (Volume volume : volumes) {
// Check if the volume is normal without CG but new vPool with CG enabled.
if (NullColumnValueGetter.isNullURI(volume.getConsistencyGroup()) && (null != vpool.getMultivolumeConsistency() && vpool.getMultivolumeConsistency())) {
_log.info("VPool change is not permitted as volume is not part of CG but new VPool is consistency enabled.");
throw APIException.badRequests.changeToVirtualPoolNotSupportedForNonCGVolume(volume.getId(), vpool.getLabel());
}
if (!NullColumnValueGetter.isNullNamedURI(volume.getSrdfParent()) || (volume.getSrdfTargets() != null && !volume.getSrdfTargets().isEmpty())) {
throw APIException.badRequests.srdfVolumeVPoolChangeNotSupported(volume.getId());
}
// Get the storage system.
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, volume.getStorageController());
String systemType = storageSystem.getSystemType();
if (DiscoveredDataObject.Type.vmax.name().equals(systemType)) {
_log.debug("SRDF Protection VirtualPool change for vmax volume.");
volumeDescriptorsList.addAll(upgradeToSRDFTargetVolume(volume, vpool, vpoolChangeParam, taskId));
} else {
// not vmax volume
throw APIException.badRequests.srdfVolumeVPoolChangeNotSupported(volume.getId());
}
}
// CG Volume(srdf target) creation should execute as a single operation.
// Otherwise, CreateGroupReplica method to create srdf pair between source and target group will have count
// mismatch problem.
BlockOrchestrationController controller = getController(BlockOrchestrationController.class, BlockOrchestrationController.BLOCK_ORCHESTRATION_DEVICE);
controller.createVolumes(volumeDescriptorsList, taskId);
_log.info("Change virutal pool steps has been successfully inititated");
return taskList;
}
use of com.emc.storageos.model.TaskList in project coprhd-controller by CoprHD.
the class SRDFBlockServiceApiImpl method createVolumesAndDescriptors.
@Override
public List<VolumeDescriptor> createVolumesAndDescriptors(List<VolumeDescriptor> descriptors, String volumeLabel, Long size, Project project, VirtualArray varray, VirtualPool vpool, List<Recommendation> recommendations, TaskList taskList, String task, VirtualPoolCapabilityValuesWrapper capabilities) {
List<VolumeDescriptor> volumeDescriptors = new ArrayList<VolumeDescriptor>();
// If processing SRDFCopyRecommendations, then just return the SRDFTargets.
for (Recommendation recommendation : recommendations) {
if (recommendation instanceof SRDFCopyRecommendation) {
SRDFRecommendation srdfRecommendation = (SRDFRecommendation) recommendation.getRecommendation();
// Get the Target structure
SRDFRecommendation.Target target = srdfRecommendation.getVirtualArrayTargetMap().get(recommendation.getVirtualArray());
if (target.getDescriptors() != null) {
volumeDescriptors.addAll(target.getDescriptors());
}
}
// so if we had SRDFCopyRecommendations, just return their descriptors now.
if (!volumeDescriptors.isEmpty()) {
return volumeDescriptors;
}
}
// operation for each volume to be created.
if (taskList == null) {
taskList = new TaskList();
}
Iterator<Recommendation> recommendationsIter;
final BlockConsistencyGroup consistencyGroup = capabilities.getBlockConsistencyGroup() == null ? null : _dbClient.queryObject(BlockConsistencyGroup.class, capabilities.getBlockConsistencyGroup());
// prepare the volumes
List<URI> volumeURIs = prepareRecommendedVolumes(task, taskList, project, varray, vpool, capabilities.getResourceCount(), recommendations, consistencyGroup, volumeLabel, size.toString());
// Execute the volume creations requests for each recommendation.
recommendationsIter = recommendations.iterator();
while (recommendationsIter.hasNext()) {
Recommendation recommendation = recommendationsIter.next();
volumeDescriptors.addAll(createVolumeDescriptors((SRDFRecommendation) recommendation, volumeURIs, capabilities));
// Log volume descriptor information
logVolumeDescriptorPrecreateInfo(volumeDescriptors, task);
}
return volumeDescriptors;
}
use of com.emc.storageos.model.TaskList in project coprhd-controller by CoprHD.
the class FileService method stopContinuousCopies.
/**
* Stop continuous copies.
*
* @prereq none
* @param id the URN of a ViPR Source file share
* @brief Stop the replication session between source and target file system.
* @return TaskList
* @throws ControllerException
*/
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/protection/continuous-copies/stop")
@CheckPermission(roles = { Role.TENANT_ADMIN }, acls = { ACL.OWN, ACL.ALL })
public TaskList stopContinuousCopies(@PathParam("id") URI id, FileReplicationParam param) throws ControllerException {
doMirrorOperationValidation(id, ProtectionOp.STOP.toString());
String task = UUID.randomUUID().toString();
FileShare sourceFileShare = queryResource(id);
Set<URI> unassignFrom = new HashSet<>();
unassignFrom.add(id);
FilePolicy filepolicy = FileSystemReplicationUtils.getReplicationPolicyAppliedOnFS(sourceFileShare, _dbClient);
Operation op = _dbClient.createTaskOpStatus(FileShare.class, id, task, ResourceOperationTypeEnum.FILE_PROTECTION_ACTION_STOP);
op.setDescription("stop the replication link between source and target");
FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
controller.unassignFilePolicy(filepolicy.getId(), unassignFrom, task);
auditOp(OperationTypeEnum.STOP_FILE_MIRROR, true, "BEGIN", sourceFileShare.getId().toString());
TaskList taskList = new TaskList();
TaskResourceRep taskResp = toTask(sourceFileShare, task, op);
taskList.getTaskList().add(taskResp);
return taskList;
}
use of com.emc.storageos.model.TaskList in project coprhd-controller by CoprHD.
the class FileService method createFSInternal.
/*
* all the common code for provisioning fs both in normal public API use case and
* the internal object case
* NOTE - below method should always work with project being null
*/
public TaskResourceRep createFSInternal(FileSystemParam param, Project project, TenantOrg tenant, DataObject.Flag[] flags) throws InternalException {
ArgValidator.checkFieldUriType(param.getVpool(), VirtualPool.class, "vpool");
ArgValidator.checkFieldUriType(param.getVarray(), VirtualArray.class, "varray");
Long fsSize = SizeUtil.translateSize(param.getSize());
// Convert to MB and check for 20MB min size.
Long fsSizeMB = fsSize / (1024 * 1024);
// Convert to MB and check for 20MB min size.
// VNX file has min 2MB size, NetApp 20MB and Isilon 0
// VNX File 8.1.6 min 1GB size
ArgValidator.checkFieldMinimum(fsSizeMB, 1024, "MB", "size");
ArrayList<String> requestedTypes = new ArrayList<String>();
// check varray
VirtualArray neighborhood = _dbClient.queryObject(VirtualArray.class, param.getVarray());
ArgValidator.checkEntity(neighborhood, param.getVarray(), false);
_permissionsHelper.checkTenantHasAccessToVirtualArray(tenant.getId(), neighborhood);
String task = UUID.randomUUID().toString();
// check vpool reference
VirtualPool cos = _dbClient.queryObject(VirtualPool.class, param.getVpool());
_permissionsHelper.checkTenantHasAccessToVirtualPool(tenant.getId(), cos);
ArgValidator.checkEntity(cos, param.getVpool(), false);
if (!VirtualPool.Type.file.name().equals(cos.getType())) {
throw APIException.badRequests.virtualPoolNotForFileBlockStorage(VirtualPool.Type.file.name());
}
// prepare vpool capability values
VirtualPoolCapabilityValuesWrapper capabilities = new VirtualPoolCapabilityValuesWrapper();
capabilities.put(VirtualPoolCapabilityValuesWrapper.SIZE, fsSize);
capabilities.put(VirtualPoolCapabilityValuesWrapper.RESOURCE_COUNT, new Integer(1));
if (VirtualPool.ProvisioningType.Thin.toString().equalsIgnoreCase(cos.getSupportedProvisioningType())) {
capabilities.put(VirtualPoolCapabilityValuesWrapper.THIN_PROVISIONING, Boolean.TRUE);
}
StringBuilder errorMsg = new StringBuilder();
if (cos.getFileReplicationSupported() && !FilePolicyServiceUtils.updatePolicyCapabilities(_dbClient, neighborhood, cos, project, null, capabilities, errorMsg)) {
_log.error("File system can not be created, ", errorMsg.toString());
throw APIException.badRequests.unableToProcessRequest(errorMsg.toString());
}
ArgValidator.checkFieldMaximum(param.getSoftLimit(), 100, "softLimit");
ArgValidator.checkFieldMaximum(param.getNotificationLimit(), 100, "notificationLimit");
if (param.getSoftLimit() != 0L) {
ArgValidator.checkFieldMinimum(param.getSoftGrace(), 1L, "softGrace");
}
if (param.getNotificationLimit() != 0) {
capabilities.put(VirtualPoolCapabilityValuesWrapper.SUPPORT_NOTIFICATION_LIMIT, Boolean.TRUE);
}
if (param.getSoftLimit() != 0) {
capabilities.put(VirtualPoolCapabilityValuesWrapper.SUPPORT_SOFT_LIMIT, Boolean.TRUE);
}
// verify quota
CapacityUtils.validateQuotasForProvisioning(_dbClient, cos, project, tenant, fsSize, "filesystem");
String suggestedNativeFsId = param.getFsId() == null ? "" : param.getFsId();
// Find the implementation that services this vpool and fileshare
FileServiceApi fileServiceApi = getFileServiceImpl(capabilities, _dbClient);
TaskList taskList = createFileTaskList(param, project, tenant, neighborhood, cos, flags, task);
// call thread that does the work.
CreateFileSystemSchedulingThread.executeApiTask(this, _asyncTaskService.getExecutorService(), _dbClient, neighborhood, project, cos, tenant, flags, capabilities, taskList, task, requestedTypes, param, fileServiceApi, suggestedNativeFsId);
auditOp(OperationTypeEnum.CREATE_FILE_SYSTEM, true, AuditLogManager.AUDITOP_BEGIN, param.getLabel(), param.getSize(), neighborhood.getId().toString(), project == null ? null : project.getId().toString());
// return the file share taskrep
return taskList.getTaskList().get(0);
}
Aggregations