use of com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateSnapshotJob in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method createSingleVolumeSnapshot.
/**
* Should implement creation of a single volume snapshot. That is a volume that
* is not in any consistency group.
*
* @param storage [required] - StorageSystem object representing the array
* @param snapshot [required] - BlockSnapshot URI representing the previously created
* snap for the volume
* @param createInactive - whether the snapshot needs to to be created with sync_active=true/false
* @param readOnly - Indicates if the snapshot should be read only.
* @param taskCompleter - TaskCompleter object used for the updating operation status.
*/
@Override
public void createSingleVolumeSnapshot(StorageSystem storage, URI snapshot, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
// List of target device ids
List<String> targetDeviceIds = null;
try {
BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
_log.info("createSingleVolumeSnapshot operation START");
Volume volume = _dbClient.queryObject(Volume.class, snapshotObj.getParent());
// Need to terminate an restore sessions, so that we can
// restore from the same snapshot multiple times
terminateAnyRestoreSessionsForVolume(storage, volume, taskCompleter);
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, volume.getTenant().getURI());
String tenantName = tenant.getLabel();
String snapLabelToUse = _nameGenerator.generate(tenantName, snapshotObj.getLabel(), snapshot.toString(), '-', storage.getUsingSmis80() ? SmisConstants.MAX_SMI80_SNAPSHOT_NAME_LENGTH : SmisConstants.MAX_SNAPSHOT_NAME_LENGTH);
CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(storage);
CIMArgument[] inArgs = null;
CIMArgument[] outArgs = new CIMArgument[5];
if (storage.checkIfVmax3()) {
CIMObjectPath volumeGroupPath = _helper.getVolumeGroupPath(storage, storage, volume, null);
// COP-17240: For VMAX3, we will derive the target volumes from the source volumes SRP Pool
CIMObjectPath poolPath = _helper.getVolumeStoragePoolPath(storage, volume);
targetDeviceIds = createTargetDevices(storage, poolPath, volumeGroupPath, null, "SingleSnapshot", snapLabelToUse, createInactive, 1, volume.getCapacity(), taskCompleter);
CIMInstance replicaSettingData = _helper.getReplicationSettingData(storage, targetDeviceIds.get(0), false);
inArgs = _helper.getCreateElementReplicaSnapInputArgumentsWithTargetAndSetting(storage, volume, targetDeviceIds.get(0), replicaSettingData, createInactive, snapLabelToUse);
} else {
if (volume.getThinlyProvisioned()) {
CIMInstance replicationSetting = ReplicationUtils.getVPSnapReplicationSetting(storage, _helper, _cimPath);
inArgs = _helper.getCreateElementReplicaVPSnapInputArguments(storage, volume, createInactive, snapLabelToUse, replicationSetting);
} else {
inArgs = _helper.getCreateElementReplicaSnapInputArguments(storage, volume, createInactive, snapLabelToUse);
}
}
_helper.invokeMethod(storage, replicationSvcPath, SmisConstants.CREATE_ELEMENT_REPLICA, inArgs, outArgs);
CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateSnapshotJob(job, storage.getId(), !createInactive, taskCompleter)));
}
} catch (Exception e) {
_log.info("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
taskCompleter.error(_dbClient, error);
setInactive(snapshot, true);
// Roll back changes
if (storage.checkIfVmax3()) {
rollbackCreateSnapshot(storage, null, targetDeviceIds, taskCompleter);
}
}
}
use of com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateSnapshotJob in project coprhd-controller by CoprHD.
the class AbstractSnapshotOperations method createSingleVolumeSnapshot.
/**
* Should implement creation of a single volume snapshot. That is a volume that
* is not in any consistency group.
*
* @param storage [required] - StorageSystem object representing the array
* @param snapshot [required] - BlockSnapshot URI representing the previously created
* snap for the volume
* @param createInactive - Indicates if the snapshots should be created but not
* activated
* @param readOnly - Indicates if the snapshot should be read only.
* @param taskCompleter - TaskCompleter object used for the updating operation status.
*/
@Override
public void createSingleVolumeSnapshot(StorageSystem storage, URI snapshot, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
_log.info("createSingleVolumeSnapshot operation START");
Volume volume = _dbClient.queryObject(Volume.class, snapshotObj.getParent());
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, volume.getTenant().getURI());
String tenantName = tenant.getLabel();
String snapLabelToUse = _nameGenerator.generate(tenantName, snapshotObj.getLabel(), snapshot.toString(), '-', SmisConstants.MAX_SNAPSHOT_NAME_LENGTH);
CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(storage);
CIMArgument[] inArgs = _helper.getCreateElementReplicaSnapInputArguments(storage, volume, createInactive, snapLabelToUse);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.invokeMethod(storage, replicationSvcPath, SmisConstants.CREATE_ELEMENT_REPLICA, inArgs, outArgs);
CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateSnapshotJob(job, storage.getId(), !createInactive, taskCompleter)));
}
} catch (Exception e) {
_log.info("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
taskCompleter.error(_dbClient, error);
setInactive(snapshot, true);
}
}
Aggregations