use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class XIVSnapshotOperations 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 taskCompleter
* - TaskCompleter object used for the updating operation status.
*/
@SuppressWarnings("rawtypes")
@Override
public void createSingleVolumeSnapshot(StorageSystem storage, URI snapshot, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("createSingleVolumeSnapshot operation START");
try {
BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
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(), '-', IBMSmisConstants.MAX_SNAPSHOT_NAME_LENGTH);
CIMArgument[] inArgs = _helper.getCreateElementReplicaSnapInputArguments(storage, volume, createInactive, snapLabelToUse);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.callReplicationSvc(storage, IBMSmisConstants.CREATE_ELEMENT_REPLICA, inArgs, outArgs);
_smisStorageDevicePostProcessor.processSnapshotCreation(storage, snapshot, !createInactive, outArgs, (BlockSnapshotCreateCompleter) 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);
}
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class AbstractCloneOperations method resyncSingleClone.
@Override
@SuppressWarnings("rawtypes")
public void resyncSingleClone(StorageSystem storageSystem, URI cloneVolume, TaskCompleter taskCompleter) {
_log.info("START resyncSingleClone operation");
Volume clone = null;
try {
callEMCRefreshIfRequired(_dbClient, _helper, storageSystem, Arrays.asList(cloneVolume));
clone = _dbClient.queryObject(Volume.class, cloneVolume);
URI sourceUri = clone.getAssociatedSourceVolume();
Volume sourceObj = _dbClient.queryObject(Volume.class, sourceUri);
StorageSystem sourceSystem = _dbClient.queryObject(StorageSystem.class, sourceObj.getStorageController());
CIMObjectPath syncObject = _cimPath.getStorageSynchronized(sourceSystem, sourceObj, storageSystem, clone);
CIMInstance instance = _helper.checkExists(storageSystem, syncObject, false, false);
if (instance != null) {
CIMArgument[] inArgs = _helper.getResyncReplicaInputArguments(syncObject);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.callModifyReplica(storageSystem, inArgs, outArgs);
CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisCloneResyncJob(job, storageSystem.getId(), taskCompleter)));
}
} else {
String errorMsg = "The clone is already detached. resync will not be performed.";
_log.info(errorMsg);
ServiceError error = DeviceControllerErrors.smis.methodFailed("resyncSingleClone", errorMsg);
taskCompleter.error(_dbClient, error);
}
} catch (Exception e) {
String errorMsg = String.format(RESYNC_ERROR_MSG_FORMAT, cloneVolume);
_log.error(errorMsg, e);
taskCompleter.error(_dbClient, DeviceControllerException.exceptions.resynchronizeFullCopyFailed(e));
}
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class AbstractCloneOperations method getReplicationSettingDataInstanceForThinProvisioningPolicy.
@SuppressWarnings("rawtypes")
private CIMInstance getReplicationSettingDataInstanceForThinProvisioningPolicy(final StorageSystem storageSystem, int desiredValue) {
CIMInstance modifiedInstance = null;
try {
CIMObjectPath replicationSettingCapabilities = _cimPath.getReplicationServiceCapabilitiesPath(storageSystem);
CIMArgument[] inArgs = _helper.getReplicationSettingDataInstance();
CIMArgument[] outArgs = new CIMArgument[5];
_helper.invokeMethod(storageSystem, replicationSettingCapabilities, GET_DEFAULT_REPLICATION_SETTING_DATA, inArgs, outArgs);
for (CIMArgument<?> outArg : outArgs) {
if (null == outArg) {
continue;
}
if (outArg.getName().equalsIgnoreCase(SmisConstants.DEFAULT_INSTANCE)) {
CIMInstance repInstance = (CIMInstance) outArg.getValue();
if (null != repInstance) {
CIMProperty<?> thinProvisioningPolicy = new CIMProperty<Object>(SmisConstants.THIN_PROVISIONING_POLICY, UINT16_T, new UnsignedInteger16(desiredValue));
CIMProperty<?> targetElementSupplier = new CIMProperty<Object>(TARGET_ELEMENT_SUPPLIER, UINT16_T, new UnsignedInteger16(CREATE_NEW_TARGET_VALUE));
CIMProperty<?>[] propArray = new CIMProperty<?>[] { thinProvisioningPolicy, targetElementSupplier };
modifiedInstance = repInstance.deriveInstance(propArray);
break;
}
}
}
} catch (Exception e) {
_log.error("Error retrieving Replication Setting Data Instance ", e);
}
return modifiedInstance;
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class AbstractCloneOperations method detachSingleClone.
@Override
@SuppressWarnings("rawtypes")
public void detachSingleClone(StorageSystem storageSystem, URI cloneVolume, TaskCompleter taskCompleter) {
_log.info("START detachSingleClone operation");
Volume clone = null;
try {
callEMCRefreshIfRequired(_dbClient, _helper, storageSystem, Arrays.asList(cloneVolume));
clone = _dbClient.queryObject(Volume.class, cloneVolume);
URI sourceUri = clone.getAssociatedSourceVolume();
if (!NullColumnValueGetter.isNullURI(sourceUri)) {
BlockObject sourceObj = BlockObject.fetch(_dbClient, sourceUri);
if (sourceObj != null) {
StorageSystem sourceSystem = _dbClient.queryObject(StorageSystem.class, sourceObj.getStorageController());
CIMObjectPath syncObject = _cimPath.getStorageSynchronized(sourceSystem, sourceObj, storageSystem, clone);
CIMInstance instance = _helper.checkExists(storageSystem, syncObject, false, false);
if (instance != null) {
CIMArgument[] inArgs = _helper.getDetachSynchronizationInputArguments(syncObject);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.callModifyReplica(storageSystem, inArgs, outArgs);
} else {
_log.info("The clone is already detached. Detach will not be performed.");
}
} else {
_log.info("The clone's source volume cannot be found in the database. Detach will not be performed.");
}
} else {
_log.info("The clone does not have a source volume. Detach will not be performed.");
}
// Update sync active property
/**
* cq:609984 - No need to reset sync active flag as its caused problem
* when check for activated target volume.
*
* @see <code>BlockService#activateFullCopy
* volume.setSyncActive(false);
*/
ReplicationUtils.removeDetachedFullCopyFromSourceFullCopiesList(clone, _dbClient);
clone.setAssociatedSourceVolume(NullColumnValueGetter.getNullURI());
clone.setReplicaState(ReplicationState.DETACHED.name());
_dbClient.persistObject(clone);
if (taskCompleter != null) {
taskCompleter.ready(_dbClient);
}
} catch (Exception e) {
String errorMsg = String.format(DETACH_ERROR_MSG_FORMAT, cloneVolume, clone.getAssociatedSourceVolume());
_log.error(errorMsg, e);
if (taskCompleter != null) {
taskCompleter.error(_dbClient, DeviceControllerException.exceptions.detachVolumeFullCopyFailed(e));
}
}
}
use of javax.cim.CIMArgument in project coprhd-controller by CoprHD.
the class AbstractCloneOperations method activateSingleClone.
@Override
@SuppressWarnings("rawtypes")
public void activateSingleClone(StorageSystem storageSystem, URI fullCopy, TaskCompleter completer) {
_log.info("START activateSingleClone for {}", fullCopy);
try {
Volume volume = _dbClient.queryObject(Volume.class, fullCopy);
CIMArgument[] inArgs = _helper.getActivateFullCopyArguments(storageSystem, volume);
CIMArgument[] outArgs = new CIMArgument[5];
_helper.callModifyReplica(storageSystem, inArgs, outArgs);
// Update sync active property
volume.setSyncActive(true);
volume.setRefreshRequired(true);
volume.setReplicaState(ReplicationState.SYNCHRONIZED.name());
_dbClient.persistObject(volume);
completer.ready(_dbClient);
_log.info("FINISH activateSingleClone for {}", fullCopy);
} catch (Exception e) {
String errorMsg = String.format(ACTIVATE_ERROR_MSG_FORMAT, fullCopy);
_log.error(errorMsg, e);
completer.error(_dbClient, DeviceControllerException.exceptions.activateVolumeFullCopyFailed(e));
}
}
Aggregations