use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class SmisCommandHelper method disableVMAX3Compression.
/**
* This method is will check if the Storage Pool associated with the Volume supports compression.
* If it does support compression, it will check if the associated virtual Pool has compression enabled.
* It will recommend the user to disable compression if the virtual pool has compression disabled and
* the storage pool enables compression by default.
*
* @param blockObjectURI BlockObjectURI
* @param storage - StorageSystem object
* @return boolean to report if compression needs to be disabled.
*/
public boolean disableVMAX3Compression(URI blockObjectURI, StorageSystem storageSystem) {
VirtualPool virtualPool = null;
StoragePool storagePool = null;
Volume volume = null;
if (URIUtil.isType(blockObjectURI, Volume.class)) {
volume = _dbClient.queryObject(Volume.class, blockObjectURI);
// Using the same logic that is in the above getVMAX3FastSettingForVolume method.
// If the there is a BlockSnapshot with the same native GUID as the volume, then
// this is a backend volume representing the snapshot for the purpose of importing
// the snapshot into VPLEX as a VPLEX volume. Therefore, treat it like a block snapshot
// and use the parent volume.
List<BlockSnapshot> snapshots = CustomQueryUtility.getActiveBlockSnapshotByNativeGuid(_dbClient, volume.getNativeGuid());
if (!snapshots.isEmpty()) {
volume = _dbClient.queryObject(Volume.class, snapshots.get(0).getParent());
}
} else if (URIUtil.isType(blockObjectURI, BlockSnapshot.class)) {
BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, blockObjectURI);
volume = _dbClient.queryObject(Volume.class, snapshot.getParent());
} else if (URIUtil.isType(blockObjectURI, BlockMirror.class)) {
BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, blockObjectURI);
if (NullColumnValueGetter.isNullURI(mirror.getVirtualPool()) || NullColumnValueGetter.isNullURI(mirror.getPool())) {
_log.info("The given BlockMirror {} does not have an associated Virtual pool or Storage Pool ", blockObjectURI);
// This should never happen but we need this additional check.
return false;
}
virtualPool = _dbClient.queryObject(VirtualPool.class, mirror.getVirtualPool());
storagePool = _dbClient.queryObject(StoragePool.class, mirror.getPool());
}
if (volume != null) {
if (NullColumnValueGetter.isNullURI(volume.getVirtualPool()) || NullColumnValueGetter.isNullURI(volume.getPool())) {
_log.info("The given Volume {} does not have an associated Virtual pool or Storage Pool ", blockObjectURI);
// This should never happen but we need this additional check.
return false;
}
virtualPool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
storagePool = _dbClient.queryObject(StoragePool.class, volume.getPool());
}
return (checkIfProviderSupportsCompressionOperations(storageSystem) && !virtualPool.getCompressionEnabled() && storagePool.getCompressionEnabled());
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class SmisCommandHelper method getNativeGuidToVolumeUriMap.
/**
* Generate NativeGuid-->Volume uri mapping using volume uris list.
*
* @param volumeUris
* @param storage
* @return
* @throws IOException
*/
private Map<String, URI> getNativeGuidToVolumeUriMap(List<URI> volumeUris, StorageSystem storage) throws IOException {
Map<String, URI> volumePaths = new HashMap<String, URI>();
for (URI volumeUri : volumeUris) {
String nativeGuid = null;
if (URIUtil.isType(volumeUri, Volume.class)) {
Volume volume = _dbClient.queryObject(Volume.class, volumeUri);
nativeGuid = NativeGUIDGenerator.generateNativeGuid(_dbClient, volume);
} else if (URIUtil.isType(volumeUri, BlockSnapshot.class)) {
BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, volumeUri);
nativeGuid = NativeGUIDGenerator.generateNativeGuid(storage, snapshot);
} else if (URIUtil.isType(volumeUri, BlockMirror.class)) {
BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, volumeUri);
nativeGuid = NativeGUIDGenerator.generateNativeGuid(storage, mirror);
}
volumePaths.put(nativeGuid, volumeUri);
}
return volumePaths;
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class VmaxMirrorOperations method createGroupMirrors.
@Override
public void createGroupMirrors(StorageSystem storage, List<URI> mirrorList, Boolean createInactive, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("createGroupMirrors operation START");
List<BlockMirror> mirrors = null;
try {
if (!storage.getUsingSmis80()) {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
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);
String replicaLabel = ControllerUtils.generateLabel(sourceVolume.getLabel(), firstMirror.getLabel());
// CTRL-5640: ReplicationGroup may not be accessible after provider fail-over.
ReplicationUtils.checkReplicationGroupAccessibleOrFail(storage, sourceVolume, _dbClient, _helper, _cimPath);
// Create CG mirrors
CIMObjectPath job = VmaxGroupOperationsUtils.internalCreateGroupReplica(storage, sourceGroupName, replicaLabel, null, createInactive, taskCompleter, SYNC_TYPE.MIRROR, _dbClient, _helper, _cimPath);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateCGMirrorJob(job, storage.getId(), 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
if (mirrors != null && !mirrors.isEmpty()) {
for (BlockMirror mirrorObj : mirrors) {
mirrorObj.setInactive(true);
}
}
_dbClient.persistObject(mirrors);
ServiceError error = DeviceControllerErrors.smis.methodFailed("createGroupMirrors", e.getMessage());
taskCompleter.error(_dbClient, error);
}
_log.info("createGroupMirrors operation END");
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class VmaxMirrorOperations method fractureGroupMirrors.
@Override
public void fractureGroupMirrors(StorageSystem storage, List<URI> mirrorList, Boolean sync, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("fractureGroupMirrors operation START");
if (!storage.getUsingSmis80()) {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
try {
callEMCRefreshIfRequired(_dbClient, _helper, storage, mirrorList);
CIMObjectPath groupSynchronized = ReplicationUtils.getMirrorGroupSynchronizedPath(storage, mirrorList.get(0), _dbClient, _helper, _cimPath);
if (null == _helper.checkExists(storage, groupSynchronized, false, false)) {
_log.error("Unable to find group synchronized {}", groupSynchronized.toString());
BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, mirrorList.get(0));
ServiceError error = DeviceControllerErrors.smis.unableToFindSynchPath(mirror.getReplicationGroupInstance());
taskCompleter.error(_dbClient, error);
}
// If there is any mirror in split state, resume the group to make it consistent.
if (_helper.groupHasReplicasInSplitState(storage, mirrorList, BlockMirror.class)) {
resumeGroupMirrors(storage, mirrorList);
}
// Fracture the mirror now.
CIMArgument[] fractureCGMirrorInput = _helper.getFractureMirrorInputArgumentsWithCopyState(groupSynchronized, sync);
_helper.callModifyReplica(storage, fractureCGMirrorInput);
List<BlockMirror> mirrors = _dbClient.queryObject(BlockMirror.class, mirrorList);
for (BlockMirror mirror : mirrors) {
mirror.setSyncState(SynchronizationState.FRACTURED.name());
}
_dbClient.persistObject(mirrors);
taskCompleter.ready(_dbClient);
} catch (Exception e) {
_log.error("Problem making SMI-S call", e);
ServiceError error = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(_dbClient, error);
}
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class VmaxMirrorOperations method removeMirrorFromDeviceMaskingGroup.
@Override
public void removeMirrorFromDeviceMaskingGroup(StorageSystem system, List<URI> mirrorList, TaskCompleter completer) throws DeviceControllerException {
_log.info("removeMirrorFromGroup operation START");
try {
BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, mirrorList.get(0));
CIMObjectPath maskingGroupPath = _cimPath.getMaskingGroupPath(system, mirror.getReplicationGroupInstance(), SmisConstants.MASKING_GROUP_TYPE.SE_DeviceMaskingGroup);
List<URI> replicasPartOfGroup = _helper.findVolumesInReplicationGroup(system, maskingGroupPath, mirrorList);
if (replicasPartOfGroup.isEmpty()) {
_log.info("Mirrors {} already removed from Device Masking Group {}", Joiner.on(", ").join(mirrorList), maskingGroupPath);
} else {
String[] members = _helper.getBlockObjectAlternateNames(replicasPartOfGroup);
CIMObjectPath[] memberPaths = _cimPath.getVolumePaths(system, members);
CIMArgument[] inArgs = _helper.getRemoveAndUnmapMaskingGroupMembersInputArguments(maskingGroupPath, memberPaths, system, false);
CIMArgument[] outArgs = new CIMArgument[5];
_log.info("Invoking remove mirrors {} from Device Masking Group equivalent to its Replication Group {}", Joiner.on(", ").join(members), mirror.getReplicationGroupInstance());
_helper.invokeMethodSynchronously(system, _cimPath.getControllerConfigSvcPath(system), SmisConstants.REMOVE_MEMBERS, inArgs, outArgs, null);
}
completer.ready(_dbClient);
} catch (Exception e) {
_log.error("Failed to remove mirrors from its Device Masking Group. Mirrors: {}", Joiner.on(", ").join(mirrorList), e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
completer.error(_dbClient, serviceError);
}
_log.info("removeMirrorFromGroup operation END");
}
Aggregations