use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class HDSMirrorOperations method deleteSingleVolumeMirror.
/**
* Deletes mirror instance from StorageSystem
*/
@Override
public void deleteSingleVolumeMirror(StorageSystem storageSystem, URI mirror, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
StringBuilder logMsgBuilder = new StringBuilder(String.format("Delete Mirror Start - Array:%s", storageSystem.getSerialNumber()));
Set<String> thickLogicalUnitIdList = new HashSet<String>();
Set<String> thinLogicalUnitIdList = new HashSet<String>();
HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storageSystem), storageSystem.getSmisUserName(), storageSystem.getSmisPassword());
String systemObjectID = HDSUtils.getSystemObjectID(storageSystem);
BlockMirror mirrorObj = dbClient.queryObject(BlockMirror.class, mirror);
logMsgBuilder.append(String.format("%nMirror:%s", mirrorObj.getLabel()));
String logicalUnitObjectId = HDSUtils.getLogicalUnitObjectId(mirrorObj.getNativeId(), storageSystem);
LogicalUnit logicalUnit = hdsApiClient.getLogicalUnitInfo(systemObjectID, logicalUnitObjectId);
if (logicalUnit == null) {
// related volume state (if any) has been deleted. skip
// processing, if already deleted from array.
log.info(String.format("Mirror %s already deleted: ", mirrorObj.getNativeId()));
// HDSMirrorOperations.removeReferenceFromSourceVolume(dbClient, mirrorObj);
dbClient.markForDeletion(mirrorObj);
} else {
if (mirrorObj.getThinlyProvisioned()) {
thinLogicalUnitIdList.add(logicalUnitObjectId);
} else {
thickLogicalUnitIdList.add(logicalUnitObjectId);
}
log.info(logMsgBuilder.toString());
if (!thickLogicalUnitIdList.isEmpty()) {
String asyncThickLUsJobId = hdsApiClient.deleteThickLogicalUnits(systemObjectID, thickLogicalUnitIdList, storageSystem.getModel());
if (null != asyncThickLUsJobId) {
ControllerServiceImpl.enqueueJob(new QueueJob(new HDSBlockMirrorDeleteJob(asyncThickLUsJobId, mirrorObj.getStorageController(), taskCompleter)));
} else {
throw HDSException.exceptions.asyncTaskFailed("Unable to get async taskId from HiCommand Device Manager for the delete mirror call");
}
}
if (!thinLogicalUnitIdList.isEmpty()) {
String asyncThinHDSJobId = hdsApiClient.deleteThinLogicalUnits(systemObjectID, thinLogicalUnitIdList, storageSystem.getModel());
if (null != asyncThinHDSJobId) {
ControllerServiceImpl.enqueueJob(new QueueJob(new HDSBlockMirrorDeleteJob(asyncThinHDSJobId, mirrorObj.getStorageController(), taskCompleter)));
} else {
throw HDSException.exceptions.asyncTaskFailed("Unable to get async taskId from HiCommand Device Manager for the delete mirror call");
}
}
}
log.info("Delete Mirror End - Array: {} Mirror: {}", storageSystem.getSerialNumber(), mirror);
} catch (Exception e) {
log.error("Problem in deleteSingleVolumeMirror: ", e);
ServiceError error = DeviceControllerErrors.hds.methodFailed("deleteSingleVolumeMirror", e.getMessage());
taskCompleter.error(dbClient, error);
}
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class ReplicaDeviceController method addMirrorToReplicationGroupStep.
private String addMirrorToReplicationGroupStep(final Workflow workflow, String waitFor, StorageSystem storageSystem, List<Volume> volumes, String repGroupName, URI cgURI) {
log.info("START create mirror step");
URI storage = storageSystem.getId();
List<URI> mirrorList = new ArrayList<URI>();
for (Volume volume : volumes) {
String mirrorLabel = volume.getLabel() + "-" + repGroupName;
BlockMirror mirror = createMirror(volume, volume.getVirtualPool(), volume.getPool(), mirrorLabel, repGroupName);
URI mirrorId = mirror.getId();
mirrorList.add(mirrorId);
}
waitFor = _blockDeviceController.createListMirrorStep(workflow, waitFor, storageSystem, mirrorList);
waitFor = workflow.createStep(BlockDeviceController.UPDATE_CONSISTENCY_GROUP_STEP_GROUP, String.format("Updating consistency group %s", cgURI), waitFor, storage, _blockDeviceController.getDeviceType(storage), this.getClass(), addToReplicationGroupMethod(storage, cgURI, repGroupName, mirrorList), removeFromReplicationGroupMethod(storage, cgURI, repGroupName, mirrorList), null);
log.info(String.format("Step created for adding mirror [%s] to group on device [%s]", Joiner.on("\t").join(mirrorList), storage));
return waitFor;
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class ReplicaDeviceController method getMirrorsToBeRemoved.
private List<URI> getMirrorsToBeRemoved(Set<URI> volumes, String repGroupName) {
List<URI> replicas = new ArrayList<URI>();
URIQueryResultList queryResults = new URIQueryResultList();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getMirrorReplicationGroupInstanceConstraint(repGroupName), queryResults);
Iterator<URI> resultsIter = queryResults.iterator();
while (resultsIter.hasNext()) {
BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, resultsIter.next());
if (volumes.contains(mirror.getSource().getURI())) {
replicas.add(mirror.getId());
}
}
return replicas;
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class ReplicaDeviceController method createMirror.
/**
* Adds a BlockMirror structure for a Volume. It also calls addMirrorToVolume to
* link the mirror into the volume's mirror set.
*
* @param volume Volume
* @param vPoolURI
* @param recommendedPoolURI Pool that should be used to create the mirror
* @param volumeLabel
* @param repGroupName
* @return BlockMirror (persisted)
*/
private BlockMirror createMirror(Volume volume, URI vPoolURI, URI recommendedPoolURI, String volumeLabel, String repGroupName) {
BlockMirror createdMirror = new BlockMirror();
createdMirror.setSource(new NamedURI(volume.getId(), volume.getLabel()));
createdMirror.setId(URIUtil.createId(BlockMirror.class));
URI cgUri = volume.getConsistencyGroup();
if (!NullColumnValueGetter.isNullURI(cgUri)) {
createdMirror.setConsistencyGroup(cgUri);
}
createdMirror.setLabel(volumeLabel);
createdMirror.setStorageController(volume.getStorageController());
createdMirror.setSystemType(volume.getSystemType());
createdMirror.setVirtualArray(volume.getVirtualArray());
createdMirror.setProtocol(new StringSet());
createdMirror.getProtocol().addAll(volume.getProtocol());
createdMirror.setCapacity(volume.getCapacity());
createdMirror.setProject(new NamedURI(volume.getProject().getURI(), createdMirror.getLabel()));
createdMirror.setTenant(new NamedURI(volume.getTenant().getURI(), createdMirror.getLabel()));
createdMirror.setPool(recommendedPoolURI);
createdMirror.setVirtualPool(vPoolURI);
createdMirror.setSyncState(SynchronizationState.UNKNOWN.toString());
createdMirror.setSyncType(BlockMirror.MIRROR_SYNC_TYPE);
createdMirror.setThinlyProvisioned(volume.getThinlyProvisioned());
createdMirror.setReplicationGroupInstance(repGroupName);
_dbClient.createObject(createdMirror);
addMirrorToVolume(volume, createdMirror);
return createdMirror;
}
use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.
the class StorageVolumeProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
EnumerateResponse<CIMInstance> volumeInstanceChunks = (EnumerateResponse<CIMInstance>) resultObj;
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
_keyMap = keyMap;
_updateVolumes = new ArrayList<Volume>();
_updateSnapShots = new ArrayList<BlockSnapshot>();
_updateMirrors = new ArrayList<BlockMirror>();
CloseableIterator<CIMInstance> volumeInstances = null;
try {
// create empty place holder list for meta volume paths (cannot define this in xml)
_metaVolumePaths = (List<CIMObjectPath>) keyMap.get(Constants.META_VOLUMES);
if (_metaVolumePaths == null) {
keyMap.put(Constants.META_VOLUMES, new ArrayList<CIMObjectPath>());
}
_volumeToSpaceConsumedMap = (Map<String, String>) keyMap.get(Constants.VOLUME_SPACE_CONSUMED_MAP);
CIMObjectPath storagePoolPath = getObjectPathfromCIMArgument(_args);
_isVMAX3 = storagePoolPath.getObjectName().equals(StoragePool.PoolClassNames.Symm_SRPStoragePool.name());
processResultbyChunk(resultObj, keyMap);
_partitionManager.updateInBatches(_updateVolumes, getPartitionSize(keyMap), _dbClient, VOLUME);
_partitionManager.updateInBatches(_updateSnapShots, getPartitionSize(keyMap), _dbClient, BLOCK_SNAPSHOT);
_partitionManager.updateInBatches(_updateMirrors, getPartitionSize(keyMap), _dbClient, BLOCK_MIRROR);
} catch (Exception e) {
_logger.error("Processing Volumes and Snapshots failed", e);
} finally {
_updateVolumes = null;
_updateSnapShots = null;
_updateMirrors = null;
if (null != volumeInstances) {
volumeInstances.close();
}
}
}
Aggregations