use of com.emc.storageos.db.client.model.FileShare in project coprhd-controller by CoprHD.
the class FileMirrorRollbackCompleter method complete.
@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded serviceCoded) {
List<FileShare> sourceFileShareList = dbClient.queryObject(FileShare.class, getIds());
if (sourceFileShareList != null && !sourceFileShareList.isEmpty()) {
List<FileShare> fileSharesToUpdate = new ArrayList<FileShare>();
for (FileShare fileShare : sourceFileShareList) {
if (fileShare.getMirrorfsTargets() != null && !fileShare.getMirrorfsTargets().isEmpty()) {
// need be to implemented
}
}
}
super.complete(dbClient, status, serviceCoded);
}
use of com.emc.storageos.db.client.model.FileShare in project coprhd-controller by CoprHD.
the class FilePolicyUnAssignWorkflowCompleter method updatePolicyUnAssignedResources.
protected void updatePolicyUnAssignedResources(DbClient dbClient, FilePolicy filePolicy, Status status, ServiceCoded coded) {
for (URI resourceURI : unassignFromResource) {
filePolicy.removeAssignedResources(resourceURI);
FilePolicyApplyLevel applyLevel = FilePolicyApplyLevel.valueOf(filePolicy.getApplyAt());
switch(applyLevel) {
case vpool:
VirtualPool vpool = dbClient.queryObject(VirtualPool.class, resourceURI);
vpool.removeFilePolicy(filePolicy.getId());
dbClient.updateObject(vpool);
break;
case project:
Project project = dbClient.queryObject(Project.class, resourceURI);
project.removeFilePolicy(project, filePolicy.getId());
dbClient.updateObject(project);
break;
case file_system:
FileShare fs = dbClient.queryObject(FileShare.class, resourceURI);
fs.removeFilePolicy(filePolicy.getId());
dbClient.updateObject(fs);
break;
default:
_log.error("Not a valid policy apply level: " + applyLevel);
}
}
if (filePolicy.getAssignedResources() == null || filePolicy.getAssignedResources().isEmpty()) {
// remove the file policy vpool
if (!NullColumnValueGetter.isNullURI(filePolicy.getFilePolicyVpool())) {
filePolicy.setFilePolicyVpool(NullColumnValueGetter.getNullURI());
}
// If no other resources are assigned to replication policy
// Remove the replication topology from the policy
FileOrchestrationUtils.removeTopologyInfo(filePolicy, dbClient);
}
dbClient.updateObject(filePolicy);
}
use of com.emc.storageos.db.client.model.FileShare in project coprhd-controller by CoprHD.
the class FileSystemVpoolChangeCompleter method handleFileShareErrors.
private void handleFileShareErrors(DbClient dbClient) {
for (FileDescriptor fileDescriptor : FileDescriptor.getDescriptors(_fileDescriptors, FileDescriptor.Type.FILE_DATA)) {
FileShare fileShare = dbClient.queryObject(FileShare.class, fileDescriptor.getFsURI());
if (fileShare != null && (fileShare.getNativeId() == null || fileShare.getNativeId().equals(""))) {
_log.info("No native id was present on FileShare {}, marking inactive", fileShare.getLabel());
dbClient.markForDeletion(fileShare);
}
}
}
use of com.emc.storageos.db.client.model.FileShare in project coprhd-controller by CoprHD.
the class MirrorFileFailbackTaskCompleter method complete.
@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded coded) throws DeviceControllerException {
try {
setDbClient(dbClient);
recordMirrorOperation(dbClient, OperationTypeEnum.FAILBACK_FILE_MIRROR, status, getId());
} catch (Exception e) {
_log.error("Failed updating status. MirrorSessionFailback {}, for task " + getOpId(), getId(), e);
} finally {
if (Operation.Status.error.equals(status)) {
FileShare fileshare = dbClient.queryObject(FileShare.class, getId());
fileshare.setMirrorStatus(MirrorStatus.FAILED_OVER.name());
dbClient.updateObject(fileshare);
}
super.complete(dbClient, status, coded);
}
}
use of com.emc.storageos.db.client.model.FileShare in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doFailoverLink.
/**
* perform failover operation
* systemTarget - failover to target system
* fs - target filesystem
* completer - task completer
*
* return BiosCommandResult
*/
@Override
public BiosCommandResult doFailoverLink(StorageSystem systemTarget, FileShare fs, TaskCompleter completer) {
_log.info("IsilonFileStorageDevice - doFailoverLink started ");
FileShare sourceFS = null;
FileShare targetFS = null;
StorageSystem sourceSystem = null;
StorageSystem targetSystem = null;
boolean failback = false;
if (fs.getPersonality().equals(PersonalityTypes.TARGET.name())) {
sourceFS = _dbClient.queryObject(FileShare.class, fs.getParentFileShare());
targetFS = fs;
} else if (fs.getPersonality().equals(PersonalityTypes.SOURCE.name())) {
sourceFS = fs;
List<String> targetfileUris = new ArrayList<String>();
targetfileUris.addAll(fs.getMirrorfsTargets());
if (!targetfileUris.isEmpty()) {
targetFS = _dbClient.queryObject(FileShare.class, URI.create(targetfileUris.get(0)));
} else {
ServiceError serviceError = DeviceControllerErrors.isilon.unableToFailoverFileSystem(systemTarget.getIpAddress(), "Unable to get target filesystem for source filesystem " + fs.getName());
return BiosCommandResult.createErrorResult(serviceError);
}
failback = true;
}
sourceSystem = _dbClient.queryObject(StorageSystem.class, sourceFS.getStorageDevice());
targetSystem = _dbClient.queryObject(StorageSystem.class, targetFS.getStorageDevice());
PolicyStorageResource policyStrRes = getEquivalentPolicyStorageResource(sourceFS, _dbClient);
if (policyStrRes != null) {
IsilonSyncPolicy syncPolicy = policyNativeIdValidation(sourceSystem, policyStrRes);
String policyName = syncPolicy.getName();
BiosCommandResult cmdResult = null;
// In case of failback we do failover on the source file system, so we need to append _mirror
if (failback) {
String mirrorPolicyName = syncPolicy.getName();
mirrorPolicyName = mirrorPolicyName.concat(MIRROR_POLICY);
// prepared policy for failback
cmdResult = prepareFailbackOp(sourceSystem, policyName);
if (!cmdResult.isCommandSuccess()) {
return cmdResult;
}
// Call Isilon Api failback job
return doFailoverMirrorPolicy(sourceSystem, policyName, targetSystem, mirrorPolicyName, completer);
} else {
// prepared policy for failover
cmdResult = prepareFailoverOp(sourceSystem, policyName);
if (!cmdResult.isCommandSuccess()) {
_log.info("Unable to stop replication policy on source");
_log.info("Proceeding with failover anyway");
}
// Call Isilon Api failover job
return mirrorOperations.doFailover(targetSystem, syncPolicy.getId(), completer);
}
}
ServiceError serviceError = DeviceControllerErrors.isilon.unableToFailoverFileSystem(systemTarget.getIpAddress(), "Unable to get the policy details for filesystem :" + fs.getName());
return BiosCommandResult.createErrorResult(serviceError);
}
Aggregations