use of com.emc.storageos.volumecontroller.BlockExportController in project coprhd-controller by CoprHD.
the class BlockExportControllerImpl method blockRMI.
/**
* Puts the operation in the zkQueue so it can Dispatch'd to a Device Controller
*
* @param methodName
* @param args
* @throws com.emc.storageos.volumecontroller.ControllerException
*/
private void blockRMI(String methodName, Object... args) throws ControllerException {
final URI export = (URI) args[0];
BlockExportController controller = getExportController();
_dispatcher.queue(export, "export", controller, methodName, args);
}
use of com.emc.storageos.volumecontroller.BlockExportController in project coprhd-controller by CoprHD.
the class BlockExportControllerImpl method updatePolicyAndLimits.
/**
* Updates the Auto-tiering policy from a new vPool for the given volumes.
*
* @param volumeURIs the volume uris
* @param newVpoolURI - URI of new Vpool
* @param opId the op id
* @throws ControllerException the controller exception
*/
@Override
public void updatePolicyAndLimits(List<URI> volumeURIs, URI newVpoolURI, String opId) throws ControllerException {
BlockExportController controller = getExportController();
_dispatcher.queue(volumeURIs.get(0), "export", controller, "updatePolicyAndLimits", volumeURIs, newVpoolURI, opId);
}
use of com.emc.storageos.volumecontroller.BlockExportController in project coprhd-controller by CoprHD.
the class AbstractBlockServiceApiImpl method checkCommonVpoolUpdates.
/**
* Checks for Vpool updates that can be done on any device type.
* For now, this is just the Export Path Params or Auto-tiering policy change.
* If the update was processed, return true, else false.
*
* @param volumes
* @param newVirtualPool
* @param taskId
* @return true if update processed
* @throws InternalException
*/
protected boolean checkCommonVpoolUpdates(List<Volume> volumes, VirtualPool newVirtualPool, String taskId) throws InternalException {
VirtualPool volumeVirtualPool = _dbClient.queryObject(VirtualPool.class, volumes.get(0).getVirtualPool());
StringBuffer notSuppReasonBuff = new StringBuffer();
if (VirtualPoolChangeAnalyzer.isSupportedPathParamsChange(volumes.get(0), volumeVirtualPool, newVirtualPool, _dbClient, notSuppReasonBuff)) {
BlockExportController exportController = getController(BlockExportController.class, BlockExportController.EXPORT);
for (Volume volume : volumes) {
exportController.updateVolumePathParams(volume.getId(), newVirtualPool.getId(), taskId);
}
return true;
}
if (VirtualPoolChangeAnalyzer.isSupportedAutoTieringPolicyAndLimitsChange(volumes.get(0), volumeVirtualPool, newVirtualPool, _dbClient, notSuppReasonBuff)) {
/**
* If it is a Auto-tiering policy change, it is sufficient to check on one volume in the list.
* Mixed type volumes case has already been taken care in BlockService API.
*/
BlockExportController exportController = getController(BlockExportController.class, BlockExportController.EXPORT);
List<URI> volumeURIs = new ArrayList<URI>();
for (Volume volume : volumes) {
volumeURIs.add(volume.getId());
}
exportController.updatePolicyAndLimits(volumeURIs, newVirtualPool.getId(), taskId);
return true;
}
return false;
}
use of com.emc.storageos.volumecontroller.BlockExportController in project coprhd-controller by CoprHD.
the class ExportGroupService method deactivateExportGroup.
/**
* Deactivate block export. It will be deleted by the garbage collector on a
* subsequent iteration
* <p>
* This removes visibility of shared storage in the block export to servers through initiators in the block export.
* <p>
* If SAN Zones were created as a result of this Export Group (see Export Group Create), they will be removed if they are not in use by
* other Export Groups.
* <p>
*
* NOTE: This is an asynchronous operation.
*
* @param groupId Block export identifier
* @brief Delete block export
* @return Task resource representation
* @throws ControllerException
*/
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/deactivate")
@CheckPermission(roles = { Role.TENANT_ADMIN }, acls = { ACL.OWN, ACL.ALL })
public TaskResourceRep deactivateExportGroup(@PathParam("id") URI groupId) throws ControllerException {
String task = UUID.randomUUID().toString();
Operation op = null;
ExportGroup exportGroup = lookupExportGroup(groupId);
Map<URI, Map<URI, Integer>> storageMap = ExportUtils.getStorageToVolumeMap(exportGroup, true, _dbClient);
validateExportGroupNoPendingEvents(exportGroup);
// Validate that none of the volumes are mounted (datastores, etc)
if (exportGroup.getVolumes() != null) {
validateVolumesNotMounted(exportGroup, URIUtil.toURIList(exportGroup.getVolumes().keySet()));
}
// Don't allow deactivation if there is an operation in progress.
Set<URI> tenants = new HashSet<URI>();
tenants.add(exportGroup.getTenant().getURI());
Set<ExportGroup> dataObjects = new HashSet<ExportGroup>();
dataObjects.add(exportGroup);
checkForPendingTasks(tenants, dataObjects);
// Mark deletion in progress. This will cause future updates to fail.
exportGroup.addInternalFlags(DataObject.Flag.DELETION_IN_PROGRESS);
// Remove any associated ExportPathParam
if (exportGroup.getVolumes() != null && !exportGroup.getVolumes().isEmpty() && !exportGroup.getPathParameters().isEmpty()) {
removeBlockObjectsFromPathParamMap(URIUtil.uris(exportGroup.getVolumes().keySet()), exportGroup);
}
if (storageMap.isEmpty()) {
op = initTaskStatus(exportGroup, task, Operation.Status.ready, ResourceOperationTypeEnum.DELETE_EXPORT_GROUP);
_dbClient.markForDeletion(exportGroup);
} else {
op = initTaskStatus(exportGroup, task, Operation.Status.pending, ResourceOperationTypeEnum.DELETE_EXPORT_GROUP);
_dbClient.persistObject(exportGroup);
BlockExportController exportController = getExportController();
exportController.exportGroupDelete(exportGroup.getId(), task);
}
auditOp(OperationTypeEnum.DELETE_EXPORT_GROUP, true, AuditLogManager.AUDITOP_BEGIN, exportGroup.getLabel(), exportGroup.getId().toString(), exportGroup.getVirtualArray().toString(), exportGroup.getProject().toString());
return toTask(exportGroup, task, op);
}
use of com.emc.storageos.volumecontroller.BlockExportController in project coprhd-controller by CoprHD.
the class ExportGroupService method pathsAdjustment.
/**
* Export paths adjustment
*
* @param id The export group id
* @param param The parameters including addedPaths, removedPaths, storage system URI, exportPathParameters,
* and waitBeforeRemovePaths
* @brief Initiate port allocations for export
* @return The pending task
* @throws ControllerException
*/
@PUT
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/paths-adjustment")
@CheckPermission(roles = { Role.TENANT_ADMIN }, acls = { ACL.OWN, ACL.ALL })
public TaskResourceRep pathsAdjustment(@PathParam("id") URI id, ExportPathsAdjustmentParam param) throws ControllerException {
// Basic validation of ExportGroup and the request
ExportGroup exportGroup = queryObject(ExportGroup.class, id, true);
if (exportGroup.checkInternalFlags(DataObject.Flag.DELETION_IN_PROGRESS)) {
throw BadRequestException.badRequests.deletionInProgress(exportGroup.getClass().getSimpleName(), exportGroup.getLabel());
}
validateExportGroupNoPendingEvents(exportGroup);
validateSuspendSetForNonDiscoverableHosts(exportGroup, param.getWaitBeforeRemovePaths(), param.getRemovedPaths().isEmpty());
ArgValidator.checkUri(param.getStorageSystem());
StorageSystem system = queryObject(StorageSystem.class, param.getStorageSystem(), true);
// Log the input parameters
param.logParameters(_log);
// Get the virtual array, default to Export Group varray. Validate it matches.
URI varray = param.getVirtualArray();
if (varray != null) {
boolean validVarray = varray.equals(exportGroup.getVirtualArray());
if (exportGroup.getAltVirtualArrays() != null && varray.toString().equals(exportGroup.getAltVirtualArrays().get(system.getId().toString()))) {
validVarray = true;
}
if (!validVarray) {
throw APIException.badRequests.varrayNotInExportGroup(varray.toString());
}
} else {
varray = exportGroup.getVirtualArray();
}
validatePathAdjustment(exportGroup, system, param, varray);
Boolean wait = new Boolean(param.getWaitBeforeRemovePaths());
String task = UUID.randomUUID().toString();
Operation op = initTaskStatus(exportGroup, task, Operation.Status.pending, ResourceOperationTypeEnum.EXPORT_PATHS_ADJUSTMENT);
// persist the export group to the database
_dbClient.updateObject(exportGroup);
auditOp(OperationTypeEnum.EXPORT_PATH_ADJUSTMENT, true, AuditLogManager.AUDITOP_BEGIN, exportGroup.getLabel(), exportGroup.getId().toString(), exportGroup.getVirtualArray().toString(), exportGroup.getProject().toString());
TaskResourceRep taskRes = toTask(exportGroup, task, op);
BlockExportController exportController = getExportController();
_log.info("Submitting export path adjustment request.");
Map<URI, List<URI>> addedPaths = convertInitiatorPathParamToMap(param.getAdjustedPaths());
Map<URI, List<URI>> removedPaths = convertInitiatorPathParamToMap(param.getRemovedPaths());
ExportPathParams pathParam = new ExportPathParams(param.getExportPathParameters(), exportGroup);
exportController.exportGroupPortRebalance(param.getStorageSystem(), id, varray, addedPaths, removedPaths, pathParam, wait, task);
return taskRes;
}
Aggregations