use of javax.wbem.WBEMException 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 javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method resumeSnapshot.
/**
* Routine will call SMI-S ModifyReplicaSynchronization to resume a synchronization instance.
* The operation is a counter-intuitive; it will terminate a RESTORE session between
* target and source. This was the suggestion based on input from SMI-S team.
* See OPT 443785.
*
* @param storage [in] - StorageSystem object representing the array
* @param from [in] - Should be the snapshot object
* @param blockObject [in] - Should be the volume object
* @param syncObject [in] - A CIMObjectPath representing the SMI-S synchronization object tying
* from and blockObject together, along with other related consistency group members
* @param taskCompleter [in] - TaskCompleter used for updating status of operation
* @return true if the resume operation was successfully performed on the synchronization
* @throws WBEMException
*/
private boolean resumeSnapshot(StorageSystem storage, BlockObject from, BlockObject blockObject, CIMObjectPath syncObject, TaskCompleter taskCompleter) throws WBEMException {
boolean wasResumed = false;
SmisBlockResumeSnapshotJob job = new SmisBlockResumeSnapshotJob(null, storage.getId(), new TaskCompleter() {
@Override
protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded) throws DeviceControllerException {
}
});
CIMArgument[] result = new CIMArgument[5];
try {
if (storage.checkIfVmax3()) {
_helper.invokeMethodSynchronously(storage, _cimPath.getControllerReplicationSvcPath(storage), SmisConstants.MODIFY_SETTINGS_DEFINE_STATE, _helper.getEMCResumeInputArguments(syncObject), result, job);
} else if (storage.getUsingSmis80()) {
/**
* VMAX2 managed by 8.* SMIS
* We need to pass Operation = 16
*/
_helper.invokeMethodSynchronously(storage, _cimPath.getControllerReplicationSvcPath(storage), SmisConstants.MODIFY_REPLICA_SYNCHRONIZATION, _helper.getResumeSnapshotSynchronizationInputArguments(syncObject), result, job);
} else {
/**
* VMAX2 managed by 4.6.2 SMI provider
* We need to pass Operation = 14
*/
_helper.invokeMethodSynchronously(storage, _cimPath.getControllerReplicationSvcPath(storage), SmisConstants.MODIFY_REPLICA_SYNCHRONIZATION, _helper.getResumeSynchronizationInputArguments(syncObject), result, job);
}
} catch (Exception e) {
/*
* May be ignored if message is about invalid device state, since when
* dealing with multiple GroupSynchronized instances, we attempt to resume
* all of them.
*/
_log.info("Encountered exception which may be ignored: {}", e.getMessage());
}
if (job.isSuccess()) {
_log.info("Synchronization was successfully resumed: {}", syncObject);
wasResumed = true;
} else {
_log.info("Synchronization was not resumed and can be ignored: {}", syncObject);
}
return wasResumed;
}
use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method restoreSingleVolumeSnapshot.
/**
* Implementation for restoring of a single volume snapshot restore. That is, this
* volume is independent of other volumes and a snapshot was taken previously, and
* now we want to restore that snap to the original volume.
*
* @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 restoreSingleVolumeSnapshot(StorageSystem storage, URI volume, URI snapshot, TaskCompleter taskCompleter) throws DeviceControllerException {
Volume vol = _dbClient.queryObject(Volume.class, volume);
try {
_helper.doApplyRecoverPointTag(storage, vol, false);
callEMCRefreshIfRequired(_dbClient, _helper, storage, Arrays.asList(snapshot));
BlockSnapshot from = _dbClient.queryObject(BlockSnapshot.class, snapshot);
CIMObjectPath syncObjectPath = _cimPath.getSyncObject(storage, from);
if (_helper.checkExists(storage, syncObjectPath, false, false) != null) {
terminateAnyRestoreSessions(storage, from, volume, taskCompleter);
}
CIMObjectPath cimJob;
if (storage.checkIfVmax3()) {
Volume to = _dbClient.queryObject(Volume.class, volume);
cimJob = _helper.callModifySettingsDefineState(storage, _helper.getRestoreFromSnapshotInputArguments(storage, to, from));
} else {
cimJob = _helper.callModifyReplica(storage, _helper.getRestoreFromReplicaInputArguments(syncObjectPath));
}
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockRestoreSnapshotJob(cimJob, storage.getId(), taskCompleter)));
} catch (WBEMException e) {
String message = String.format("Error encountered when trying to restore from snapshot %s on array %s", snapshot.toString(), storage.getSerialNumber());
_log.error(message, e);
try {
// Re-enable the RP tag.
_log.info(String.format("Enabling the RecoverPoint tag on volume %s", volume.toString()));
_helper.doApplyRecoverPointTag(storage, vol, true);
} catch (Exception ex) {
_log.error(String.format("An error has occured trying to enable the RecoverPoint tag on volume %s."), ex);
}
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
taskCompleter.error(_dbClient, error);
} catch (Exception e) {
String message = String.format("Generic exception when trying to restore from snapshot %s on array %s", snapshot.toString(), storage.getSerialNumber());
_log.error(message, e);
try {
// Re-enable the RP tag.
_log.info(String.format("Enabling the RecoverPoint tag on volume %s", volume.toString()));
_helper.doApplyRecoverPointTag(storage, vol, true);
} catch (Exception ex) {
_log.error(String.format("An error has occured trying to enable the RecoverPoint tag on volume %s."), ex);
}
ServiceError error = DeviceControllerErrors.smis.methodFailed("restoreSingleVolumeSnapshot", e.getMessage());
taskCompleter.error(_dbClient, error);
}
}
use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations 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 {
_log.info("START deleteSingleVolumeSnapshot");
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) {
deactivateSnapshot(storage, snap, syncObjectPath);
if (storage.checkIfVmax3()) {
// Ingested non-exported snapshot could be associated with SGs outside of ViPR,
// remove snapshot from them before deleting it.
_helper.removeVolumeFromStorageGroupsIfVolumeIsNotInAnyMV(storage, snap);
_helper.removeVolumeFromParkingSLOStorageGroup(storage, new String[] { snap.getNativeId() }, false);
_log.info("Done invoking remove volume {} from parking SLO storage group", snap.getNativeId());
// If VMAX3 linked target (both copy and no copy mode), detach the element synchronization before deleting it.
// COP-21476 - 'no copy' mode target too needs to be detached when snap session has linked copy mode target.
// TODO enhance ReplicaDeviceController to handle remove single session & target while removing volume from group.
CIMArgument[] inArgsDetach = _helper.getUnlinkBlockSnapshotSessionTargetInputArguments(syncObjectPath);
CIMArgument[] outArgsDetach = new CIMArgument[5];
CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(storage);
_helper.invokeMethodSynchronously(storage, replicationSvcPath, SmisConstants.MODIFY_REPLICA_SYNCHRONIZATION, inArgsDetach, outArgsDetach, null);
// delete the target snapshot device
CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storage);
CIMArgument[] inArgs = _helper.getDeleteVolumesInputArguments(storage, new String[] { snap.getNativeId() });
CIMArgument[] outArgs = new CIMArgument[5];
_helper.invokeMethodSynchronously(storage, configSvcPath, SmisConstants.RETURN_ELEMENTS_TO_STORAGE_POOL, inArgs, outArgs, null);
} else {
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);
}
}
use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class VnxExportOperations method createStorageHWIDs.
/**
* This call will attempt to call CreateStorageHardwareID for the given list of
* Initiators. CSHID is called only if the SE_StorageHardwareID (Initiator) is
* not already known to the array. If the Initiator is known to the array, function
* will attempt to extract any known targets end points and return those.
*
* @param storage
* [in] - StorageSystem object representing the array
* @param initiators
* [in] - List Initiator objects
* @return Multimap of Initiator.normalizedPort(initiatorPort) to target endpoint names
* @throws Exception
*/
private Multimap<String, String> createStorageHWIDs(StorageSystem storage, Map<String, CIMObjectPath> existingHwStorageIds, List<Initiator> initiators, TaskCompleter completer) throws Exception {
_log.info("{} createStorageHWID START...", storage.getSerialNumber());
Multimap<String, String> existingTargets = TreeMultimap.create();
if (initiators == null || initiators.isEmpty()) {
_log.info("No initiators ...");
return existingTargets;
}
try {
CIMObjectPath hwIdManagementSvc = _cimPath.getStorageHardwareIDManagementService(storage);
List<Initiator> createdInitiators = new ArrayList<Initiator>();
for (Initiator initiator : initiators) {
String normalizedPortName = Initiator.normalizePort(initiator.getInitiatorPort());
// Skip any initiators that already exist on the system
if (existingHwStorageIds.containsKey(normalizedPortName)) {
List<String> endpoints = getEMCTargetEndpoints(hwIdManagementSvc, storage, existingHwStorageIds.get(normalizedPortName));
_log.info("Endpoint found for {} EndPoints {}", normalizedPortName, endpoints);
for (String endpoint : endpoints) {
existingTargets.put(normalizedPortName, endpoint);
_log.info("Endpoint found for {} EndPoint {}", normalizedPortName, endpoint);
}
_log.info("WWNs found on the array already: {}", Joiner.on(',').join(existingHwStorageIds.keySet()));
_log.info(String.format("Initiator %s already exists, skip creation", initiator.getInitiatorPort()));
continue;
}
CIMArgument[] createHwIdIn = _helper.getCreateStorageHardwareIDArgs(initiator);
CIMArgument[] createHwIdOut = new CIMArgument[5];
_helper.invokeMethod(storage, hwIdManagementSvc, SmisConstants.CREATE_STORAGE_HARDWARE_ID, createHwIdIn, createHwIdOut);
createdInitiators.add(initiator);
}
ExportOperationContext.insertContextOperation(completer, VnxExportOperationContext.OPERATION_ADD_INITIATORS_TO_STORAGE_GROUP, createdInitiators);
} catch (WBEMException e) {
_log.error("Problem making SMI-S call: ", e);
throw e;
} catch (Exception e) {
_log.error("Unexpected error: createStorageHWIDs failed.", e);
throw e;
}
return existingTargets;
}
Aggregations