use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method relinkSnapshotSessionTargetGroup.
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
public void relinkSnapshotSessionTargetGroup(StorageSystem system, URI tgtSnapSessionURI, URI snapshotURI, TaskCompleter completer) throws DeviceControllerException {
// Only supported for VMAX3 storage systems.
if (!system.checkIfVmax3()) {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
try {
_log.info("Re-link target {} to snapshot session {} START", snapshotURI, tgtSnapSessionURI);
BlockSnapshotSession tgtSnapSession = _dbClient.queryObject(BlockSnapshotSession.class, tgtSnapSessionURI);
String syncAspectPath = tgtSnapSession.getSessionInstance();
BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, snapshotURI);
String groupName = ControllerUtils.extractGroupName(snapshot.getReplicationGroupInstance());
CIMObjectPath replicationGroupPath = _cimPath.getReplicationGroupPath(system, groupName);
// get source group name from the session.
String sourceGroupName = tgtSnapSession.getReplicationGroupInstance();
CIMObjectPath settingsStatePath = _cimPath.getGroupSynchronizedSettingsPath(system, sourceGroupName, syncAspectPath);
// We need to know if the group was linked in copy mode or nocopy mode.
CIMObjectPath groupSyncPath = _cimPath.getGroupSynchronizedPath(system, sourceGroupName, groupName);
boolean targetGroupLinkedInCopyMode = isTargetOrGroupCopyMode(system, groupSyncPath);
CIMArgument[] inArgs = null;
CIMArgument[] outArgs = new CIMArgument[5];
inArgs = _helper.getModifySettingsDefinedStateForRelinkTargetGroups(system, settingsStatePath, replicationGroupPath, targetGroupLinkedInCopyMode);
CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(system);
_helper.invokeMethod(system, replicationSvcPath, SmisConstants.MODIFY_SETTINGS_DEFINE_STATE, inArgs, outArgs);
CIMObjectPath jobPath = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockSnapshotSessionRelinkTargetJob(jobPath, system.getId(), completer)));
} catch (Exception e) {
_log.error("Exception re-linking snapshot session", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
completer.error(_dbClient, error);
}
}
use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method deleteSnapshotSession.
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
public void deleteSnapshotSession(StorageSystem system, URI snapSessionURI, String groupName, TaskCompleter completer) throws DeviceControllerException {
if (system.checkIfVmax3()) {
// Only supported for VMAX3 storage systems.
try {
_log.info("Delete snapshot session {} START", snapSessionURI);
BlockSnapshotSession snapSession = _dbClient.queryObject(BlockSnapshotSession.class, snapSessionURI);
String syncAspectPath = snapSession.getSessionInstance();
if (NullColumnValueGetter.isNullValue(syncAspectPath)) {
// If there is no session instance, it must have failed creation and
// this is method is being called due to a rollback.
_log.info("No session instance specified for snapshot session {}", snapSessionURI);
completer.ready(_dbClient);
} else {
CIMObjectPath settingsStatePath = null;
if (snapSession.hasConsistencyGroup() && NullColumnValueGetter.isNotNullValue(groupName)) {
settingsStatePath = _cimPath.getGroupSynchronizedSettingsPath(system, groupName, syncAspectPath);
} else {
BlockObject sourceObj = BlockObject.fetch(_dbClient, snapSession.getParent().getURI());
CIMObjectPath sourcePath = _cimPath.getBlockObjectPath(system, sourceObj);
settingsStatePath = _cimPath.getSyncSettingsPath(system, sourcePath, syncAspectPath);
}
CIMArgument[] inArgs = null;
CIMArgument[] outArgs = new CIMArgument[5];
inArgs = _helper.getDeleteSettingsForSnapshotInputArguments(settingsStatePath, false);
CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(system);
_helper.invokeMethod(system, replicationSvcPath, SmisConstants.MODIFY_SETTINGS_DEFINE_STATE, inArgs, outArgs);
CIMObjectPath jobPath = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockSnapshotSessionDeleteJob(jobPath, system.getId(), completer)));
}
} catch (Exception e) {
_log.error("Exception deleting snapshot session", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
completer.error(_dbClient, error);
}
} else {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
}
use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method relinkSnapshotSessionTarget.
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
public void relinkSnapshotSessionTarget(StorageSystem system, URI tgtSnapSessionURI, URI snapshotURI, TaskCompleter completer) throws DeviceControllerException {
// Only supported for VMAX3 storage systems.
if (!system.checkIfVmax3()) {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
try {
_log.info("Re-link target {} to snapshot session {} START", snapshotURI, tgtSnapSessionURI);
BlockSnapshotSession tgtSnapSession = _dbClient.queryObject(BlockSnapshotSession.class, tgtSnapSessionURI);
BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, snapshotURI);
URI sourceURI = tgtSnapSession.getParent().getURI();
BlockObject sourceObj = BlockObject.fetch(_dbClient, sourceURI);
CIMObjectPath sourcePath = _cimPath.getVolumePath(system, sourceObj.getNativeId());
CIMObjectPath syncObjPath = getSyncObject(system, snapshot, sourceObj);
boolean targetLinkedInCopyMode = isTargetOrGroupCopyMode(system, syncObjPath);
CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(system);
String syncAspectPath = tgtSnapSession.getSessionInstance();
CIMObjectPath settingsStatePath = _cimPath.getSyncSettingsPath(system, sourcePath, syncAspectPath);
CIMObjectPath targetDevicePath = _cimPath.getBlockObjectPath(system, snapshot);
CIMArgument[] inArgs = null;
CIMArgument[] outArgs = new CIMArgument[5];
inArgs = _helper.getModifySettingsDefinedStateForRelinkTargets(system, settingsStatePath, targetDevicePath, targetLinkedInCopyMode);
_helper.invokeMethod(system, replicationSvcPath, SmisConstants.MODIFY_SETTINGS_DEFINE_STATE, inArgs, outArgs);
CIMObjectPath jobPath = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockSnapshotSessionRelinkTargetJob(jobPath, system.getId(), completer)));
} catch (Exception e) {
_log.error("Exception re-linking snapshot session", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
completer.error(_dbClient, error);
}
}
use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method resyncSingleVolumeSnapshot.
/**
* Implementation for a single volume snapshot resynchronization.
*
* @param storage [required] - StorageSystem object representing the array
* @param volume [required] - Volume URI for the volume to be restored
* @param snapshot [required] - BlockSnapshot URI representing the previously created
* snap for the volume
* @param taskCompleter - TaskCompleter object used for the updating operation status.
*/
@Override
public void resyncSingleVolumeSnapshot(StorageSystem storage, URI volume, URI snapshot, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
if (storage.checkIfVmax3()) {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
callEMCRefreshIfRequired(_dbClient, _helper, storage, Arrays.asList(snapshot));
BlockSnapshot from = _dbClient.queryObject(BlockSnapshot.class, snapshot);
CIMObjectPath syncObjectPath = _cimPath.getSyncObject(storage, from);
CIMObjectPath cimJob = _helper.callModifyReplica(storage, _helper.getResyncSnapshotWithWaitInputArguments(syncObjectPath));
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockResyncSnapshotJob(cimJob, storage.getId(), taskCompleter)));
} catch (WBEMException e) {
String message = String.format("Error encountered when trying to resync snapshot %s on array %s", snapshot.toString(), storage.getSerialNumber());
_log.error(message, e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
taskCompleter.error(_dbClient, error);
} catch (Exception e) {
String message = String.format("Generic exception when trying to resync snapshot %s on array %s", snapshot.toString(), storage.getSerialNumber());
_log.error(message, e);
ServiceError error = DeviceControllerErrors.smis.methodFailed("resyncSingleVolumeSnapshot", e.getMessage());
taskCompleter.error(_dbClient, error);
}
}
use of com.emc.storageos.volumecontroller.impl.job.QueueJob in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method createGroupSnapshotSession.
/**
* {@inheritDoc}
*/
@Override
public void createGroupSnapshotSession(StorageSystem system, URI snapSessionURI, String groupName, TaskCompleter completer) throws DeviceControllerException {
if (system.checkIfVmax3()) {
_log.info("Create snapshot session group operation START");
BlockSnapshotSession snapSession = _dbClient.queryObject(BlockSnapshotSession.class, snapSessionURI);
BlockConsistencyGroup consistencyGroup = _dbClient.queryObject(BlockConsistencyGroup.class, snapSession.getConsistencyGroup());
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, consistencyGroup.getTenant().getURI());
String tenantName = tenant.getLabel();
final String label = _nameGenerator.generate(tenantName, snapSession.getSessionLabel(), snapSessionURI.toString(), '-', SmisConstants.MAX_SMI80_SNAPSHOT_NAME_LENGTH);
CIMObjectPath groupPath = _cimPath.getReplicationGroupPath(system, groupName);
try {
CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(system);
CIMArgument[] outArgs = new CIMArgument[5];
CIMArgument[] inArgs = _helper.getCreateSynchronizationAspectForGroupInput(groupPath, false, label, new Integer(SmisConstants.MODE_SYNCHRONOUS));
_helper.invokeMethod(system, replicationSvcPath, SmisConstants.CREATE_SYNCHRONIZATION_ASPECT, inArgs, outArgs);
CIMObjectPath jobPath = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockSnapshotSessionCGCreateJob(jobPath, system.getId(), completer)));
} catch (Exception e) {
_log.error("Exception creating group snapshot session ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
completer.error(_dbClient, error);
}
_log.info("Create snapshot session group operation FINISH");
} else {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
}
Aggregations