use of com.emc.storageos.vnxe.requests.FileSystemSnapRequests in project coprhd-controller by CoprHD.
the class VNXeApiClient method createFileSystemSnap.
/**
* Create file system snapshot
*
* @param fsId
* file system id
* @param name
* snapshot name
* @return VNXeCommandJob
*/
public VNXeCommandJob createFileSystemSnap(String fsId, String name) {
_logger.info("creating file system snap:" + fsId);
String resourceId = getStorageResourceId(fsId);
FileSystemSnapCreateParam parm = new FileSystemSnapCreateParam();
VNXeBase resource = new VNXeBase();
resource.setId(resourceId);
parm.setStorageResource(resource);
parm.setName(name);
parm.setIsReadOnly(false);
parm.setIsAutoDelete(false);
FileSystemSnapRequests req = new FileSystemSnapRequests(_khClient, getBasicSystemInfo().getSoftwareVersion());
return req.createFileSystemSnap(parm);
}
use of com.emc.storageos.vnxe.requests.FileSystemSnapRequests in project coprhd-controller by CoprHD.
the class VNXeApiClient method deleteFileSystemSnap.
/**
* Delete file system snapshot
*
* @param snapId
* snapshot VNXe Id
* @return VNXeCommandJob
*/
public VNXeCommandJob deleteFileSystemSnap(String snapId) {
_logger.info("deleting file system snap:" + snapId);
String softwareVersion = getBasicSystemInfo().getSoftwareVersion();
FileSystemSnapRequests req = new FileSystemSnapRequests(_khClient, softwareVersion);
return req.deleteFileSystemSnap(snapId, softwareVersion);
}
use of com.emc.storageos.vnxe.requests.FileSystemSnapRequests in project coprhd-controller by CoprHD.
the class VNXeApiClient method createNfsShareForSnap.
/**
* Create Nfs share for snapshot
*
* @param snapId
* snapshot id
* @param endpoints
* hosts
* @param access
* READ, WRITE, ROOT
* @param path
* @param exportKey
* @return VNXeCommandJob
* @throws VNXeException
*/
public VNXeCommandJob createNfsShareForSnap(String snapId, List<String> roEndpoints, List<String> rwEndpoints, List<String> rootEndpoints, AccessEnum access, String path, String shareName, String comments) throws VNXeException {
_logger.info("creating nfs share for the snap: " + snapId);
NfsShareRequests request = new NfsShareRequests(_khClient);
String softwareVersion = getBasicSystemInfo().getSoftwareVersion();
FileSystemSnapRequests req = new FileSystemSnapRequests(_khClient, softwareVersion);
VNXeFileSystemSnap snapshot = req.getFileSystemSnap(snapId, softwareVersion);
if (snapshot == null) {
_logger.info("Could not find snapshot in the vxne");
throw VNXeException.exceptions.vnxeCommandFailed("Could not find snapshot in the vnxe for: " + snapId);
}
NfsShareCreateForSnapParam nfsCreateParam = new NfsShareCreateForSnapParam();
VNXeBase snap = new VNXeBase(snapId);
if (!VNXeUtils.isHigherVersion(softwareVersion, VNXeConstants.VNXE_BASE_SOFT_VER)) {
nfsCreateParam.setFilesystemSnap(snap);
} else {
nfsCreateParam.setSnap(snap);
}
List<VNXeBase> roHosts = getHosts(roEndpoints);
List<VNXeBase> rwHosts = getHosts(rwEndpoints);
List<VNXeBase> rootHosts = getHosts(rootEndpoints);
VNXeCommandJob job = null;
VNXeNfsShare nfsShareFound = request.findSnapNfsShare(snapId, shareName, softwareVersion);
if (nfsShareFound == null) {
// new export
nfsCreateParam.setReadOnlyHosts(roHosts);
nfsCreateParam.setReadWriteHosts(rwHosts);
nfsCreateParam.setRootAccessHosts(rootHosts);
nfsCreateParam.setName(shareName);
nfsCreateParam.setPath(path);
if (comments != null) {
nfsCreateParam.setDescription(comments);
}
request.unsetQueryParameters();
job = request.createShareForSnapshot(nfsCreateParam);
} else {
String nfsShareId = nfsShareFound.getId();
NFSShareDefaultAccessEnum nfsShareDefaultAccess = nfsShareFound.getDefaultAccess();
NfsShareModifyForShareParam nfsModifyParam = new NfsShareModifyForShareParam();
List<VNXeBase> hosts = new ArrayList<VNXeBase>();
nfsModifyParam.setReadOnlyHosts(roHosts);
nfsModifyParam.setReadWriteHosts(rwHosts);
nfsModifyParam.setRootAccessHosts(rootHosts);
if (comments != null) {
nfsModifyParam.setDescription(comments);
}
if (access == null) {
if (nfsShareFound != null) {
hosts.addAll(nfsShareFound.getNoAccessHosts());
hosts.addAll(nfsShareFound.getRootAccessHosts());
hosts.addAll(nfsShareFound.getReadWriteHosts());
hosts.addAll(nfsShareFound.getReadOnlyHosts());
}
if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.ROOT)) {
if (!hosts.isEmpty()) {
nfsModifyParam.setRootAccessHosts(hosts);
} else {
nfsModifyParam.setRootAccessHosts(null);
}
nfsModifyParam.setNoAccessHosts(null);
nfsModifyParam.setReadWriteHosts(null);
nfsModifyParam.setReadOnlyHosts(null);
} else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.READONLY)) {
if (!hosts.isEmpty()) {
nfsModifyParam.setReadOnlyHosts(hosts);
} else {
nfsModifyParam.setReadOnlyHosts(null);
}
nfsModifyParam.setNoAccessHosts(null);
nfsModifyParam.setReadWriteHosts(null);
nfsModifyParam.setRootAccessHosts(null);
} else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.READWRITE)) {
if (!hosts.isEmpty()) {
nfsModifyParam.setReadWriteHosts(hosts);
} else {
nfsModifyParam.setReadWriteHosts(null);
}
nfsModifyParam.setNoAccessHosts(null);
nfsModifyParam.setReadOnlyHosts(null);
nfsModifyParam.setRootAccessHosts(null);
} else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.NONE)) {
if (!hosts.isEmpty()) {
nfsModifyParam.setNoAccessHosts(hosts);
} else {
nfsModifyParam.setNoAccessHosts(null);
}
nfsModifyParam.setReadWriteHosts(null);
nfsModifyParam.setReadOnlyHosts(null);
nfsModifyParam.setRootAccessHosts(null);
}
}
request.unsetQueryParameters();
job = request.modifyShareForSnapshot(nfsShareId, nfsModifyParam);
}
return job;
}
use of com.emc.storageos.vnxe.requests.FileSystemSnapRequests in project coprhd-controller by CoprHD.
the class VNXeApiClient method restoreFileSystemSnap.
/**
* restore file system snapshot
*
* @param snapId
* VNXe snapshot id
* @return VNXeCommandJob
*/
public VNXeCommandJob restoreFileSystemSnap(String snapId) {
_logger.info("restoring file system snap:" + snapId);
String softwareVersion = getBasicSystemInfo().getSoftwareVersion();
FileSystemSnapRequests req = new FileSystemSnapRequests(_khClient, softwareVersion);
return req.restoreFileSystemSnap(snapId, null, softwareVersion);
}
use of com.emc.storageos.vnxe.requests.FileSystemSnapRequests in project coprhd-controller by CoprHD.
the class VNXeApiClient method deleteFileSystemSnapSync.
/**
* delete file system snapshot sync
*
* @param snapId
* snapshot VNXe Id
* @return VNXeCommandResult
*/
public VNXeCommandResult deleteFileSystemSnapSync(String snapId) throws VNXeException {
_logger.info("deleting file system snap: " + snapId);
String softwareVersion = getBasicSystemInfo().getSoftwareVersion();
FileSystemSnapRequests req = new FileSystemSnapRequests(_khClient, softwareVersion);
return req.deleteFileSystemSnapSync(snapId, softwareVersion);
}
Aggregations