use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class IsilonMirrorOperations method deleteMirrorFileShareLink.
public void deleteMirrorFileShareLink(StorageSystem system, URI source, URI target, TaskCompleter completer) throws DeviceControllerException {
IsilonSyncPolicy policy;
IsilonApi isi = null;
BiosCommandResult cmdResult = null;
FileShare targetFileShare = _dbClient.queryObject(FileShare.class, target);
FileShare sourceFileShare = _dbClient.queryObject(FileShare.class, source);
String policyName = targetFileShare.getLabel();
StorageSystem sourceStorageSystem = _dbClient.queryObject(StorageSystem.class, sourceFileShare.getStorageDevice());
isi = getIsilonDevice(sourceStorageSystem);
try {
policy = isi.getReplicationPolicy(policyName);
} catch (IsilonException e) {
_log.info("Not able to get policy : {} due to : {} ", policyName, e.getMessage());
completer.ready(_dbClient);
WorkflowStepCompleter.stepSucceded(completer.getOpId());
return;
}
if (policy != null) {
cmdResult = dodeleteReplicationPolicy(system, policyName);
}
// Check if mirror policy exists on target system if yes, delete it..
if (cmdResult != null && cmdResult.getCommandSuccess()) {
StorageSystem targetStorageSystem = _dbClient.queryObject(StorageSystem.class, targetFileShare.getStorageDevice());
isi = getIsilonDevice(targetStorageSystem);
String mirrorPolicyName = policyName.concat("_mirror");
try {
policy = isi.getReplicationPolicy(mirrorPolicyName);
} catch (IsilonException e) {
_log.info("Mirror policy named : {} not found on the target system", mirrorPolicyName);
completer.ready(_dbClient);
WorkflowStepCompleter.stepSucceded(completer.getOpId());
return;
}
if (policy != null) {
cmdResult = dodeleteReplicationPolicy(targetStorageSystem, mirrorPolicyName);
}
}
if (cmdResult != null && cmdResult.getCommandSuccess()) {
completer.ready(_dbClient);
WorkflowStepCompleter.stepSucceded(completer.getOpId());
} else {
completer.error(_dbClient, cmdResult.getServiceCoded());
}
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class NetAppFileStorageDevice method doDeleteFS.
/**
* Deleting a file system: - deletes FileSystem and any correponding exports, smb shares
*
* @param StorageSystem storage
* @param args FileDeviceInputOutput
* @return BiosCommandResult
* @throws ControllerException
*/
@Override
public BiosCommandResult doDeleteFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
BiosCommandResult result = new BiosCommandResult();
try {
_log.info("NetAppFileStorageDevice doDeleteFS - start");
if (null == args.getFsName()) {
_log.error("NetAppFileStorageDevice::doDeletFS failed: Filesystem name is either missing or empty");
ServiceError serviceError = DeviceControllerErrors.netapp.unableToDeleteFileSystem();
serviceError.setMessage("Filesystem name is either missing or empty");
result = BiosCommandResult.createErrorResult(serviceError);
return result;
}
FileShare fileshare = args.getFs();
// Now get the VFiler from the fileShare
String portGroup = findVfilerName(fileshare);
if (null != args.getFsShares() && !args.getFsShares().isEmpty()) {
if (!netAppDeleteCIFSExports(storage, args.getFsShares(), portGroup)) {
_log.info("NetAppFileStorageDevice doDeletFS:netAppDeleteCIFSExports {} - failed", args.getFsName());
} else {
_log.info("NetAppFileStorageDevice doDeletFS:netAppDeleteCIFSExports {} - succeeded", args.getFsName());
}
}
boolean failedStatus = false;
NetAppApi nApi = new NetAppApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).vFiler(portGroup).build();
if (!nApi.deleteFS(args.getFsName())) {
failedStatus = true;
}
if (failedStatus == true) {
_log.error("NetAppFileStorageDevice doDeletFS {} - failed", args.getFsName());
ServiceError serviceError = DeviceControllerErrors.netapp.unableToDeleteFileSystem();
result = BiosCommandResult.createErrorResult(serviceError);
} else {
_log.info("NetAppFileStorageDevice doDeletFS {} - complete", args.getFsName());
result = BiosCommandResult.createSuccessfulResult();
}
} catch (NetAppException e) {
_log.error("NetAppFileStorageDevice::doDeleteFS failed with a NetAppException", e);
ServiceError serviceError = DeviceControllerErrors.netapp.unableToDeleteFileSystem();
serviceError.setMessage(e.getLocalizedMessage());
result = BiosCommandResult.createErrorResult(serviceError);
} catch (Exception e) {
_log.error("NetAppFileStorageDevice::doDeleteFS failed with an Exception", e);
ServiceError serviceError = DeviceControllerErrors.netapp.unableToDeleteFileSystem();
serviceError.setMessage(e.getLocalizedMessage());
result = BiosCommandResult.createErrorResult(serviceError);
}
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class NetAppFileStorageDevice method doRestoreFS.
@Override
public BiosCommandResult doRestoreFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
BiosCommandResult result = new BiosCommandResult();
try {
_log.info("NetAppFileStorageDevice doRestoreFS - start");
if (null == args.getFsName()) {
_log.error("NetAppFileStorageDevice::doRestoreFS failed: Filesystem name is either missing or empty");
ServiceError serviceError = DeviceControllerErrors.netapp.unableToRestoreFileSystem();
serviceError.setMessage(FileSystemConstants.FS_ERR_FS_NAME_MISSING_OR_EMPTY);
result = BiosCommandResult.createErrorResult(serviceError);
return result;
}
if (null == args.getSnapshotName()) {
_log.error("NetAppFileStorageDevice::doRestoreFS failed: Snapshot name is either missing or empty");
ServiceError serviceError = DeviceControllerErrors.netapp.unableToRestoreFileSystem();
serviceError.setMessage(FileSystemConstants.FS_ERR_SNAPSHOT_NAME_MISSING_OR_EMPTY);
result = BiosCommandResult.createErrorResult(serviceError);
return result;
}
NetAppApi nApi = new NetAppApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).build();
if (!nApi.restoreSnapshot(args.getFsName(), args.getSnapshotName())) {
_log.error("NetAppFileStorageDevice doRestoreFS {} - failed", args.getFsName());
ServiceError serviceError = DeviceControllerErrors.netapp.unableToRestoreFileSystem();
result = BiosCommandResult.createErrorResult(serviceError);
} else {
_log.info("doRestoreFS - restore of snapshot, {} was successfully for filesystem, {} ", args.getSnapshotName(), args.getFsName());
result = BiosCommandResult.createSuccessfulResult();
}
} catch (NetAppException e) {
_log.error("NetAppFileStorageDevice::doRestoreFS failed with a NetAppException", e);
ServiceError serviceError = DeviceControllerErrors.netapp.unableToRestoreFileSystem();
serviceError.setMessage(e.getLocalizedMessage());
result = BiosCommandResult.createErrorResult(serviceError);
} catch (Exception e) {
_log.error("NetAppFileStorageDevice::doRestoreFS failed with an Exception", e);
ServiceError serviceError = DeviceControllerErrors.netapp.unableToRestoreFileSystem();
serviceError.setMessage(e.getLocalizedMessage());
result = BiosCommandResult.createErrorResult(serviceError);
}
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class NetAppFileStorageDevice method getPhysicalInventory.
@Override
public BiosCommandResult getPhysicalInventory(StorageSystem storage) {
BiosCommandResult result = new BiosCommandResult();
result.setCommandSuccess(true);
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class NetAppFileStorageDevice method deleteShareACLs.
@Override
public BiosCommandResult deleteShareACLs(StorageSystem storage, FileDeviceInputOutput args) {
BiosCommandResult result = new BiosCommandResult();
List<ShareACL> existingAcls = new ArrayList<ShareACL>();
existingAcls = args.getExistingShareAcls();
NetAppApi nApi = new NetAppApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).build();
try {
deleteShareAcl(nApi, args.getShareName(), existingAcls);
result = BiosCommandResult.createSuccessfulResult();
} catch (Exception e) {
_log.error("NetAppFileStorageDevice::Delete All ACL failed with an Exception", e);
ServiceError serviceError = DeviceControllerErrors.netapp.unableToDeleteCIFSShareAcl();
serviceError.setMessage(e.getLocalizedMessage());
result = BiosCommandResult.createErrorResult(serviceError);
}
return result;
}
Aggregations