use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class BrocadeNetworkSystemDevice method updateZones.
@Override
public BiosCommandResult updateZones(NetworkSystem networkSystem, List<ZoneUpdate> zoneUpdates, String fabricId, String fabricWwn, boolean activateZoneset) throws NetworkDeviceControllerException {
BiosCommandResult cmdResults = null;
try {
WBEMClient client = getNetworkDeviceClient(networkSystem);
validateFabric(networkSystem, fabricWwn, fabricId);
Map<String, String> results = updateZonesStrategy(client, zoneUpdates, fabricId, fabricWwn, activateZoneset);
cmdResults = getBiosCommandResult(results);
_log.info("Update zone results {}", toMessage(results));
} catch (NetworkDeviceControllerException ex) {
_log.error("Cannot update zones: " + ex.getLocalizedMessage());
throw ex;
}
return cmdResults;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult 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);
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method updateExportRules.
@Override
public BiosCommandResult updateExportRules(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
// Requested Export Rules
List<ExportRule> exportAdd = args.getExportRulesToAdd();
List<ExportRule> exportDelete = args.getExportRulesToDelete();
List<ExportRule> exportModify = args.getExportRulesToModify();
// To be processed export rules
List<ExportRule> exportsToRemove = new ArrayList<>();
List<ExportRule> exportsToModify = new ArrayList<>();
List<ExportRule> exportsToAdd = new ArrayList<>();
// Calculate Export Path
String exportPath;
String subDir = args.getSubDirectory();
// ".snapshot"
if (!args.getFileOperation()) {
exportPath = args.getSnapshotPath();
if (subDir != null && subDir.length() > 0) {
exportPath = args.getSnapshotPath() + "/" + subDir;
}
} else {
exportPath = args.getFs().getPath();
if (subDir != null && subDir.length() > 0) {
exportPath = args.getFs().getPath() + "/" + subDir;
}
}
_log.info("exportPath : {}", exportPath);
args.setExportPath(exportPath);
try {
// add the new export rule from the array into the update request.
Map<String, ExportRule> arrayExportRuleMap = extraExportRuleFromArray(storage, args);
if (!arrayExportRuleMap.isEmpty()) {
if (exportModify != null) {
// merge the end point for which sec flavor is common.
for (ExportRule exportRule : exportModify) {
ExportRule arrayExportRule = arrayExportRuleMap.remove(exportRule.getSecFlavor());
if (arrayExportRule != null) {
if (exportRule.getReadOnlyHosts() != null) {
exportRule.getReadOnlyHosts().addAll(arrayExportRule.getReadOnlyHosts());
} else {
exportRule.setReadOnlyHosts(arrayExportRule.getReadOnlyHosts());
}
if (exportRule.getReadWriteHosts() != null) {
exportRule.getReadWriteHosts().addAll(arrayExportRule.getReadWriteHosts());
} else {
exportRule.setReadWriteHosts(arrayExportRule.getReadWriteHosts());
}
if (exportRule.getRootHosts() != null) {
exportRule.getRootHosts().addAll(arrayExportRule.getRootHosts());
} else {
exportRule.setRootHosts(arrayExportRule.getRootHosts());
}
}
}
// now add the remaining export rule
exportModify.addAll(arrayExportRuleMap.values());
} else {
// if exportModify is null then create a new export rule and add
exportModify = new ArrayList<ExportRule>();
exportModify.addAll(arrayExportRuleMap.values());
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
_log.error("Not able to fetch latest Export rule from backend array.", e);
}
// ALL EXPORTS
List<ExportRule> existingDBExportRule = args.getExistingDBExportRules();
List<ExportRule> exportsToprocess = new ArrayList<>();
for (ExportRule rule : existingDBExportRule) {
if (rule.getExportPath().equalsIgnoreCase(exportPath)) {
exportsToprocess.add(rule);
}
}
_log.info("Number of existing Rules found {} for exportPath {}", exportsToprocess.size(), exportPath);
// list and add to read/Write list.
if (!exportsToprocess.isEmpty() || !exportAdd.isEmpty()) {
if (exportModify != null && !exportModify.isEmpty()) {
for (ExportRule existingRule : exportsToprocess) {
for (ExportRule newExportRule : exportModify) {
if (newExportRule.getSecFlavor().equals(existingRule.getSecFlavor())) {
newExportRule.setDeviceExportId(existingRule.getDeviceExportId());
exportsToModify.add(newExportRule);
}
}
}
}
// Handle Delete export Rules
if (exportDelete != null && !exportDelete.isEmpty()) {
for (ExportRule existingRule : exportsToprocess) {
for (ExportRule oldExport : exportDelete) {
if (oldExport.getSecFlavor().equals(existingRule.getSecFlavor())) {
_log.info("Deleting Export Rule {}", existingRule);
exportsToRemove.add(existingRule);
}
}
}
}
// No of exports found to remove from the list
_log.info("No of exports found to remove from the existing exports list {}", exportsToRemove.size());
exportsToprocess.removeAll(exportsToRemove);
// Handle Add Export Rules
if (exportAdd != null && !exportAdd.isEmpty()) {
for (ExportRule newExport : exportAdd) {
_log.info("Add Export Rule {}", newExport);
newExport.setExportPath(exportPath);
exportsToAdd.add(newExport);
}
}
exportsToprocess.addAll(exportAdd);
}
// Process Mods
IsilonApi isi = getIsilonDevice(storage);
for (ExportRule existingRule : exportsToModify) {
_log.info("Modify Export rule : {}", existingRule.toString());
}
processIsiExport(isi, args, exportsToModify);
for (ExportRule existingRule : exportsToRemove) {
_log.info("Remove Export rule : {}", existingRule.toString());
}
processRemoveIsiExport(isi, args, exportsToRemove);
for (ExportRule existingRule : exportsToAdd) {
_log.info("Add Export rule : {}", existingRule.toString());
}
processAddIsiExport(isi, args, exportsToAdd);
BiosCommandResult result = BiosCommandResult.createSuccessfulResult();
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method prepareFailbackOp.
/**
* prepare policy to failback.
*
* @param systemTarget - target storagesystem
* @param policyName -failback mirror policy
* @return
*/
private BiosCommandResult prepareFailbackOp(final StorageSystem targetSystem, String policyName) {
BiosCommandResult cmdResult = null;
// check for target device up and then disable the policy
cmdResult = mirrorOperations.doTestReplicationPolicy(targetSystem, policyName);
if (cmdResult.isCommandSuccess()) {
// if policy enables on target storage then We should disable it before failback job
cmdResult = mirrorOperations.doStopReplicationPolicy(targetSystem, policyName);
} else {
ServiceError serviceError = DeviceControllerErrors.isilon.unableToFailbackReplicationPolicy(targetSystem.getIpAddress(), policyName, cmdResult.getMessage());
return BiosCommandResult.createErrorResult(serviceError);
}
return cmdResult;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doRestoreFS.
@Override
public BiosCommandResult doRestoreFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
BiosCommandResult result = new BiosCommandResult();
String opName = ResourceOperationTypeEnum.RESTORE_FILE_SNAPSHOT.getName();
ServiceError serviceError = IsilonException.errors.jobFailed(opName);
result.error(serviceError);
return result;
}
Aggregations