use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method activateSingleVolumeSnapshot.
/**
* This interface is for the snapshot active. The createSnapshot may have done
* whatever is necessary to setup the snapshot for this call. The goal is to
* make this a quick operation and the create operation has already done a lot
* of the "heavy lifting".
*
* @param storage [required] - StorageSystem object representing the array
* @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 activateSingleVolumeSnapshot(StorageSystem storage, URI snapshot, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
if (snapshotObj.getIsSyncActive()) {
_log.warn("Trying to activate snapshot, which is already active", snapshotObj.getId().toString());
return;
}
_log.info("activateSingleVolumeSnapshot operation START");
CIMArgument[] inArgs = _helper.getActivateSnapshotInputArguments(storage, snapshotObj);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.callModifyReplica(storage, inArgs, outArgs);
setIsSyncActive(snapshotObj, true);
snapshotObj.setRefreshRequired(true);
_dbClient.persistObject(snapshotObj);
// Success -- Update status
taskCompleter.ready(_dbClient);
} catch (Exception e) {
_log.info("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
taskCompleter.error(_dbClient, error);
} finally {
_log.info("activateSingleVolumeSnapshot operation END");
}
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class VnxCloneOperations 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 clonetList [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) throws DeviceControllerException {
log.info("START create group clone operation");
// 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);
if (!ControllerUtils.isNotInRealVNXRG(sourceVolume, _dbClient)) {
// CTRL-5640: ReplicationGroup may not be accessible after provider fail-over.
ReplicationUtils.checkReplicationGroupAccessibleOrFail(storage, sourceVolume, _dbClient, _helper, _cimPath);
}
// Group volumes by pool and size
List<String> sourceIds = new ArrayList<String>();
List<Volume> clones = _dbClient.queryObject(Volume.class, cloneList);
for (Volume clone : clones) {
final Volume volume = _dbClient.queryObject(Volume.class, clone.getAssociatedSourceVolume());
sourceIds.add(volume.getNativeId());
}
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);
}
CIMObjectPath[] cloneVolumePaths = _cimPath.getVolumePaths(storage, targetDeviceIds.toArray(new String[targetDeviceIds.size()]));
CIMObjectPath[] sourceVolumePaths = _cimPath.getVolumePaths(storage, sourceIds.toArray(new String[sourceIds.size()]));
// Create list replica
CIMObjectPath replicationSvc = _cimPath.getControllerReplicationSvcPath(storage);
CIMArgument[] inArgs = _helper.getCreateListReplicaInputArguments(storage, sourceVolumePaths, cloneVolumePaths);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.invokeMethod(storage, replicationSvc, CREATE_LIST_REPLICA, inArgs, outArgs);
CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, JOB);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisVnxCreateCGCloneJob(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, null, 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);
}
log.info("createGroupClone operation END");
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class VnxMirrorOperations method createGroupMirrors.
/**
* Should implement create of a mirror 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 mirrorList [required] - mirror URI list
* @param createInactive whether the mirror 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 createGroupMirrors(StorageSystem storage, List<URI> mirrorList, Boolean createInactive, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("createGroupMirrors operation START");
List<BlockMirror> mirrors = null;
List<String> targetDeviceIds = null;
try {
mirrors = _dbClient.queryObject(BlockMirror.class, mirrorList);
BlockMirror firstMirror = mirrors.get(0);
Volume sourceVolume = _dbClient.queryObject(Volume.class, firstMirror.getSource());
String sourceGroupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(sourceVolume, _dbClient);
if (!ControllerUtils.isNotInRealVNXRG(sourceVolume, _dbClient)) {
// CTRL-5640: ReplicationGroup may not be accessible after provider fail-over.
ReplicationUtils.checkReplicationGroupAccessibleOrFail(storage, sourceVolume, _dbClient, _helper, _cimPath);
}
List<String> sourceIds = new ArrayList<String>();
targetDeviceIds = new ArrayList<String>();
Map<String, String> tgtToSrcMap = new HashMap<String, String>();
for (BlockMirror mirror : mirrors) {
final URI poolId = mirror.getPool();
final Volume source = _dbClient.queryObject(Volume.class, mirror.getSource());
sourceIds.add(source.getNativeId());
// Create target devices
final List<String> newDeviceIds = ReplicationUtils.createTargetDevices(storage, sourceGroupName, mirror.getLabel(), createInactive, 1, poolId, mirror.getCapacity(), source.getThinlyProvisioned(), null, taskCompleter, _dbClient, _helper, _cimPath);
targetDeviceIds.addAll(newDeviceIds);
tgtToSrcMap.put(newDeviceIds.get(0), source.getNativeId());
}
CIMObjectPath[] targetDevicePaths = _cimPath.getVolumePaths(storage, targetDeviceIds.toArray(new String[targetDeviceIds.size()]));
CIMObjectPath[] sourceDevicePaths = _cimPath.getVolumePaths(storage, sourceIds.toArray(new String[sourceIds.size()]));
// Create list replica
CIMObjectPath replicationSvc = _cimPath.getControllerReplicationSvcPath(storage);
CIMArgument[] inArgs = _helper.getCreateListReplicaInputArguments(storage, sourceDevicePaths, targetDevicePaths);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.invokeMethod(storage, replicationSvc, SmisConstants.CREATE_LIST_REPLICA, inArgs, outArgs);
CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisVnxCreateCGMirrorJob(job, storage.getId(), tgtToSrcMap, taskCompleter)));
for (BlockMirror mirror : mirrors) {
mirror.setSyncState(SynchronizationState.SYNCHRONIZED.name());
}
_dbClient.persistObject(mirrors);
} catch (Exception e) {
_log.error("Problem making SMI-S call: ", e);
// Roll back changes
ReplicationUtils.rollbackCreateReplica(storage, null, targetDeviceIds, taskCompleter, _dbClient, _helper, _cimPath);
if (mirrors != null && !mirrors.isEmpty()) {
for (BlockMirror mirror : mirrors) {
mirror.setInactive(true);
}
}
_dbClient.persistObject(mirrors);
ServiceError error = DeviceControllerErrors.smis.methodFailed("createGroupMirrors", e.getMessage());
taskCompleter.error(_dbClient, error);
}
_log.info("createGroupMirrors operation END");
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class VnxSnapshotOperations method createGroupSnapshots.
/**
* Should implement create of a snapshot from a source volume that is part of a
* 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.
* @throws DeviceControllerException
*/
@Override
public void createGroupSnapshots(StorageSystem storage, List<URI> snapshotList, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
URI snapshot = snapshotList.get(0);
BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
Volume volume = _dbClient.queryObject(Volume.class, snapshotObj.getParent());
if (ControllerUtils.isNotInRealVNXRG(volume, _dbClient)) {
throw DeviceControllerException.exceptions.groupSnapshotNotSupported(volume.getReplicationGroupInstance());
}
// CTRL-5640: ReplicationGroup may not be accessible after provider fail-over.
ReplicationUtils.checkReplicationGroupAccessibleOrFail(storage, snapshotObj, _dbClient, _helper, _cimPath);
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);
String groupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(snapshotObj, _dbClient);
CIMObjectPath cgPath = _cimPath.getReplicationGroupPath(storage, groupName);
CIMObjectPath replicationSvc = _cimPath.getControllerReplicationSvcPath(storage);
CIMArgument[] inArgs = _helper.getCreateGroupReplicaInputArgumentsForVNX(storage, cgPath, createInactive, snapLabelToUse, SYNC_TYPE.SNAPSHOT.getValue());
CIMArgument[] outArgs = new CIMArgument[5];
_helper.invokeMethod(storage, replicationSvc, SmisConstants.CREATE_GROUP_REPLICA, inArgs, outArgs);
CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateCGSnapshotJob(job, storage.getId(), !createInactive, null, taskCompleter)));
}
} catch (Exception e) {
_log.info("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
taskCompleter.error(_dbClient, error);
setInactive(((BlockSnapshotCreateCompleter) taskCompleter).getSnapshotURIs(), true);
}
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class VnxSnapshotOperations method deleteSingleVolumeSnapshot.
/**
* Should implement deletion of single volume snapshot. That is, deleting a snap that was
* created independent of other volumes.
*
* @param storage [required] - StorageSystem object representing the array
* @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 deleteSingleVolumeSnapshot(StorageSystem storage, URI snapshot, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
callEMCRefreshIfRequired(_dbClient, _helper, storage, Arrays.asList(snapshot));
BlockSnapshot snap = _dbClient.queryObject(BlockSnapshot.class, snapshot);
CIMObjectPath syncObjectPath = _cimPath.getSyncObject(storage, snap);
if (_helper.checkExists(storage, syncObjectPath, false, false) != null) {
CIMArgument[] outArgs = new CIMArgument[5];
_helper.callModifyReplica(storage, _helper.getDeleteSnapshotSynchronousInputArguments(syncObjectPath), outArgs);
snap.setInactive(true);
snap.setIsSyncActive(false);
_dbClient.updateObject(snap);
taskCompleter.ready(_dbClient);
} else {
// Perhaps, it's already been deleted or was deleted on the array.
// In that case, we'll just say all is well, so that this operation
// is idempotent.
snap.setInactive(true);
snap.setIsSyncActive(false);
_dbClient.updateObject(snap);
taskCompleter.ready(_dbClient);
}
} catch (WBEMException e) {
String message = String.format("Error encountered during delete 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 delete snapshot %s on array %s", snapshot.toString(), storage.getSerialNumber());
_log.error(message, e);
ServiceError error = DeviceControllerErrors.smis.methodFailed("deleteSingleVolumeSnapshot", e.getMessage());
taskCompleter.error(_dbClient, error);
}
}
Aggregations