use of com.emc.storageos.vnxe.requests.FileSystemActionRequest in project coprhd-controller by CoprHD.
the class VNXeApiClient method removeNfsShare.
/**
* Delete nfsShare
*
* @param nfsShareId
* nfsShare Id
* @param fsId
* file system Id
* @return VNXeCommandJob
*/
public VNXeCommandJob removeNfsShare(String nfsShareId, String fsId) {
VNXeCommandJob job = null;
_logger.info("unexporting file system:" + fsId);
FileSystemRequest fsRequest = new FileSystemRequest(_khClient, fsId);
VNXeFileSystem fs = fsRequest.get();
if (fs == null) {
_logger.error("Could not find file system in the vxne");
throw VNXeException.exceptions.vnxeCommandFailed("Could not find file system in the vnxe for: " + fsId);
}
if (nfsShareId == null || nfsShareId.isEmpty()) {
_logger.error("NfsShareId is empty.");
throw VNXeException.exceptions.vnxeCommandFailed("NfsShareId is empty. ");
}
String resourceId = fs.getStorageResource().getId();
ModifyFileSystemParam modifyFSParm = new ModifyFileSystemParam();
// set NfsShare delete parm
NfsShareDeleteParam deleteParam = new NfsShareDeleteParam();
VNXeBase share = new VNXeBase();
share.setId(nfsShareId);
deleteParam.setNfsShare(share);
List<NfsShareDeleteParam> deleteList = new ArrayList<NfsShareDeleteParam>();
deleteList.add(deleteParam);
modifyFSParm.setNfsShareDelete(deleteList);
FileSystemActionRequest req = new FileSystemActionRequest(_khClient);
job = req.modifyFileSystemAsync(modifyFSParm, resourceId);
return job;
}
use of com.emc.storageos.vnxe.requests.FileSystemActionRequest in project coprhd-controller by CoprHD.
the class VNXeApiClient method exportFileSystem.
/**
* NFS export
*
* @param fsId
* file system KH id
* @param endpoints
* list of host ipaddresses export to
* @param access
* access right
* @return VNXeCommandJob
* @throws VNXeException
*/
public VNXeCommandJob exportFileSystem(String fsId, List<String> roEndpoints, List<String> rwEndpoints, List<String> rootEndpoints, AccessEnum access, String path, String shareName, String shareId, String comments) throws VNXeException {
_logger.info("Exporting file system:" + fsId);
FileSystemRequest fsRequest = new FileSystemRequest(_khClient, fsId);
VNXeFileSystem fs = fsRequest.get();
if (fs == null) {
_logger.info("Could not find file system in the vxne");
throw VNXeException.exceptions.vnxeCommandFailed("Could not find file system in the vnxe for: " + fsId);
}
String resourceId = fs.getStorageResource().getId();
ModifyFileSystemParam modifyFSParm = new ModifyFileSystemParam();
List<VNXeBase> roHosts = getHosts(roEndpoints);
List<VNXeBase> rwHosts = getHosts(rwEndpoints);
List<VNXeBase> rootHosts = getHosts(rootEndpoints);
VNXeNfsShare nfsShareFound = null;
if (shareName != null) {
nfsShareFound = findNfsShare(fsId, shareName);
} else {
nfsShareFound = getNfsShareById(shareId);
}
String nfsShareId = null;
List<VNXeBase> hosts = new ArrayList<VNXeBase>();
if (nfsShareFound != null) {
nfsShareId = nfsShareFound.getId();
}
NfsShareParam shareParm = new NfsShareParam();
shareParm.setReadOnlyHosts(roHosts);
shareParm.setReadWriteHosts(rwHosts);
shareParm.setRootAccessHosts(rootHosts);
if (comments != null) {
shareParm.setDescription(comments);
}
if (access == null) {
if (nfsShareFound != null) {
hosts.addAll(nfsShareFound.getNoAccessHosts());
hosts.addAll(nfsShareFound.getRootAccessHosts());
hosts.addAll(nfsShareFound.getReadWriteHosts());
hosts.addAll(nfsShareFound.getReadOnlyHosts());
}
NFSShareDefaultAccessEnum nfsShareDefaultAccess = NFSShareDefaultAccessEnum.NONE;
if (nfsShareFound != null) {
nfsShareDefaultAccess = nfsShareFound.getDefaultAccess();
}
if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.ROOT)) {
if (!hosts.isEmpty()) {
shareParm.setRootAccessHosts(hosts);
} else {
shareParm.setRootAccessHosts(null);
}
shareParm.setNoAccessHosts(null);
shareParm.setReadWriteHosts(null);
shareParm.setReadOnlyHosts(null);
} else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.READONLY)) {
if (!hosts.isEmpty()) {
shareParm.setReadOnlyHosts(hosts);
} else {
shareParm.setReadOnlyHosts(null);
}
shareParm.setNoAccessHosts(null);
shareParm.setReadWriteHosts(null);
shareParm.setRootAccessHosts(null);
} else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.READWRITE)) {
if (!hosts.isEmpty()) {
shareParm.setReadWriteHosts(hosts);
} else {
shareParm.setReadWriteHosts(null);
}
shareParm.setNoAccessHosts(null);
shareParm.setReadOnlyHosts(null);
shareParm.setRootAccessHosts(null);
} else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.NONE)) {
if (!hosts.isEmpty()) {
shareParm.setNoAccessHosts(hosts);
} else {
shareParm.setNoAccessHosts(null);
}
shareParm.setReadWriteHosts(null);
shareParm.setReadOnlyHosts(null);
shareParm.setRootAccessHosts(null);
}
}
if (nfsShareId == null) {
// not found, new export
if (!isUnityClient()) {
shareParm.setDefaultAccess(NFSShareDefaultAccessEnum.NONE);
}
NfsShareCreateParam nfsShareCreateParm = new NfsShareCreateParam();
nfsShareCreateParm.setName(shareName);
nfsShareCreateParm.setPath(path);
nfsShareCreateParm.setNfsShareParameters(shareParm);
List<NfsShareCreateParam> nfsList = new ArrayList<NfsShareCreateParam>();
nfsList.add(nfsShareCreateParm);
modifyFSParm.setNfsShareCreate(nfsList);
} else {
// update export
NfsShareModifyParam nfsShareModifyParam = new NfsShareModifyParam();
VNXeBase nfsShare = new VNXeBase();
nfsShare.setId(nfsShareId);
nfsShareModifyParam.setNfsShare(nfsShare);
nfsShareModifyParam.setNfsShareParameters(shareParm);
List<NfsShareModifyParam> nfsModifyList = new ArrayList<NfsShareModifyParam>();
nfsModifyList.add(nfsShareModifyParam);
modifyFSParm.setNfsShareModify(nfsModifyList);
}
FileSystemActionRequest req = new FileSystemActionRequest(_khClient);
return req.modifyFileSystemAsync(modifyFSParm, resourceId);
}
use of com.emc.storageos.vnxe.requests.FileSystemActionRequest in project coprhd-controller by CoprHD.
the class VNXeApiClient method expandFileSystem.
/**
* expand file system
*
* @param fsId
* fileSystem Id
* @param newSize
* new capacity
* @return VNXeCommandJob
*/
public VNXeCommandJob expandFileSystem(String fsId, long newSize) {
VNXeCommandJob job = null;
_logger.info("expanding file system:" + fsId);
FileSystemRequest fsRequest = new FileSystemRequest(_khClient, fsId);
VNXeFileSystem fs = fsRequest.get();
if (fs == null) {
_logger.info("Could not find file system in the vxne");
throw VNXeException.exceptions.vnxeCommandFailed("Could not find file system in the vnxe for: " + fsId);
}
String resourceId = fs.getStorageResource().getId();
ModifyFileSystemParam modifyFSParm = new ModifyFileSystemParam();
// set fileSystemParam
FileSystemParam fsParm = new FileSystemParam();
fsParm.setSize(newSize);
fsParm.setIsThinEnabled(fs.getIsThinEnabled());
fsParm.setSupportedProtocols(fs.getSupportedProtocols());
fsParm.setSizeAllocated(fs.getSizeAllocated());
modifyFSParm.setFsParameters(fsParm);
FileSystemActionRequest req = new FileSystemActionRequest(_khClient);
job = req.modifyFileSystemAsync(modifyFSParm, resourceId);
return job;
}
use of com.emc.storageos.vnxe.requests.FileSystemActionRequest in project coprhd-controller by CoprHD.
the class VNXeApiClient method createCIFSShare.
/**
* create cifsShare
*/
public VNXeCommandJob createCIFSShare(String fsId, String cifsName, String permission, String path) throws VNXeException {
_logger.info("creating CIFS share:" + fsId);
FileSystemRequest fsRequest = new FileSystemRequest(_khClient, fsId);
VNXeFileSystem fs = fsRequest.get();
if (fs == null) {
_logger.info("Could not find file system in the vxne");
throw VNXeException.exceptions.vnxeCommandFailed("Could not find file system in the vnxe for: " + fsId);
}
String resourceId = fs.getStorageResource().getId();
ModifyFileSystemParam modifyFSParm = new ModifyFileSystemParam();
CifsShareParam cifsParam = new CifsShareParam();
/*
* CifsShareACE ace = new CifsShareACE();
* ace.setAccessLevel(4);
* ace.setAccessType(1);
* ace.setSid("S-1-5-21-3623811015-3361044348-30300820-1014");
* List<CifsShareACE> aceList = new ArrayList<CifsShareACE>();
* aceList.add(ace);
* cifsParam.setAddACE(aceList);
*/
cifsParam.setIsACEEnabled(false);
if (permission != null && !permission.isEmpty() && permission.equalsIgnoreCase(AccessEnum.READ.name())) {
cifsParam.setIsReadOnly(true);
} else {
cifsParam.setIsReadOnly(false);
}
CifsShareCreateParam cifsCreate = new CifsShareCreateParam();
cifsCreate.setName(cifsName);
cifsCreate.setPath(path);
_logger.info("Creating VNXe CIFS share by name: {} for path: {}", cifsName, path);
List<VNXeCifsServer> cifsServers = getCifsServers(fs.getNasServer().getId());
if (cifsServers == null || cifsServers.isEmpty()) {
throw VNXeException.exceptions.vnxeCommandFailed("The nasServer is not configured to support CIFS");
}
VNXeBase cifsServer = new VNXeBase();
cifsServer.setId(cifsServers.get(0).getId());
cifsCreate.setCifsServer(cifsServer);
cifsCreate.setCifsShareParameters(cifsParam);
netBios = cifsServers.get(0).getNetbiosName();
List<CifsShareCreateParam> cifsCreateList = new ArrayList<CifsShareCreateParam>();
cifsCreateList.add(cifsCreate);
modifyFSParm.setCifsShareCreate(cifsCreateList);
FileSystemActionRequest req = new FileSystemActionRequest(_khClient);
return req.modifyFileSystemAsync(modifyFSParm, resourceId);
}
use of com.emc.storageos.vnxe.requests.FileSystemActionRequest in project coprhd-controller by CoprHD.
the class VNXeApiClient method removeCifsShare.
/**
* Delete cifsShare
*
* @param cifsShareId
* cifsShare Id
* @param fsId
* file system Id
* @return VNXeCommandJob
*/
public VNXeCommandJob removeCifsShare(String cifsShareId, String fsId) {
VNXeCommandJob job = null;
_logger.info("deleting cifs share" + cifsShareId);
FileSystemRequest fsRequest = new FileSystemRequest(_khClient, fsId);
VNXeFileSystem fs = fsRequest.get();
if (fs == null) {
_logger.info("Could not find file system in the vxne");
throw VNXeException.exceptions.vnxeCommandFailed("Could not find file system in the vnxe for: " + fsId);
}
String resourceId = fs.getStorageResource().getId();
ModifyFileSystemParam modifyFSParm = new ModifyFileSystemParam();
// set cifsShare delete parm
CifsShareDeleteParam deleteParam = new CifsShareDeleteParam();
VNXeBase share = new VNXeBase();
share.setId(cifsShareId);
deleteParam.setCifsShare(share);
List<CifsShareDeleteParam> deleteList = new ArrayList<CifsShareDeleteParam>();
deleteList.add(deleteParam);
modifyFSParm.setCifsShareDelete(deleteList);
FileSystemActionRequest req = new FileSystemActionRequest(_khClient);
job = req.modifyFileSystemAsync(modifyFSParm, resourceId);
return job;
}
Aggregations