use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method associateExportMapWithFS.
private void associateExportMapWithFS(UnManagedFileSystem vnxufs, UnManagedFSExport unManagedfileExport) {
// TODO: create - separate
UnManagedFSExportMap currUnManagedExportMap = vnxufs.getFsUnManagedExportMap();
if (currUnManagedExportMap == null) {
currUnManagedExportMap = new UnManagedFSExportMap();
vnxufs.setFsUnManagedExportMap(currUnManagedExportMap);
}
String exportKey = unManagedfileExport.getFileExportKey();
if (currUnManagedExportMap.get(exportKey) == null) {
currUnManagedExportMap.put(exportKey, unManagedfileExport);
_logger.debug("associateExportMapWithFS {} no export already exists for mount path {}", exportKey, unManagedfileExport.getMountPath());
} else {
currUnManagedExportMap.put(exportKey, unManagedfileExport);
_logger.warn("associateExportMapWithFS {} Identical export already exists for mount path {} Overwrite", exportKey, unManagedfileExport.getMountPath());
}
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap in project coprhd-controller by CoprHD.
the class IsilonCommunicationInterface method createUnManagedFileSystem.
/**
* create StorageFileSystem Info Object
*
* @param unManagedFileSystem
* @param unManagedFileSystemNativeGuid
* @param storageSystem
* @param fileSystem
* @return UnManagedFileSystem
* @throws IOException
* @throws IsilonCollectionException
*/
private UnManagedFileSystem createUnManagedFileSystem(UnManagedFileSystem unManagedFileSystem, String unManagedFileSystemNativeGuid, StorageSystem storageSystem, StoragePool pool, NASServer nasServer, FileShare fileSystem) throws IOException, IsilonCollectionException {
if (null == unManagedFileSystem) {
unManagedFileSystem = new UnManagedFileSystem();
unManagedFileSystem.setId(URIUtil.createId(UnManagedFileSystem.class));
unManagedFileSystem.setNativeGuid(unManagedFileSystemNativeGuid);
unManagedFileSystem.setStorageSystemUri(storageSystem.getId());
if (null != pool) {
unManagedFileSystem.setStoragePoolUri(pool.getId());
}
unManagedFileSystem.setHasExports(false);
unManagedFileSystem.setHasShares(false);
unManagedFileSystem.setHasNFSAcl(false);
}
if (null == unManagedFileSystem.getExtensions()) {
unManagedFileSystem.setExtensions(new StringMap());
}
Map<String, StringSet> unManagedFileSystemInformation = new HashMap<String, StringSet>();
StringMap unManagedFileSystemCharacteristics = new StringMap();
unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_SNAP_SHOT.toString(), FALSE);
unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_THINLY_PROVISIONED.toString(), TRUE);
unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_FILESYSTEM_EXPORTED.toString(), FALSE);
if (null != pool) {
StringSet pools = new StringSet();
pools.add(pool.getId().toString());
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_POOL.toString(), pools);
StringSet matchedVPools = DiscoveryUtils.getMatchedVirtualPoolsForPool(_dbClient, pool.getId(), unManagedFileSystemCharacteristics.get(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_THINLY_PROVISIONED.toString()));
_log.debug("Matched Pools : {}", Joiner.on("\t").join(matchedVPools));
if (null == matchedVPools || matchedVPools.isEmpty()) {
// clear all existing supported vpools.
unManagedFileSystem.getSupportedVpoolUris().clear();
} else {
// replace with new StringSet
unManagedFileSystem.getSupportedVpoolUris().replace(matchedVPools);
_log.info("Replaced Pools :" + Joiner.on("\t").join(unManagedFileSystem.getSupportedVpoolUris()));
}
}
if (null != nasServer) {
StringSet storagePorts = new StringSet();
if (nasServer.getStoragePorts() != null && !nasServer.getStoragePorts().isEmpty()) {
storagePorts.addAll(nasServer.getStoragePorts());
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_PORT.toString(), storagePorts);
_log.info("StoragePorts :" + Joiner.on("\t").join(storagePorts));
}
StringSet nasServerSet = new StringSet();
nasServerSet.add(nasServer.getId().toString());
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NAS.toString(), nasServerSet);
_log.debug("nasServer uri id {}", nasServer.getId().toString());
}
unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_INGESTABLE.toString(), TRUE);
if (null != storageSystem) {
StringSet systemTypes = new StringSet();
systemTypes.add(storageSystem.getSystemType());
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.SYSTEM_TYPE.toString(), systemTypes);
}
// Set attributes of FileSystem
StringSet fsPath = new StringSet();
fsPath.add(fileSystem.getNativeId());
StringSet fsMountPath = new StringSet();
fsMountPath.add(fileSystem.getMountPath());
StringSet fsName = new StringSet();
fsName.add(fileSystem.getName());
StringSet fsId = new StringSet();
fsId.add(fileSystem.getNativeId());
StringSet softLimit = new StringSet();
softLimit.add(fileSystem.getSoftLimit().toString());
StringSet softGrace = new StringSet();
softGrace.add(fileSystem.getSoftGracePeriod().toString());
StringSet notificationLimit = new StringSet();
notificationLimit.add(fileSystem.getNotificationLimit().toString());
unManagedFileSystem.setLabel(fileSystem.getName());
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NAME.toString(), fsName);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NATIVE_ID.toString(), fsId);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.DEVICE_LABEL.toString(), fsName);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.PATH.toString(), fsPath);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.MOUNT_PATH.toString(), fsMountPath);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.SOFT_LIMIT.toString(), softLimit);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.SOFT_GRACE.toString(), softGrace);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NOTIFICATION_LIMIT.toString(), notificationLimit);
StringSet provisionedCapacity = new StringSet();
long capacity = 0;
if (fileSystem.getCapacity() != null) {
capacity = fileSystem.getCapacity();
}
provisionedCapacity.add(String.valueOf(capacity));
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.PROVISIONED_CAPACITY.toString(), provisionedCapacity);
StringSet allocatedCapacity = new StringSet();
long usedCapacity = 0;
if (fileSystem.getUsedCapacity() != null) {
usedCapacity = fileSystem.getUsedCapacity();
}
allocatedCapacity.add(String.valueOf(usedCapacity));
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.ALLOCATED_CAPACITY.toString(), allocatedCapacity);
String quotaId = fileSystem.getExtensions().get(QUOTA);
if (quotaId != null) {
unManagedFileSystem.getExtensions().put(QUOTA, quotaId);
}
_log.debug("Quota : {} : {}", quotaId, fileSystem.getPath());
// Add fileSystemInformation and Characteristics.
unManagedFileSystem.addFileSystemInformation(unManagedFileSystemInformation);
unManagedFileSystem.addFileSystemCharacterstcis(unManagedFileSystemCharacteristics);
// Initialize ExportMap
unManagedFileSystem.setFsUnManagedExportMap(new UnManagedFSExportMap());
// Initialize SMBMap
unManagedFileSystem.setUnManagedSmbShareMap(new UnManagedSMBShareMap());
return unManagedFileSystem;
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap in project coprhd-controller by CoprHD.
the class DataDomainCommunicationInterface method createExportMap.
private void createExportMap(DDExportInfoDetail export, UnManagedFileSystem unManagedFS, List<StoragePort> ports) {
Map<String, List<String>> endPointMap = new HashMap<String, List<String>>();
for (DDExportClient client : export.getClients()) {
List<String> clients = endPointMap.get(client.getOptions());
if (clients == null) {
clients = new ArrayList<String>();
endPointMap.put(client.getOptions(), clients);
}
clients.add(client.getName());
}
UnManagedFSExportMap exportMap = unManagedFS.getFsUnManagedExportMap();
if (exportMap == null) {
exportMap = new UnManagedFSExportMap();
unManagedFS.setFsUnManagedExportMap(exportMap);
}
Set<String> options = endPointMap.keySet();
for (String option : options) {
UnManagedFSExport fExport = new UnManagedFSExport();
fExport.setNativeId(export.getId());
fExport.setMountPath(export.getPath());
fExport.setMountPoint(export.getPath());
fExport.setPath(export.getPath());
fExport.setClients(endPointMap.get(option));
DDOptionInfo optionInfo = DDOptionInfo.parseOptions(option);
fExport.setPermissions(optionInfo.permission);
fExport.setProtocol(NFS);
fExport.setRootUserMapping(optionInfo.rootMapping);
fExport.setSecurityType(optionInfo.security);
// need to find the port which was used to create this export.
// Right now DD API does not contain any info on that.
Collections.shuffle(ports);
fExport.setStoragePort(ports.get(0).getId().toString());
fExport.setStoragePortName(ports.get(0).getPortName());
String exportKey = fExport.getFileExportKey();
exportMap.put(exportKey, fExport);
}
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap in project coprhd-controller by CoprHD.
the class PropertySetterUtil method convertUnManagedExportMapToManaged.
/**
* extract value from a String Set
* This method is used, to get value from a StringSet of size 1.
*
* @param key
* @param volumeInformation
* @return String
*/
public static FSExportMap convertUnManagedExportMapToManaged(UnManagedFSExportMap unManagedFSExportMap, StoragePort storagePort, StorageHADomain dataMover) {
FSExportMap fsExportMap = new FSExportMap();
if (unManagedFSExportMap == null) {
return fsExportMap;
}
for (UnManagedFSExport export : unManagedFSExportMap.values()) {
FileExport fsExport = new FileExport();
if (null != export.getIsilonId()) {
fsExport.setIsilonId(export.getIsilonId());
}
if (null != export.getNativeId()) {
fsExport.setNativeId(export.getNativeId());
}
if (null != storagePort) {
fsExport.setStoragePort(storagePort.getPortName());
if ((export.getMountPath() != null) && (export.getMountPath().length() > 0)) {
fsExport.setMountPoint(ExportUtils.getFileMountPoint(storagePort.getPortNetworkId(), export.getMountPath()));
} else {
fsExport.setMountPoint(ExportUtils.getFileMountPoint(storagePort.getPortNetworkId(), export.getPath()));
}
} else if (null != export.getStoragePort()) {
fsExport.setStoragePort(export.getStoragePort());
if (null != export.getMountPoint()) {
fsExport.setMountPoint(export.getMountPoint());
}
}
if (null != dataMover) {
fsExport.setStoragePortName(dataMover.getName());
} else if (null != storagePort) {
fsExport.setStoragePortName(storagePort.getPortName());
} else if (null != export.getStoragePortName()) {
fsExport.setStoragePortName(export.getStoragePortName());
}
if (null != export.getMountPath()) {
fsExport.setMountPath(export.getMountPath());
}
fsExport.setPath(export.getPath());
fsExport.setPermissions(export.getPermissions());
fsExport.setProtocol(export.getProtocol());
fsExport.setRootUserMapping(export.getRootUserMapping());
fsExport.setSecurityType(export.getSecurityType());
fsExport.setClients(export.getClients());
fsExportMap.put(fsExport.getFileExportKey(), fsExport);
}
return fsExportMap;
}
Aggregations