use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doRollbackMirrorLink.
/**
* rollback the target filesystems
*/
@Override
public void doRollbackMirrorLink(StorageSystem system, List<URI> sources, List<URI> targets, TaskCompleter completer, String opId) {
BiosCommandResult biosCommandResult = null;
// delete the target objects
if (targets != null && !targets.isEmpty()) {
for (URI target : targets) {
FileShare fileShare = _dbClient.queryObject(FileShare.class, target);
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, fileShare.getStorageDevice());
URI uriParent = fileShare.getParentFileShare().getURI();
if (sources.contains(uriParent) == true) {
// Do not delete the file target file system with force flag
biosCommandResult = rollbackCreatedFilesystem(storageSystem, target, opId, false);
if (biosCommandResult.getCommandSuccess()) {
fileShare.getOpStatus().updateTaskStatus(opId, biosCommandResult.toOperation());
fileShare.setInactive(true);
_dbClient.updateObject(fileShare);
}
}
}
}
completer.ready(_dbClient);
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method updateStorageSystemFileProtectionPolicy.
@Override
public BiosCommandResult updateStorageSystemFileProtectionPolicy(StorageSystem storage, FileDeviceInputOutput args) {
FilePolicy existingPolicy = args.getFileProtectionPolicy();
PolicyStorageResource policyRes = args.getPolicyStorageResource();
FilePolicyUpdateParam policyUpdateParam = args.getFileProtectionPolicyUpdateParam();
IsilonApi isi = getIsilonDevice(storage);
BiosCommandResult result = null;
try {
if (existingPolicy.getFilePolicyType().equals(FilePolicy.FilePolicyType.file_replication.name())) {
boolean isVersion8above = false;
if (VersionChecker.verifyVersionDetails(ONEFS_V8, storage.getFirmwareVersion()) >= 0) {
isVersion8above = true;
}
return updateStorageSystemFileReplicationPolicy(isi, policyRes, existingPolicy, policyUpdateParam, isVersion8above);
} else if (existingPolicy.getFilePolicyType().equals(FilePolicy.FilePolicyType.file_snapshot.name())) {
return updateStorageSystemFileSnapshotPolicy(isi, policyRes, existingPolicy, policyUpdateParam);
} else {
String errorMsg = "Invalid policy type {} " + existingPolicy.getFilePolicyType();
_log.error(errorMsg);
final ServiceCoded serviceCoded = DeviceControllerException.errors.jobFailedOpMsg(OperationTypeEnum.UPDATE_STORAGE_SYSTEM_POLICY_BY_POLICY_RESOURCE.toString(), errorMsg);
result = BiosCommandResult.createErrorResult(serviceCoded);
existingPolicy.getOpStatus().updateTaskStatus(args.getOpId(), result.toOperation());
return result;
}
} catch (IsilonException e) {
_log.error("Update storage system policy for file policy failed.", e);
return BiosCommandResult.createErrorResult(e);
}
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doResyncPrepSourcePolicy.
/**
* this command issue on source system when source policy in failover state.
* when resync-prep issue on source policy then it will create mirror policy.
* this mirror policy will from source to target
*
* 'resync-prep' call on source policy will create new "*_mirror" policy
*
* @param sourceSystem - source system
* @param targetSystem - target system
* @param sourcePolicyName - source policy name from source to target
* @param completer
* @return
*/
private BiosCommandResult doResyncPrepSourcePolicy(StorageSystem sourceSystem, StorageSystem targetSystem, String policyName, TaskCompleter completer) {
_log.info("doResyncPrepSourcePolicy - resync-prep action on source policy {} ", policyName);
BiosCommandResult cmdResult = null;
IsilonSyncTargetPolicy policy = null;
// test the source policy details
cmdResult = mirrorOperations.doTestReplicationPolicy(sourceSystem, policyName);
if (cmdResult.isCommandSuccess()) {
// get source policy details on target storage system
policy = mirrorOperations.getIsilonSyncTargetPolicy(targetSystem, policyName);
if (cmdResult.isCommandSuccess() && null != policy) {
// enable the replication policy
cmdResult = mirrorOperations.doEnablePolicy(sourceSystem, policyName);
if (!cmdResult.isCommandSuccess()) {
return cmdResult;
}
// get source policy details of local target on target system (policy : source -> target)
if (JobState.finished.equals(policy.getLastJobState()) && FOFB_STATES.resync_policy_created.equals(policy.getFoFbState())) {
_log.info("Skipped the resyncprep action on policy : {}", policyName);
_log.info(String.format("Source policy details : - %s ", policy.toString()));
return BiosCommandResult.createSuccessfulResult();
// if policy is failed then we call to get the reports, return error
} else if (JobState.failed.equals(policy.getLastJobState()) || JobState.needs_attention.equals(policy.getLastJobState())) {
return getSyncPolicyErrorReport(sourceSystem, policy);
} else {
// call isilon api
return mirrorOperations.doResyncPrep(sourceSystem, policyName, completer);
}
} else {
return cmdResult;
}
} else {
return cmdResult;
}
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method updateNfsACLs.
@Override
public BiosCommandResult updateNfsACLs(StorageSystem storage, FileDeviceInputOutput args) {
try {
// read nameToSid flag from controller config.
Boolean sidEnable = customConfigHandler.getComputedCustomConfigBooleanValue(CustomConfigConstants.ISILON_USER_TO_SID_MAPPING_FOR_NFS_ENABLED, storage.getSystemType(), null);
// get sid mapping based on Controller config and it belong to VirtualNAS.
if (sidEnable && args.getvNAS() != null) {
updateSidInfoForNfsACE(args, storage);
}
IsilonNFSACL isilonAcl = new IsilonNFSACL();
ArrayList<Acl> aclCompleteList = new ArrayList<Acl>();
List<NfsACE> aceToAdd = args.getNfsAclsToAdd();
for (NfsACE nfsACE : aceToAdd) {
Acl acl = getIsilonAclFromNfsACE(nfsACE);
acl.setOp("add");
aclCompleteList.add(acl);
}
List<NfsACE> aceToModify = args.getNfsAclsToModify();
for (NfsACE nfsACE : aceToModify) {
Acl acl = getIsilonAclFromNfsACE(nfsACE);
acl.setOp("replace");
aclCompleteList.add(acl);
}
List<NfsACE> aceToDelete = args.getNfsAclsToDelete();
for (NfsACE nfsACE : aceToDelete) {
Acl acl = getIsilonAclFromNfsACE(nfsACE);
acl.setOp("delete");
aclCompleteList.add(acl);
}
isilonAcl.setAction("update");
isilonAcl.setAuthoritative("acl");
isilonAcl.setAcl(aclCompleteList);
String path = args.getFileSystemPath();
if (args.getSubDirectory() != null && !args.getSubDirectory().isEmpty()) {
path = path + "/" + args.getSubDirectory();
}
// Process new ACLs
IsilonApi isi = getIsilonDevice(storage);
_log.info("Calling Isilon API: modify NFS Acl for {}, acl {}", args.getFileSystemPath(), isilonAcl);
isi.modifyNFSACL(path, isilonAcl);
_log.info("End updateNfsACLs");
BiosCommandResult result = BiosCommandResult.createSuccessfulResult();
return result;
} catch (IsilonException e) {
_log.error("updateNfsACLs failed ", e);
return BiosCommandResult.createErrorResult(e);
} catch (Exception e) {
_log.error("updateNfsACLs failed ", e);
final ServiceCoded serviceCoded = DeviceControllerException.errors.jobFailedOpMsg(OperationTypeEnum.UPDATE_FILE_SYSTEM_NFS_ACL.toString(), e.getMessage());
return BiosCommandResult.createErrorResult(serviceCoded);
}
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class IsilonMirrorOperations method doStopReplicationPolicy.
/**
* Call to device to stop policy
*
* @param system
* @param policyName
* @return
*/
public BiosCommandResult doStopReplicationPolicy(IsilonApi isi, String policyName) {
try {
IsilonSyncPolicy policy = isi.getReplicationPolicy(policyName);
if (policy.getLastJobState().equals(JobState.running)) {
BiosCommandResult cmdResult = doCancelReplicationPolicy(isi, policyName);
if (!cmdResult.isCommandSuccess()) {
return cmdResult;
} else {
// if the replication still running through exception
policy = isi.getReplicationPolicy(policyName);
if (policy.getLastJobState().equals(JobState.running)) {
ServiceError error = DeviceControllerErrors.isilon.jobFailed("Unable Stop Replication policy and policy state :" + policy.getLastJobState().toString());
return BiosCommandResult.createErrorResult(error);
}
}
}
// disable the policy
if (policy.getEnabled()) {
IsilonSyncPolicy modifiedPolicy = new IsilonSyncPolicy();
modifiedPolicy.setEnabled(false);
isi.modifyReplicationPolicy(policyName, modifiedPolicy);
_log.info("Sleeping for 40 seconds for stop operation to complete...");
TimeUnit.SECONDS.sleep(40);
_log.info("Replication Policy -{} disabled successfully.", policy.toString());
return BiosCommandResult.createSuccessfulResult();
} else {
_log.info("Replication Policy - {} can't be STOPPED because policy is already DISABLED", policy.toString());
return BiosCommandResult.createSuccessfulResult();
}
} catch (IsilonException e) {
return BiosCommandResult.createErrorResult(e);
} catch (InterruptedException ex) {
_log.warn("Stoping ReplicationPolicy - {} Interrupted", policyName);
ServiceError error = DeviceControllerErrors.isilon.jobFailed("Stoping ReplicationPolicy is Failed with Interrupt exception and message :" + ex.getMessage());
return BiosCommandResult.createErrorResult(error);
}
}
Aggregations