/*
 * Helper function to retrieve system capabilities
 */
struct nvm_capabilities wbem::pmem_config::PersistentMemoryCapabilitiesFactory::getNvmCapabilities()
	throw (wbem::framework::Exception)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);

	struct nvm_capabilities capabilities;
	int rc = nvm_get_nvm_capabilities(&capabilities);
	if (rc < 0)
	{
		throw exception::NvmExceptionLibError(rc);
	}

	return capabilities;
}
wbem::framework::UINT64 wbem::pmem_config::PersistentMemoryCapabilitiesFactory::getMaxNamespacesPerPool(struct pool *pPool)
	throw (framework::Exception)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);
	NVM_UINT64 maxAppDirectNS = 0;
	NVM_UINT64 maxBlockNS = 0;

	NVM_GUID_STR poolGuidStr;
	guid_to_str(pPool->pool_guid, poolGuidStr);
	struct nvm_capabilities nvm_caps;
	int rc = nvm_get_nvm_capabilities(&nvm_caps);
	if (rc == NVM_SUCCESS)
	{
		// A pool can have as many App Direct Namespaces as its interleave sets as long as the size is greater
		// than minimum namespace size
		for (int i = 0; i < pPool->ilset_count; i++)
		{
			if (pPool->ilsets[i].size >= nvm_caps.sw_capabilities.min_namespace_size)
			{
				maxAppDirectNS++;
			}
		}

		// A pool can have as many storage namespaces as its dimms as long as the size is greater
		// than minimum namespace size
		for (int j = 0; j < pPool->dimm_count; j++)
		{
			if (pPool->storage_capacities[j] >= nvm_caps.sw_capabilities.min_namespace_size)
			{
				maxBlockNS++;
			}
		}
	}

	return (maxAppDirectNS + maxBlockNS);
}
Beispiel #3
0
int LibWrapper::getNvmCapabilities(struct nvm_capabilities *pCapabilities) const
{
	LogEnterExit(__FUNCTION__, __FILE__, __LINE__);
	return nvm_get_nvm_capabilities(pCapabilities);
}