use of com.emc.storageos.db.client.model.StringMap in project coprhd-controller by CoprHD.
the class IsilonCommunicationInterface method getUnManagedFileQuotaDirectory.
private UnManagedFileQuotaDirectory getUnManagedFileQuotaDirectory(String fsNativeGuid, IsilonSmartQuota quota, StorageSystem storageSystem) {
String qdNativeId = quota.getPath();
_log.debug("Converting IsilonSmartQuota {} for fileSystem {}", quota.getPath(), fsNativeGuid);
int softLimit = 0;
int softGrace = 0;
int notificationLimit = 0;
String nativeGuid = null;
UnManagedFileQuotaDirectory umfsQd = new UnManagedFileQuotaDirectory();
StringMap extensionsMap = new StringMap();
String[] tempDirNames = qdNativeId.split("/");
umfsQd.setParentFSNativeGuid(fsNativeGuid);
umfsQd.setLabel(tempDirNames[tempDirNames.length - 1]);
try {
nativeGuid = NativeGUIDGenerator.generateNativeGuidForUnManagedQuotaDir(storageSystem.getSystemType(), storageSystem.getSerialNumber(), qdNativeId, "");
} catch (IOException e) {
_log.error("Exception while generating NativeGuid for UnManagedQuotaDirectory", e);
}
umfsQd.setNativeGuid(nativeGuid);
umfsQd.setNativeId(qdNativeId);
long capacity = 0;
if (quota.getThresholds() != null && quota.getThresholds().getHard() != null) {
capacity = quota.getThresholds().getHard();
}
umfsQd.setSize(capacity);
if (null != quota.getThresholds().getSoft() && capacity != 0) {
softLimit = new Long(quota.getThresholds().getSoft() * 100 / capacity).intValue();
}
if (null != quota.getThresholds().getSoftGrace() && capacity != 0) {
softGrace = new Long(quota.getThresholds().getSoftGrace() / (24 * 60 * 60)).intValue();
}
if (null != quota.getThresholds().getAdvisory() && capacity != 0) {
notificationLimit = new Long(quota.getThresholds().getAdvisory() * 100 / capacity).intValue();
}
if (null != quota.getId()) {
extensionsMap.put(QUOTA, quota.getId());
}
umfsQd.setSoftLimit(softLimit);
umfsQd.setSoftGrace(softGrace);
umfsQd.setNotificationLimit(notificationLimit);
umfsQd.setExtensions(extensionsMap);
return umfsQd;
}
use of com.emc.storageos.db.client.model.StringMap in project coprhd-controller by CoprHD.
the class DataDomainCommunicationInterface method createUnManagedFileSystem.
private UnManagedFileSystem createUnManagedFileSystem(UnManagedFileSystem unManagedFileSystem, String unManagedFileSystemNativeGuid, DDMTreeInfoDetail mtree, StorageSystem system, StoragePool pool, StringSet vPools) {
if (null == unManagedFileSystem) {
unManagedFileSystem = new UnManagedFileSystem();
unManagedFileSystem.setId(URIUtil.createId(UnManagedFileSystem.class));
unManagedFileSystem.setNativeGuid(unManagedFileSystemNativeGuid);
unManagedFileSystem.setStorageSystemUri(system.getId());
unManagedFileSystem.setFsUnManagedExportMap(new UnManagedFSExportMap());
unManagedFileSystem.setHasExports(false);
unManagedFileSystem.setHasShares(false);
} else {
// existing File System
UnManagedFSExportMap exportMap = unManagedFileSystem.getFsUnManagedExportMap();
if (exportMap != null) {
exportMap.clear();
}
}
Map<String, StringSet> unManagedFileSystemInformation = new HashMap<String, StringSet>();
StringMap unManagedFileSystemCharacteristics = new StringMap();
// TODO: DD does not provide snapshot API yet
// This will be determined at snapshot discovery, once implemented
unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_SNAP_SHOT.toString(), FALSE);
// DD supports only thinly provisioned FS
unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_THINLY_PROVISIONED.toString(), TRUE);
unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_INGESTABLE.toString(), TRUE);
// Don't yet know if the FS is exported, to be determined at export discovery
unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_FILESYSTEM_EXPORTED.toString(), FALSE);
unManagedFileSystem.setHasExports(false);
if (null != pool) {
StringSet pools = new StringSet();
pools.add(pool.getId().toString());
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_POOL.toString(), pools);
unManagedFileSystem.setStoragePoolUri(pool.getId());
}
_log.debug("Matched Pools : {}", Joiner.on("\t").join(vPools));
if (null == vPools || vPools.isEmpty()) {
unManagedFileSystem.getSupportedVpoolUris().clear();
} else {
unManagedFileSystem.getSupportedVpoolUris().replace(vPools);
_log.info("Replaced Pools :" + Joiner.on("\t").join(unManagedFileSystem.getSupportedVpoolUris()));
}
List<StoragePort> ports = getPortFromDB(system);
if (ports != null) {
StringSet storagePorts = new StringSet();
for (StoragePort storagePort : ports) {
String portId = storagePort.getId().toString();
storagePorts.add(portId);
}
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_PORT.toString(), storagePorts);
}
if (null != system) {
StringSet systemTypes = new StringSet();
systemTypes.add(system.getSystemType());
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.SYSTEM_TYPE.toString(), systemTypes);
}
StringSet provisionedCapacity = new StringSet();
if (mtree.quotaConfig != null) {
provisionedCapacity.add(Long.toString(mtree.quotaConfig.getHardLimit()));
} else {
provisionedCapacity.add(Long.toString(mtree.logicalCapacity.getTotal()));
}
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.PROVISIONED_CAPACITY.toString(), provisionedCapacity);
StringSet allocatedCapacity = new StringSet();
if (mtree.logicalCapacity != null) {
allocatedCapacity.add(Long.toString(mtree.logicalCapacity.getUsed()));
} else {
allocatedCapacity.add(Long.toString(0));
}
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.ALLOCATED_CAPACITY.toString(), allocatedCapacity);
// Save off FileSystem Name, Path, Mount and label information
String name = mtree.name;
StringSet fsName = new StringSet();
fsName.add(name);
StringSet fsMountPath = new StringSet();
fsMountPath.add(mtree.name);
StringSet nativeId = new StringSet();
nativeId.add(mtree.id);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NAME.toString(), fsName);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NATIVE_ID.toString(), nativeId);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.DEVICE_LABEL.toString(), fsName);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.PATH.toString(), fsName);
unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.MOUNT_PATH.toString(), fsMountPath);
// Add fileSystemInformation and Characteristics.
unManagedFileSystem.addFileSystemInformation(unManagedFileSystemInformation);
unManagedFileSystem.setFileSystemCharacterstics(unManagedFileSystemCharacteristics);
return unManagedFileSystem;
}
use of com.emc.storageos.db.client.model.StringMap in project coprhd-controller by CoprHD.
the class IsilonCommunicationInterface method copyUpdatedPropertiesInVNAS.
/**
* Modify Virtual NAS for the specified Isilon cluster storage array
*
* @param system
* the StorageSystem object
* @param isiAccessZone
* accessZone object
* @param vNas
* the VirtualNAS object
* @return VirtualNAS with updated attributes
*/
private VirtualNAS copyUpdatedPropertiesInVNAS(final StorageSystem system, final IsilonAccessZone isiAccessZone, VirtualNAS vNas) {
vNas.setStorageDeviceURI(system.getId());
// set name
vNas.setNasName(isiAccessZone.getName());
vNas.setNativeId(isiAccessZone.getId());
// set base directory path
vNas.setBaseDirPath(isiAccessZone.getPath());
vNas.setNasState(VirtualNasState.LOADED.toString());
StringMap dbMetrics = vNas.getMetrics();
if (dbMetrics == null) {
dbMetrics = new StringMap();
}
// set the Limitation Metrics keys
setMaxDbMetricsAz(system, dbMetrics);
vNas.setMetrics(dbMetrics);
return vNas;
}
use of com.emc.storageos.db.client.model.StringMap in project coprhd-controller by CoprHD.
the class IsilonCommunicationInterface method populateDbMetricsAz.
/**
* process dbmetrics for total count and capacity
*
* @param azName
* @param isilonApi
* @param dbMetrics
*/
private void populateDbMetricsAz(final IsilonAccessZone accessZone, IsilonApi isilonApi, StringMap dbMetrics) {
long totalProvCap = 0L;
long totalFsCount = 0L;
String resumeToken = null;
String zoneName = accessZone.getName();
String baseDirPath = accessZone.getPath() + "/";
// filesystems count & used Capacity
IsilonList<IsilonSmartQuota> quotas = null;
do {
quotas = isilonApi.listQuotas(resumeToken, baseDirPath);
if (quotas != null && !quotas.getList().isEmpty()) {
for (IsilonSmartQuota quota : quotas.getList()) {
totalProvCap = totalProvCap + quota.getUsagePhysical();
totalFsCount++;
}
}
resumeToken = quotas.getToken();
} while (resumeToken != null);
// create a list of access zone for which base dir is not same as system access zone.
// we get all snapshot list at once. baseDirPaths list is used to
// find snaphot belong to which access zone.
List<String> baseDirPaths = null;
if (accessZone.isSystem() == true) {
List<IsilonAccessZone> isilonAccessZoneList = isilonApi.getAccessZones(resumeToken);
baseDirPaths = new ArrayList<String>();
for (IsilonAccessZone isiAccessZone : isilonAccessZoneList) {
if (!baseDirPath.equals(IFS_ROOT + "/")) {
baseDirPaths.add(isiAccessZone.getPath() + "/");
}
}
}
// snapshots count & snap capacity
resumeToken = null;
IsilonList<IsilonSnapshot> snapshots = null;
do {
snapshots = isilonApi.listSnapshots(resumeToken);
if (snapshots != null && !snapshots.getList().isEmpty()) {
if (!baseDirPath.equals(IFS_ROOT + "/")) {
// if it is not system access zone then compare
// with fs path with base dir path
_log.info("access zone base directory path {}", baseDirPath);
for (IsilonSnapshot isilonSnap : snapshots.getList()) {
if (isilonSnap.getPath().startsWith(baseDirPath)) {
totalProvCap = totalProvCap + Long.valueOf(isilonSnap.getSize());
totalFsCount++;
}
}
} else {
// process the snapshots for system access zone
boolean snapSystem = true;
for (IsilonSnapshot isilonSnap : snapshots.getList()) {
snapSystem = true;
// first check fs path with user defined AZ's paths
if (baseDirPaths != null && !baseDirPaths.isEmpty()) {
for (String basePath : baseDirPaths) {
if (isilonSnap.getPath().startsWith(basePath)) {
snapSystem = false;
break;
}
}
}
// it then it is belongs to access zone with basedir same as system access zone.
if (snapSystem) {
totalProvCap = totalProvCap + Long.valueOf(isilonSnap.getSize());
totalFsCount++;
_log.info("Access zone base directory path: {}", accessZone.getPath());
}
}
}
resumeToken = snapshots.getToken();
}
} while (resumeToken != null);
if (totalProvCap > 0) {
totalProvCap = (totalProvCap / KB_IN_BYTES);
}
_log.info("Total fs Count {} for access zone : {}", String.valueOf(totalFsCount), accessZone.getName());
_log.info("Total fs Capacity {} for access zone : {}", String.valueOf(totalProvCap), accessZone.getName());
// get total exports
int nfsExportsCount = 0;
int cifsSharesCount = 0;
resumeToken = null;
IsilonList<IsilonExport> isilonNfsExports = null;
do {
isilonNfsExports = isilonApi.listExports(resumeToken, zoneName);
if (isilonNfsExports != null) {
nfsExportsCount = nfsExportsCount + isilonNfsExports.size();
resumeToken = isilonNfsExports.getToken();
}
} while (resumeToken != null);
_log.info("Total NFS exports {} for access zone : {}", String.valueOf(nfsExportsCount), accessZone.getName());
// get cifs exports for given access zone
resumeToken = null;
IsilonList<IsilonSMBShare> isilonCifsExports = null;
do {
isilonCifsExports = isilonApi.listShares(resumeToken, zoneName);
if (isilonCifsExports != null) {
cifsSharesCount = cifsSharesCount + isilonCifsExports.size();
resumeToken = isilonCifsExports.getToken();
}
} while (resumeToken != null);
_log.info("Total CIFS sharess {} for access zone : {}", String.valueOf(cifsSharesCount), accessZone.getName());
if (dbMetrics == null) {
dbMetrics = new StringMap();
}
// set total nfs and cifs exports for give AZ
dbMetrics.put(MetricsKeys.totalNfsExports.name(), String.valueOf(nfsExportsCount));
dbMetrics.put(MetricsKeys.totalCifsShares.name(), String.valueOf(cifsSharesCount));
// set total fs objects and their sum of capacity for give AZ
dbMetrics.put(MetricsKeys.storageObjects.name(), String.valueOf(totalFsCount));
dbMetrics.put(MetricsKeys.usedStorageCapacity.name(), String.valueOf(totalProvCap));
Long maxExports = MetricsKeys.getLong(MetricsKeys.maxNFSExports, dbMetrics) + MetricsKeys.getLong(MetricsKeys.maxCifsShares, dbMetrics);
Long maxStorObjs = MetricsKeys.getLong(MetricsKeys.maxStorageObjects, dbMetrics);
Long maxCapacity = MetricsKeys.getLong(MetricsKeys.maxStorageCapacity, dbMetrics);
Long totalExports = Long.valueOf(nfsExportsCount + cifsSharesCount);
// setting overLoad factor (true or false)
String overLoaded = FALSE;
if (totalExports >= maxExports || totalProvCap >= maxCapacity || totalFsCount >= maxStorObjs) {
overLoaded = TRUE;
}
double percentageLoadExports = 0.0;
// percentage calculator
if (totalExports > 0.0) {
percentageLoadExports = ((double) (totalExports) / maxExports) * 100;
}
double percentageLoadStorObj = ((double) (totalProvCap) / maxCapacity) * 100;
double percentageLoad = (percentageLoadExports + percentageLoadStorObj) / 2;
dbMetrics.put(MetricsKeys.percentLoad.name(), String.valueOf(percentageLoad));
dbMetrics.put(MetricsKeys.overLoaded.name(), overLoaded);
return;
}
use of com.emc.storageos.db.client.model.StringMap in project coprhd-controller by CoprHD.
the class VPlexControllerUtils method getVolumeITLs.
/**
* Gets the list of ITLs from the volume extensions
*
* @param volume
* @return
*/
public static List<String> getVolumeITLs(Volume volume) {
List<String> itlList = new ArrayList<>();
StringMap extensions = volume.getExtensions();
if (null != extensions) {
Set<String> keys = extensions.keySet();
for (String key : keys) {
if (key.startsWith(CinderConstants.PREFIX_ITL)) {
itlList.add(extensions.get(key));
}
}
}
return itlList;
}
Aggregations