use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBFileShare in project coprhd-controller by CoprHD.
the class VNXUnityUnManagedObjectDiscoverer method associateCifsExportWithUMFS.
private void associateCifsExportWithUMFS(UnManagedFileSystem vnxufs, String mountPoint, VNXeCifsShare exp, StoragePort storagePort) {
try {
// Assign storage port to unmanaged FS
if (storagePort != null) {
StringSet storagePorts = new StringSet();
storagePorts.add(storagePort.getId().toString());
vnxufs.getFileSystemInformation().remove(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_PORT.toString());
vnxufs.getFileSystemInformation().put(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_PORT.toString(), storagePorts);
}
String shareName = exp.getName();
UnManagedSMBFileShare unManagedSMBFileShare = new UnManagedSMBFileShare();
unManagedSMBFileShare.setName(shareName);
unManagedSMBFileShare.setNativeId(exp.getId());
unManagedSMBFileShare.setMountPoint(mountPoint);
unManagedSMBFileShare.setMaxUsers(Integer.parseInt(CIFS_MAX_USERS));
unManagedSMBFileShare.setPortGroup(storagePort.getPortGroup());
// setting to default permission type for VNXe
unManagedSMBFileShare.setPermissionType(FileControllerConstants.CIFS_SHARE_PERMISSION_TYPE_ALLOW);
unManagedSMBFileShare.setPermission(ShareACL.SupportedPermissions.change.toString());
unManagedSMBFileShare.setPath(exp.getPath());
UnManagedSMBShareMap currUnManagedExportMap = vnxufs.getUnManagedSmbShareMap();
if (currUnManagedExportMap == null) {
currUnManagedExportMap = new UnManagedSMBShareMap();
vnxufs.setUnManagedSmbShareMap(currUnManagedExportMap);
}
if (currUnManagedExportMap.get(shareName) == null) {
currUnManagedExportMap.put(shareName, unManagedSMBFileShare);
log.debug("associateCifsExportWithFS - no SMBs already exists for share {}", shareName);
} else {
// Remove the existing and add the new share
currUnManagedExportMap.remove(shareName);
currUnManagedExportMap.put(shareName, unManagedSMBFileShare);
log.warn("associateExportMapWithFS - Identical export already exists for mount path {} Overwrite", shareName);
}
} catch (Exception ex) {
log.warn("VNXe file share retrieve processor failed for path {}, cause {}", exp.getName(), ex);
}
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBFileShare in project coprhd-controller by CoprHD.
the class VNXeUnManagedObjectDiscoverer method associateCifsExportWithUMFS.
private void associateCifsExportWithUMFS(UnManagedFileSystem vnxufs, String mountPoint, VNXeCifsShare exp, StoragePort storagePort) {
try {
// Assign storage port to unmanaged FS
if (storagePort != null) {
StringSet storagePorts = new StringSet();
storagePorts.add(storagePort.getId().toString());
vnxufs.getFileSystemInformation().remove(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_PORT.toString());
vnxufs.getFileSystemInformation().put(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_PORT.toString(), storagePorts);
}
String shareName = exp.getName();
UnManagedSMBFileShare unManagedSMBFileShare = new UnManagedSMBFileShare();
unManagedSMBFileShare.setName(shareName);
unManagedSMBFileShare.setMountPoint(mountPoint);
unManagedSMBFileShare.setMaxUsers(Integer.parseInt(CIFS_MAX_USERS));
unManagedSMBFileShare.setPortGroup(storagePort.getPortGroup());
// setting to default permission type for VNXe
unManagedSMBFileShare.setPermissionType(FileControllerConstants.CIFS_SHARE_PERMISSION_TYPE_ALLOW);
unManagedSMBFileShare.setPermission(ShareACL.SupportedPermissions.change.toString());
unManagedSMBFileShare.setPath(exp.getPath());
UnManagedSMBShareMap currUnManagedExportMap = vnxufs.getUnManagedSmbShareMap();
if (currUnManagedExportMap == null) {
currUnManagedExportMap = new UnManagedSMBShareMap();
vnxufs.setUnManagedSmbShareMap(currUnManagedExportMap);
}
if (currUnManagedExportMap.get(shareName) == null) {
currUnManagedExportMap.put(shareName, unManagedSMBFileShare);
log.debug("associateCifsExportWithFS - no SMBs already exists for share {}", shareName);
} else {
// Remove the existing and add the new share
currUnManagedExportMap.remove(shareName);
currUnManagedExportMap.put(shareName, unManagedSMBFileShare);
log.warn("associateExportMapWithFS - Identical export already exists for mount path {} Overwrite", shareName);
}
} catch (Exception ex) {
log.warn("VNXe file share retrieve processor failed for path {}, cause {}", exp.getName(), ex);
}
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBFileShare in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method associateCifsExportWithFS.
private void associateCifsExportWithFS(UnManagedFileSystem vnxufs, String exportPath, Map<String, String> fsExportInfo, StoragePort storagePort) {
try {
// Assign storage port to unmanaged FS
if (storagePort != null) {
StringSet storagePorts = new StringSet();
storagePorts.add(storagePort.getId().toString());
vnxufs.getFileSystemInformation().remove(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_PORT.toString());
vnxufs.getFileSystemInformation().put(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_PORT.toString(), storagePorts);
}
String shareName = fsExportInfo.get(VNXFileConstants.SHARE_NAME);
String mountPoint = getMountPount(shareName, storagePort);
UnManagedSMBFileShare unManagedSMBFileShare = new UnManagedSMBFileShare();
unManagedSMBFileShare.setName(shareName);
unManagedSMBFileShare.setMountPoint(mountPoint);
unManagedSMBFileShare.setPath(exportPath);
// setting to default permission type for VNX
unManagedSMBFileShare.setPermissionType(FileControllerConstants.CIFS_SHARE_PERMISSION_TYPE_ALLOW);
unManagedSMBFileShare.setDescription(fsExportInfo.get(VNXFileConstants.SHARE_COMMENT));
int maxUsers = Integer.MAX_VALUE;
if (Long.parseLong(fsExportInfo.get(VNXFileConstants.SHARE_MAXUSR)) < Integer.MAX_VALUE) {
maxUsers = Integer.parseInt(fsExportInfo.get(VNXFileConstants.SHARE_MAXUSR));
}
unManagedSMBFileShare.setMaxUsers(maxUsers);
unManagedSMBFileShare.setPortGroup(storagePort.getPortGroup());
unManagedSMBFileShare.setPermission(ShareACL.SupportedPermissions.change.toString());
UnManagedSMBShareMap currUnManagedShareMap = vnxufs.getUnManagedSmbShareMap();
if (currUnManagedShareMap == null) {
currUnManagedShareMap = new UnManagedSMBShareMap();
vnxufs.setUnManagedSmbShareMap(currUnManagedShareMap);
}
if (currUnManagedShareMap.get(shareName) == null) {
currUnManagedShareMap.put(shareName, unManagedSMBFileShare);
_logger.info("associateCifsExportWithFS - no SMBs already exists for share {}", shareName);
} else {
// Remove the existing and add the new share
currUnManagedShareMap.remove(shareName);
currUnManagedShareMap.put(shareName, unManagedSMBFileShare);
_logger.warn("associateSMBShareMapWithFS - Identical export already exists for mount path {} Overwrite", shareName);
}
} catch (Exception ex) {
_logger.warn("VNX file share retrieve processor failed for path {}, cause {}", exportPath, ex);
}
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBFileShare in project coprhd-controller by CoprHD.
the class IsilonCommunicationInterface method setUnmanagedCifsShareACL.
/**
* get UnManaged Cifs Shares and their ACLs
*
* @param unManagedFileSystem
* @param smbShares
* @param unManagedCifsShareACLList
* @param fsPath
* @param isilonApi
*/
private void setUnmanagedCifsShareACL(UnManagedFileSystem unManagedFileSystem, HashSet<String> smbShares, List<UnManagedCifsShareACL> unManagedCifsShareACLList, StoragePort storagePort, String fsname, String zoneName, StorageSystem storageSystem, IsilonApi isilonApi, List<UnManagedCifsShareACL> oldUnManagedCifsShareACLList) {
_log.debug("Set CIFS shares and their respective ACL of UMFS: {} from Isilon SMB share details - start", fsname);
if (null != smbShares && !smbShares.isEmpty()) {
UnManagedSMBShareMap unManagedSmbShareMap = null;
if (null == unManagedFileSystem.getUnManagedSmbShareMap()) {
unManagedSmbShareMap = new UnManagedSMBShareMap();
unManagedFileSystem.setUnManagedSmbShareMap(unManagedSmbShareMap);
}
unManagedSmbShareMap = unManagedFileSystem.getUnManagedSmbShareMap();
UnManagedSMBFileShare unManagedSMBFileShare = null;
for (String shareId : smbShares) {
// get smb share details
IsilonSMBShare isilonSMBShare = getIsilonSMBShare(isilonApi, shareId, zoneName);
if (null != isilonSMBShare) {
unManagedSMBFileShare = new UnManagedSMBFileShare();
unManagedSMBFileShare.setName(isilonSMBShare.getName());
unManagedSMBFileShare.setDescription(isilonSMBShare.getDescription());
unManagedSMBFileShare.setNativeId(shareId);
unManagedSMBFileShare.setMountPoint("\\\\" + storagePort.getPortNetworkId() + "\\" + isilonSMBShare.getName());
unManagedSMBFileShare.setPath(isilonSMBShare.getPath());
unManagedSMBFileShare.setMaxUsers(-1);
// setting the dummy permission.This is not used by isilon, but used by other storage system
unManagedSMBFileShare.setPermission(FileControllerConstants.CIFS_SHARE_PERMISSION_CHANGE);
unManagedSMBFileShare.setPermissionType(FileControllerConstants.CIFS_SHARE_PERMISSION_TYPE_ALLOW);
// set Unmanaged SMB Share
unManagedSmbShareMap.put(isilonSMBShare.getName(), unManagedSMBFileShare);
_log.info("SMB share id {} ", shareId);
_log.info("SMB share name {} and fs mount point {} ", unManagedSMBFileShare.getName(), unManagedSMBFileShare.getMountPoint());
// process ACL permission
UnManagedCifsShareACL unManagedCifsShareACL = null;
int aclSize = 0;
List<IsilonSMBShare.Permission> permissionList = isilonSMBShare.getPermissions();
for (IsilonSMBShare.Permission permission : permissionList) {
if (FileControllerConstants.CIFS_SHARE_PERMISSION_TYPE_ALLOW.equalsIgnoreCase(permission.getPermissionType())) {
aclSize++;
_log.debug("IsilonSMBShare: [{}] permission details: {}", isilonSMBShare.getName(), permission.toString());
unManagedCifsShareACL = new UnManagedCifsShareACL();
// Set share name
unManagedCifsShareACL.setShareName(isilonSMBShare.getName());
// Set permission
unManagedCifsShareACL.setPermission(permission.getPermission());
// We take only username and we can ignore type and id
// Set user
unManagedCifsShareACL.setUser(permission.getTrustee().getName());
// Set filesystem id
unManagedCifsShareACL.setFileSystemId(unManagedFileSystem.getId());
unManagedCifsShareACL.setId(URIUtil.createId(UnManagedCifsShareACL.class));
String fsShareNativeId = unManagedCifsShareACL.getFileSystemShareACLIndex();
_log.info("UMFS Share ACL index {}", fsShareNativeId);
String fsUnManagedFileShareNativeGuid = NativeGUIDGenerator.generateNativeGuidForPreExistingFileShare(storageSystem, fsShareNativeId);
_log.info("Native GUID {}", fsUnManagedFileShareNativeGuid);
// set native guid, so each entry unique
unManagedCifsShareACL.setNativeGuid(fsUnManagedFileShareNativeGuid);
// Check whether the CIFS share ACL was present in ViPR DB.
UnManagedCifsShareACL existingCifsShareACL = checkUnManagedFsCifsACLExistsInDB(_dbClient, unManagedCifsShareACL.getNativeGuid());
if (existingCifsShareACL != null) {
// delete the existing acl
existingCifsShareACL.setInactive(true);
oldUnManagedCifsShareACLList.add(existingCifsShareACL);
}
unManagedCifsShareACLList.add(unManagedCifsShareACL);
}
}
_log.debug("ACL size of share: [{}] is {}", isilonSMBShare.getName(), aclSize);
}
}
if (!unManagedSmbShareMap.isEmpty()) {
unManagedFileSystem.setHasShares(true);
}
}
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBFileShare in project coprhd-controller by CoprHD.
the class NetAppClusterModeCommIntf method getAllCifsShares.
/**
* get All Cifs shares in NetApp Cluster-mode Device
*
* @param listShares
* @return
*/
private HashMap<String, HashSet<UnManagedSMBFileShare>> getAllCifsShares(List<Map<String, String>> listShares) {
// Discover All FileSystem
HashMap<String, HashSet<UnManagedSMBFileShare>> sharesHashMap = new HashMap<String, HashSet<UnManagedSMBFileShare>>();
UnManagedSMBFileShare unManagedSMBFileShare = null;
HashSet<UnManagedSMBFileShare> unManagedSMBFileShareHashSet = null;
// prepare smb shares map elem for each fs path
for (Map<String, String> shareMap : listShares) {
String shareName = "";
String mountPath = "";
String description = "";
String maxUsers = "-1";
for (String key : shareMap.keySet()) {
Object value = shareMap.get(key);
_logger.info("cifs share - key : {} and value : {}", key, value);
if (null != key && value != null) {
switch(key) {
case "share-name":
shareName = (String) value;
break;
case "path":
mountPath = (String) value;
break;
case "comment":
description = (String) value;
break;
case "maxusers":
maxUsers = (String) value;
break;
default:
break;
}
}
}
_logger.info("cifs share details- share-name:{} mount-point: {} ", shareName, mountPath);
unManagedSMBFileShare = new UnManagedSMBFileShare();
unManagedSMBFileShare.setName(shareName);
unManagedSMBFileShare.setMountPoint(mountPath);
unManagedSMBFileShare.setDescription(description);
unManagedSMBFileShare.setMaxUsers(Integer.parseInt(maxUsers));
unManagedSMBFileShareHashSet = sharesHashMap.get(mountPath);
if (null == unManagedSMBFileShareHashSet) {
unManagedSMBFileShareHashSet = new HashSet<UnManagedSMBFileShare>();
}
unManagedSMBFileShareHashSet.add(unManagedSMBFileShare);
sharesHashMap.put(mountPath, unManagedSMBFileShareHashSet);
}
return sharesHashMap;
}
Aggregations