use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class VNXFileStorageDeviceXML method doDeleteShare.
@Override
public BiosCommandResult doDeleteShare(StorageSystem storage, FileDeviceInputOutput args, SMBFileShare smbFileShare) throws ControllerException {
_log.info("Call FileShare doDeleteShare");
XMLApiResult result = null;
ApplicationContext context = null;
try {
context = loadContext();
VNXFileCommApi vnxComm = loadVNXFileCommunicationAPIs(context);
if (null == vnxComm) {
throw VNXException.exceptions.communicationFailed(VNXCOMM_ERR_MSG);
}
StorageHADomain dm = null;
String mountPoint = null;
if (args.getFileOperation()) {
mountPoint = args.getFs().getMountPath();
// Get DataMover
dm = this.getDataMover(args.getFs());
if (dm == null) {
Exception e = new Exception("VNX File Share creation Failed Data Mover not found");
throw VNXException.exceptions.createExportFailed("VNX File Delete Share Failed Data Mover not found", e);
}
} else {
// Get DataMover
URI snapshotId = args.getSnapshotId();
Snapshot snapshot = _dbClient.queryObject(Snapshot.class, snapshotId);
FileShare fileshare = _dbClient.queryObject(FileShare.class, snapshot.getParent().getURI());
mountPoint = fileshare.getMountPath();
dm = this.getDataMover(fileshare);
if (dm == null) {
Exception e = new Exception("VNX File Share creation Failed Data Mover not found");
throw VNXException.exceptions.createExportFailed("VNX File Delete Share Failed Data Mover not found", e);
}
}
result = vnxComm.doDeleteShare(storage, dm, smbFileShare.getName(), mountPoint, false, args);
args.getFileObjShares().remove(smbFileShare.getName());
} catch (VNXException e) {
throw new DeviceControllerException(e);
} finally {
clearContext(context);
}
BiosCommandResult cmdResult = null;
if (result.isCommandSuccess()) {
cmdResult = BiosCommandResult.createSuccessfulResult();
} else {
cmdResult = BiosCommandResult.createErrorResult(DeviceControllerErrors.vnx.unableToDeleteFileShare(result.getMessage()));
}
return cmdResult;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class VNXFileStorageDeviceXML method doCreateFS.
@Override
public BiosCommandResult doCreateFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
Map<String, String> autoExtendAtts = getAutoExtendAttrs(args);
Long fsSize = args.getFsCapacity() / BYTESPERMB;
if (fsSize < 1) {
// Invalid size throw an error
String errMsg = "doCreateFS failed : FileSystem size in bytes is not valid " + args.getFsCapacity();
_log.error(errMsg);
return BiosCommandResult.createErrorResult(DeviceControllerErrors.vnx.unableToCreateFileSystem(errMsg));
}
_log.info("FileSystem size translation : {} : {} ", args.getFsCapacity(), fsSize);
XMLApiResult result = null;
ApplicationContext context = null;
try {
context = loadContext();
VNXFileCommApi vnxComm = loadVNXFileCommunicationAPIs(context);
if (null == vnxComm) {
throw VNXException.exceptions.communicationFailed(VNXCOMM_ERR_MSG);
}
result = vnxComm.createFileSystem(storage, args.getFsName(), // This will be used for CLI create FS
args.getPoolName(), "1", fsSize, args.getThinProvision(), args.getNativeDeviceFsId(), autoExtendAtts);
if (result.isCommandSuccess()) {
VNXFileSystem vnxFS = (VNXFileSystem) result.getObject();
args.setFsNativeId(String.valueOf(vnxFS.getFsId()));
String path = "/" + args.getFsName();
// Set path & mountpath
args.setFsMountPath(path);
args.setFsPath(path);
}
} catch (VNXException e) {
throw DeviceControllerException.exceptions.unableToCreateFileSystem(e.getMessage(Locale.getDefault()));
} finally {
clearContext(context);
}
BiosCommandResult cmdResult = null;
if (result.isCommandSuccess()) {
cmdResult = BiosCommandResult.createSuccessfulResult();
} else {
cmdResult = BiosCommandResult.createErrorResult(DeviceControllerErrors.vnx.unableToCreateFileSystem(result.getMessage()));
}
return cmdResult;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doCreateQuotaDirectory.
@Override
public BiosCommandResult doCreateQuotaDirectory(StorageSystem storage, FileDeviceInputOutput args, QuotaDirectory qd) throws ControllerException {
BiosCommandResult result = new BiosCommandResult();
ServiceError serviceError = DeviceControllerErrors.vnxe.operationNotSupported("Create Quota Directory", "VNXe");
result = BiosCommandResult.createErrorResult(serviceError);
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doModifyFS.
@Override
public BiosCommandResult doModifyFS(StorageSystem storage, FileDeviceInputOutput fd) throws ControllerException {
BiosCommandResult result = new BiosCommandResult();
result.setCommandSuccess(false);
result.setCommandStatus(Operation.Status.error.name());
result.setMessage("Modify FS NOT supported for VNXe.");
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doDeleteFS.
/*
* @Override
* public BiosCommandResult doDeleteFS(StorageSystem storage,
* FileDeviceInputOutput fileInOut) throws ControllerException {
* _logger.info("deleting file system: ", fileInOut.getFsName());
* VNXeApiClient apiClient = getVnxeClient(storage);
* VNXeCommandJob job = null;
* VNXeFileTaskCompleter completer = null;
* try {
* job = apiClient.deleteFileSystem(fileInOut.getFsNativeId(), fileInOut.getForceDelete());
* if (job != null) {
* completer = new VNXeFileTaskCompleter(FileShare.class, fileInOut.getFsId(), fileInOut.getOpId(),
* OperationTypeEnum.DELETE_FILE_SYSTEM);
* VNXeDeleteFileSystemJob deleteFSJob = new VNXeDeleteFileSystemJob(job.getId(), storage.getId(),
* completer, fileInOut.getForceDelete());
* ControllerServiceImpl.enqueueJob(new QueueJob(deleteFSJob));
* } else {
* _logger.error("No job returned from deleteFileSystem");
* ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystem",
* "No Job returned from deleteFileSystem");
* return BiosCommandResult.createErrorResult(error);
* }
*
* }catch (VNXeException e) {
* _logger.error("Delete file system got the exception", e);
* if (completer != null) {
* completer.error(_dbClient, e);
* }
* return BiosCommandResult.createErrorResult(e);
* } catch (Exception ex) {
* _logger.error("Delete file system got the exception", ex);
* ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystem", ex.getMessage());
* if (completer != null) {
* completer.error(_dbClient, error);
* }
* return BiosCommandResult.createErrorResult(error);
* }
* StringBuilder logMsgBuilder = new StringBuilder(String.format(
* "Delete filesystem job submitted - Array:%s, fileSystem: %s", storage.getSerialNumber(),
* fileInOut.getFsName()));
* _logger.info(logMsgBuilder.toString());
* return BiosCommandResult.createPendingResult();
* }
*/
/*
* To get around the KH API delete file system async issues, using sync call for now.
*/
@Override
public BiosCommandResult doDeleteFS(StorageSystem storage, FileDeviceInputOutput fileInOut) throws ControllerException {
_logger.info("deleting file system: ", fileInOut.getFsName());
VNXeApiClient apiClient = getVnxeClient(storage);
BiosCommandResult result = null;
try {
apiClient.deleteFileSystemSync(fileInOut.getFsNativeId(), fileInOut.getForceDelete());
StringBuilder logMsgBuilder = new StringBuilder(String.format("Deleted filesystem - Array:%s, fileSystem: %s", storage.getSerialNumber(), fileInOut.getFsName()));
_logger.info(logMsgBuilder.toString());
result = BiosCommandResult.createSuccessfulResult();
} catch (VNXeException e) {
_logger.error("Delete file system got the exception", e);
result = BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Delete file system got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystem", ex.getMessage());
result = BiosCommandResult.createErrorResult(error);
}
return result;
}
Aggregations