use of com.emc.storageos.netappc.NetAppClusterApi in project coprhd-controller by CoprHD.
the class NetAppClusterModeDevice method doUpdateQuotaDirectory.
@Override
public BiosCommandResult doUpdateQuotaDirectory(StorageSystem storage, FileDeviceInputOutput args, QuotaDirectory qtree) throws ControllerException {
BiosCommandResult result = new BiosCommandResult();
try {
_log.info("NetAppClusterModeDevice doUpdateQuotaDirectory - start");
// Using NetApp terminology here
String volName = args.getFsName();
String qtreeName = args.getQuotaDirectoryName();
Boolean oplocks = qtree.getOpLock();
String securityStyle = qtree.getSecurityStyle();
Long size = qtree.getSize();
String method = new String("doUpdateQuotaDirectory");
result = validateQuotaDirectoryParams(volName, qtreeName, method);
if (!result.isCommandSuccess()) {
return result;
}
String portGroup = findSVMName(args.getFs());
NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
ncApi.updateQtree(qtreeName, volName, oplocks, securityStyle, size, portGroup);
result = BiosCommandResult.createSuccessfulResult();
} catch (NetAppCException e) {
_log.error("NetAppClusterModeDevice::doUpdateQuotaDirectory failed with a NetAppCException", e);
ServiceError serviceError = DeviceControllerErrors.netappc.unableToUpdateQtree();
serviceError.setMessage(e.getLocalizedMessage());
result = BiosCommandResult.createErrorResult(serviceError);
} catch (Exception e) {
_log.error("NetAppClusterModeDevice::doUpdateQuotaDirectory failed with an Exception", e);
ServiceError serviceError = DeviceControllerErrors.netappc.unableToUpdateQtree();
serviceError.setMessage(e.getLocalizedMessage());
result = BiosCommandResult.createErrorResult(serviceError);
}
return result;
}
use of com.emc.storageos.netappc.NetAppClusterApi in project coprhd-controller by CoprHD.
the class NetAppClusterModeDevice method getFSSnapshotList.
@Override
public BiosCommandResult getFSSnapshotList(StorageSystem storage, FileDeviceInputOutput args, List<String> dbSnapshots) throws ControllerException {
if (null == args.getFsName()) {
throw new DeviceControllerException("Filesystem name is either missing or empty", new Object[] {});
}
_log.info("NetAppClusterModeDevice getFSSnapshotList: {} - start", args.getFsName());
BiosCommandResult result = new BiosCommandResult();
String portGroup = findSVMName(args.getFs());
NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
try {
List<String> deviceSnapshots = ncApi.listSnapshots(args.getFsName());
if (deviceSnapshots == null) {
_log.warn("NetAppClusterModeDevice getFSSnapshotList {} - failed", args.getFsId());
result.setCommandSuccess(false);
result.setMessage("NetAppClusterModeDevice getFSSnapshotList failed for FS {}" + args.getFsName());
result.setCommandStatus(Operation.Status.error.name());
} else {
for (String deviceSnapshotName : deviceSnapshots) {
dbSnapshots.add(deviceSnapshotName);
}
_log.info("NetAppClusterModeDevice getFSSnapshotList - successful for filesystem, {} ", args.getFsName());
result.setCommandSuccess(true);
result.setCommandStatus(Operation.Status.ready.name());
result.setMessage("List of snapshots for FS " + args.getFsName() + " was successfully retreived from device ");
}
} catch (NetAppCException e) {
String[] params = { storage.getId().toString(), args.getFsName() };
throw new DeviceControllerException("Failed to retrieve list of snapshots from device {1} for filesystem {2}", params);
}
return result;
}
use of com.emc.storageos.netappc.NetAppClusterApi in project coprhd-controller by CoprHD.
the class NetAppClusterModeDevice method doDeleteQuotaDirectory.
@Override
public BiosCommandResult doDeleteQuotaDirectory(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
BiosCommandResult result = new BiosCommandResult();
try {
_log.info("NetAppClusterModeDevice doDeleteQuotaDirectory - start");
// Using NetApp terminology here
String volName = args.getFsName();
String qtreeName = args.getQuotaDirectoryName();
String method = new String("doDeleteQuotaDirectory");
result = validateQuotaDirectoryParams(volName, qtreeName, method);
if (!result.isCommandSuccess()) {
return result;
}
String portGroup = findSVMName(args.getFs());
NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
ncApi.deleteQtree(qtreeName, volName, portGroup);
result = BiosCommandResult.createSuccessfulResult();
} catch (NetAppCException e) {
_log.error("NetAppClusterModeDevice::doDeleteQuotaDirectory failed with a NetAppCException", e);
ServiceError serviceError = DeviceControllerErrors.netappc.unableToDeleteQtree();
serviceError.setMessage(e.getLocalizedMessage());
result = BiosCommandResult.createErrorResult(serviceError);
} catch (Exception e) {
_log.error("NetAppClusterModeDevice::doDeleteQuotaDirectory failed with an Exception ", e);
ServiceError serviceError = DeviceControllerErrors.netappc.unableToDeleteQtree();
serviceError.setMessage(e.getLocalizedMessage());
result = BiosCommandResult.createErrorResult(serviceError);
}
return result;
}
use of com.emc.storageos.netappc.NetAppClusterApi in project coprhd-controller by CoprHD.
the class NetAppClusterModeDevice method doDeleteSnapshot.
@Override
public BiosCommandResult doDeleteSnapshot(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
if (null == args.getFsName()) {
throw new DeviceControllerException("Filesystem name is either missing or empty", new Object[] {});
}
if (null == args.getSnapshotName()) {
throw new DeviceControllerException("Snapshot name is either missing or empty for filesystem name {0}", new Object[] { args.getFsName() });
}
_log.info("NetAppClusterModeDevice doDeleteSnapshot: {},{} - start", args.getSnapshotId(), args.getSnapshotName());
BiosCommandResult result = new BiosCommandResult();
String portGroup = findSVMName(args.getFs());
NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
try {
if (!ncApi.deleteSnapshot(args.getFsName(), args.getSnapshotName())) {
_log.error("NetAppClusterModeDevice doDeleteSnapshot {} - failed", args.getFsId());
result.setCommandSuccess(false);
result.setMessage("NetAppClusterModeDevice doDeleteSnapshot - failed");
result.setCommandStatus(Operation.Status.error.name());
} else {
_log.info("doDeleteSnapshot for snapshot {} on filesystem {} successful", args.getSnapshotName(), args.getFsName());
result.setCommandSuccess(true);
result.setCommandStatus(Operation.Status.ready.name());
result.setMessage("Snapshot," + args.getSnapshotName() + " has been successfully deleted");
}
} catch (NetAppCException e) {
throw new DeviceControllerException("Failed to delete snapshot, {0} for filesystem, {1} with: {2}", new Object[] { args.getSnapshotName(), args.getFsName(), e.getMessage() });
}
return result;
}
use of com.emc.storageos.netappc.NetAppClusterApi in project coprhd-controller by CoprHD.
the class NetAppClusterModeDevice method deleteShareACLs.
@Override
public BiosCommandResult deleteShareACLs(StorageSystem storage, FileDeviceInputOutput args) {
BiosCommandResult result = new BiosCommandResult();
List<ShareACL> existingAcls = new ArrayList<ShareACL>();
existingAcls = args.getExistingShareAcls();
String portGroup = findSVMName(args.getFs());
NetAppClusterApi ncApi = new NetAppClusterApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).svm(portGroup).build();
try {
updateShareAcl(ncApi, args.getShareName(), existingAcls, AclOperation.DELETE);
result = BiosCommandResult.createSuccessfulResult();
} catch (Exception e) {
_log.error("NetAppClusterModeDevice::Delete All ACL failed with an Exception", e);
ServiceError serviceError = DeviceControllerErrors.netappc.unableToDeleteCIFSShareAcl();
serviceError.setMessage(e.getLocalizedMessage());
result = BiosCommandResult.createErrorResult(serviceError);
}
return result;
}
Aggregations