use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doSnapshotFS.
@Override
public BiosCommandResult doSnapshotFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
_logger.info("creating file system {} snap {} ", args.getFsName(), args.getSnapshotLabel());
VNXeApiClient apiClient = getVnxeClient(storage);
VNXeCommandJob job = null;
VNXeFSSnapshotTaskCompleter completer = null;
try {
job = apiClient.createFileSystemSnap(args.getFsNativeId(), args.getSnapshotName());
if (job != null) {
completer = new VNXeFSSnapshotTaskCompleter(Snapshot.class, args.getSnapshotId(), args.getOpId());
VNXeCreateFileSystemSnapshotJob snapJob = new VNXeCreateFileSystemSnapshotJob(job.getId(), storage.getId(), completer);
ControllerServiceImpl.enqueueJob(new QueueJob(snapJob));
} else {
_logger.error("No job returned from createFileSystemSnap");
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("snapshotFileSystem", "No Job returned from createFileSystemSnap");
return BiosCommandResult.createErrorResult(error);
}
} catch (VNXeException e) {
_logger.error("Create file system snapshot got the exception", e);
if (completer != null) {
completer.error(_dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Create file system snpashot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateFileSystemSnapshot", ex.getMessage());
if (completer != null) {
completer.error(_dbClient, error);
}
return BiosCommandResult.createErrorResult(error);
}
StringBuilder logMsgBuilder = new StringBuilder(String.format("Create filesystem snapshot job submitted - Array:%s, fileSystem: %s", storage.getSerialNumber(), args.getFsName()));
_logger.info(logMsgBuilder.toString());
return BiosCommandResult.createPendingResult();
}
use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class VmaxCloneOperations method createGroupClone.
/**
* Should implement create of a clone from a source volume that is part of a
* consistency group.
*
* Implementation note: In this method we will kick of the asynchronous creation
* of the target devices required for the CG clones. Upon the successful
* device creation, the post operations will take place, which will include the
* creation of the target group and the group clone operation.
*
* @param storage [required] - StorageSystem object representing the array
* @param cloneList [required] - clone URI list
* @param createInactive whether the clone needs to to be created with sync_active=true/false
* @param taskCompleter - TaskCompleter object used for the updating operation status.
* @throws DeviceControllerException
*/
@Override
public void createGroupClone(StorageSystem storage, List<URI> cloneList, Boolean createInactive, TaskCompleter taskCompleter) {
_log.info("START create group clone operation");
// Target group CIM Path
CIMObjectPath targetGroupPath = null;
// List of target device ids
List<String> targetDeviceIds = null;
// The source consistency group name
String sourceGroupName = null;
try {
final Volume first = _dbClient.queryObject(Volume.class, cloneList.get(0));
Volume sourceVolume = _dbClient.queryObject(Volume.class, first.getAssociatedSourceVolume());
sourceGroupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(sourceVolume, _dbClient);
URI tenant = sourceVolume.getTenant().getURI();
TenantOrg tenantOrg = _dbClient.queryObject(TenantOrg.class, tenant);
String targetGroupLabel = generateLabel(tenantOrg, sourceVolume);
// CTRL-5640: ReplicationGroup may not be accessible after provider fail-over.
ReplicationUtils.checkReplicationGroupAccessibleOrFail(storage, sourceVolume, _dbClient, _helper, _cimPath);
final Map<String, List<Volume>> clonesBySizeMap = new HashMap<String, List<Volume>>();
List<Volume> clones = _dbClient.queryObject(Volume.class, cloneList);
// created separately before 'CreateGroupReplica' call.
if (storage.checkIfVmax3() || !storage.getUsingSmis80()) {
targetDeviceIds = new ArrayList<String>();
for (Volume clone : clones) {
final URI poolId = clone.getPool();
Volume source = _dbClient.queryObject(Volume.class, clone.getAssociatedSourceVolume());
// Create target devices
final List<String> newDeviceIds = ReplicationUtils.createTargetDevices(storage, sourceGroupName, clone.getLabel(), createInactive, 1, poolId, clone.getCapacity(), source.getThinlyProvisioned(), source, taskCompleter, _dbClient, _helper, _cimPath);
targetDeviceIds.addAll(newDeviceIds);
}
// Create target device group
targetGroupPath = ReplicationUtils.createTargetDeviceGroup(storage, sourceGroupName, targetDeviceIds, taskCompleter, _dbClient, _helper, _cimPath, SYNC_TYPE.CLONE);
}
// Create CG clone
CIMObjectPath job = VmaxGroupOperationsUtils.internalCreateGroupReplica(storage, sourceGroupName, targetGroupLabel, targetGroupPath, createInactive, taskCompleter, SYNC_TYPE.CLONE, _dbClient, _helper, _cimPath);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisCreateCGCloneJob(job, storage.getId(), !createInactive, taskCompleter)));
}
} catch (Exception e) {
final String errMsg = format("An exception occurred when trying to create clones for consistency group {0} on storage system {1}", sourceGroupName, storage.getId());
_log.error(errMsg, e);
// Roll back changes
ReplicationUtils.rollbackCreateReplica(storage, targetGroupPath, targetDeviceIds, taskCompleter, _dbClient, _helper, _cimPath);
List<Volume> clones = _dbClient.queryObject(Volume.class, cloneList);
for (Volume clone : clones) {
clone.setInactive(true);
}
_dbClient.persistObject(clones);
ServiceError error = DeviceControllerErrors.smis.methodFailed("createGroupClones", e.getMessage());
taskCompleter.error(_dbClient, error);
}
}
use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class VmaxCloneOperations method resyncGroupClones.
/**
* Implementation for resync clones in CG.
*
* @param storage [required] - StorageSystem object representing the array
* @param clones [required] - URIs representing the previously created clones
* @param taskCompleter - TaskCompleter object used for the updating operation status.
*/
@Override
@SuppressWarnings("rawtypes")
public void resyncGroupClones(StorageSystem storage, List<URI> clones, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("START resync group clone operation");
try {
callEMCRefreshIfRequired(_dbClient, _helper, storage, clones);
Volume clone = _dbClient.queryObject(Volume.class, clones.get(0));
Volume sourceVol = _dbClient.queryObject(Volume.class, clone.getAssociatedSourceVolume());
String consistencyGroupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(sourceVol, _dbClient);
String replicationGroupName = clone.getReplicationGroupInstance();
CIMObjectPath groupSynchronized = _cimPath.getGroupSynchronizedPath(storage, consistencyGroupName, replicationGroupName);
if (_helper.checkExists(storage, groupSynchronized, false, false) != null) {
CIMObjectPath cimJob = null;
CIMArgument[] resyncCGCloneInput = _helper.getResyncReplicaInputArguments(groupSynchronized);
cimJob = _helper.callModifyReplica(storage, resyncCGCloneInput);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisCloneResyncJob(cimJob, storage.getId(), taskCompleter)));
} else {
ServiceError error = DeviceControllerErrors.smis.unableToFindSynchPath(consistencyGroupName);
taskCompleter.error(_dbClient, error);
}
} catch (Exception e) {
String message = String.format("Exception when trying to resync clones from consistency group on array %s", storage.getSerialNumber());
_log.error(message, e);
taskCompleter.error(_dbClient, DeviceControllerException.exceptions.resynchronizeFullCopyFailed(e));
}
}
use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class VmaxCloneOperations method restoreGroupClones.
/**
* Implementation for restoring of clones in CG.
*
* @param storage [required] - StorageSystem object representing the array
* @param clones [required] - URIs representing the previously created clones
* @param taskCompleter - TaskCompleter object used for the updating operation status.
*/
@Override
@SuppressWarnings("rawtypes")
public void restoreGroupClones(StorageSystem storage, List<URI> clones, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("START restore group clone operation");
try {
callEMCRefreshIfRequired(_dbClient, _helper, storage, clones);
Volume clone = _dbClient.queryObject(Volume.class, clones.get(0));
Volume sourceVol = _dbClient.queryObject(Volume.class, clone.getAssociatedSourceVolume());
String consistencyGroupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(sourceVol, _dbClient);
String replicationGroupName = clone.getReplicationGroupInstance();
CIMObjectPath groupSynchronized = _cimPath.getGroupSynchronizedPath(storage, consistencyGroupName, replicationGroupName);
if (_helper.checkExists(storage, groupSynchronized, false, false) != null) {
CIMObjectPath cimJob = null;
CIMArgument[] restoreCGCloneInput = _helper.getRestoreFromReplicaInputArgumentsWithForce(groupSynchronized);
cimJob = _helper.callModifyReplica(storage, restoreCGCloneInput);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisCloneRestoreJob(cimJob, storage.getId(), taskCompleter)));
} else {
ServiceError error = DeviceControllerErrors.smis.unableToFindSynchPath(consistencyGroupName);
taskCompleter.error(_dbClient, error);
}
} catch (Exception e) {
String message = String.format("Exception when trying to restoring clones from consistency group on array %s", storage.getSerialNumber());
_log.error(message, e);
ServiceError error = DeviceControllerErrors.smis.methodFailed("restoreGroupClones", e.getMessage());
taskCompleter.error(_dbClient, error);
}
}
use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDevice method doUnexport.
@Override
public BiosCommandResult doUnexport(StorageSystem storage, FileDeviceInputOutput args, List<FileExport> exportList) throws ControllerException {
_logger.info("unexporting the file system: " + args.getFsName());
boolean isFile = args.getFileOperation();
for (FileExport exp : exportList) {
VNXeApiClient apiClient = getVnxUnityClient(storage);
String vnxeShareId = exp.getIsilonId();
VNXeCommandJob job = null;
VNXeFileTaskCompleter completer = null;
try {
if (isFile) {
String fsId = args.getFs().getNativeId();
job = apiClient.removeNfsShare(vnxeShareId, fsId);
} else {
job = apiClient.deleteNfsShareForSnapshot(vnxeShareId);
}
if (job != null) {
if (isFile) {
completer = new VNXeFileTaskCompleter(FileShare.class, args.getFsId(), args.getOpId());
} else {
completer = new VNXeFileTaskCompleter(Snapshot.class, args.getSnapshotId(), args.getOpId());
}
FileShareExport export = new FileShareExport(exp);
VNXeUnexportFileSystemJob unexportFSJob = new VNXeUnexportFileSystemJob(job.getId(), storage.getId(), completer, export, export.getPath(), isFile);
ControllerServiceImpl.enqueueJob(new QueueJob(unexportFSJob));
} else {
_logger.error("No job returned from exportFileSystem");
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystem", "No Job returned from deleteFileSystem");
return BiosCommandResult.createErrorResult(error);
}
} catch (VNXeException e) {
_logger.error("Unexport file system got the exception", e);
if (completer != null) {
completer.error(dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Delete file system got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystem", ex.getMessage());
if (completer != null) {
completer.error(dbClient, error);
}
return BiosCommandResult.createErrorResult(error);
}
StringBuilder logMsgBuilder = new StringBuilder(String.format("Unexport filesystem job submitted - Array:%s, fileSystem: %s", storage.getSerialNumber(), args.getFsName()));
_logger.info(logMsgBuilder.toString());
}
return BiosCommandResult.createPendingResult();
}
Aggregations