/* * Return the object paths for each instance of the class. * One per persistent memory pool in the system. */ wbem::framework::instance_names_t *wbem::pmem_config::PersistentMemoryCapabilitiesFactory::getInstanceNames() throw(wbem::framework::Exception) { LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__); framework::instance_names_t *pNames = new framework::instance_names_t(); try { // get PM pools std::vector<struct pool> pools = wbem::mem_config::PoolViewFactory::getPoolList(true); for (std::vector<struct pool>::const_iterator iter = pools.begin(); iter != pools.end(); iter++) { framework::attributes_t keys; // Instance ID = Pool GUID NVM_GUID_STR poolGuidStr; guid_to_str((*iter).pool_guid, poolGuidStr); keys[INSTANCEID_KEY] = framework::Attribute(poolGuidStr, true); framework::ObjectPath path(wbem::server::getHostName(), NVM_NAMESPACE, PMCAP_CREATIONCLASSNAME, keys); pNames->push_back(path); } } catch (framework::Exception &) { delete pNames; throw; } return pNames; }
static int dissect_dtpt_guid(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex) { guint32 guid_length; guid_length = tvb_get_letohl(tvb, offset); if (tree) { e_guid_t guid; proto_item *dtpt_guid_item = NULL; proto_tree *dtpt_guid_tree = NULL; const gchar *guid_name = NULL; if (guid_length) { tvb_get_guid(tvb, offset+4, &guid, ENC_LITTLE_ENDIAN); } else { memset(&guid, 0, sizeof(guid)); } dtpt_guid_item = proto_tree_add_guid(tree, hfindex, tvb, offset, 4 + guid_length, &guid); if (dtpt_guid_item) { guid_name = guids_get_guid_name(&guid); if (guid_name != NULL) proto_item_set_text(dtpt_guid_item, "%s: %s (%s)", proto_registrar_get_name(hfindex), guid_name, guid_to_str(&guid)); dtpt_guid_tree = proto_item_add_subtree(dtpt_guid_item, ett_dtpt_guid); } if (dtpt_guid_tree) { proto_item *dtpt_guid_data_item = NULL; proto_tree_add_uint(dtpt_guid_tree, hf_dtpt_guid_length, tvb, offset, 4, guid_length); if (guid_length) { dtpt_guid_data_item = proto_tree_add_guid(dtpt_guid_tree, hf_dtpt_guid_data, tvb, offset+4, guid_length, &guid); if (guid_name != NULL && dtpt_guid_data_item != NULL) { proto_item_set_text(dtpt_guid_data_item, "%s: %s (%s)", proto_registrar_get_name(hf_dtpt_guid_data), guid_name, guid_to_str(&guid)); } } } } offset+=4; offset+=guid_length; return offset; }
PJ_DEF(pj_str_t*) pj_generate_unique_string(pj_str_t *str) { GUID guid; PJ_CHECK_STACK(); CoCreateGuid(&guid); guid_to_str( &guid, str ); return str; }
bool wbem::logic::PostLayoutAddressDecoderLimitCheck::isInterleaveSetOverwrittenByLayout( const struct MemoryAllocationLayout& layout, const struct interleave_set& interleave) { LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__); bool isOverwritten = false; for (NVM_UINT16 i = 0; i < interleave.dimm_count; i++) { NVM_GUID_STR guidStr; guid_to_str(interleave.dimms[i], guidStr); // Any DIMM in the new layout will have all its interleave sets overwritten if (layout.goals.find(guidStr) != layout.goals.end()) { isOverwritten = true; break; } } return isOverwritten; }
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); }
/* * Retrieve a specific instance given an object path */ wbem::framework::Instance *wbem::pmem_config::PersistentMemoryCapabilitiesFactory::getInstance( framework::ObjectPath &path, framework::attribute_names_t &attributes) throw(wbem::framework::Exception) { LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__); // create the instance, initialize with attributes from the path framework::Instance *pInstance = new framework::Instance(path); try { checkAttributes(attributes); struct pool pool = getPool(path); // ElementName = "Pool Capabilities for: " + pool UUID if (containsAttribute(ELEMENTNAME_KEY, attributes)) { NVM_GUID_STR poolGuidStr; guid_to_str(pool.pool_guid, poolGuidStr); std::string elementNameStr = PMCAP_ELEMENTNAME + poolGuidStr; framework::Attribute a(elementNameStr, false); pInstance->setAttribute(ELEMENTNAME_KEY, a, attributes); } // MaxNamespaces = Max namespaces for this pool if (containsAttribute(MAXNAMESPACES_KEY, attributes)) { framework::UINT64 maxNs = getMaxNamespacesPerPool(&pool); framework::Attribute a(maxNs, false); pInstance->setAttribute(MAXNAMESPACES_KEY, a, attributes); } // SecurityFeatures = Supported security features of the pool if (containsAttribute(SECURITYFEATURES_KEY, attributes)) { framework::UINT16_LIST secFeaturesList = getPoolSecurityFeatures(&pool); framework::Attribute a(secFeaturesList, false); pInstance->setAttribute(SECURITYFEATURES_KEY, a, attributes); } // AccessGranularity = Block/byte if (containsAttribute(ACCESSGRANULARITY_KEY, attributes)) { framework::UINT16_LIST accessList; accessList.push_back(PMCAP_ACCESSGRANULARITY_BYTE); // all app direct is byte accessible if (pool.type == POOL_TYPE_PERSISTENT) { accessList.push_back(PMCAP_ACCESSGRANULARITY_BLOCK); // non mirrored = block capable } framework::Attribute a(accessList, false); pInstance->setAttribute(ACCESSGRANULARITY_KEY, a, attributes); } // MemoryArchitecture = NUMA if (containsAttribute(MEMORYARCHITECTURE_KEY, attributes)) { framework::UINT16_LIST memArchList; memArchList.push_back(PMCAP_MEMORYARCHITECTURE_NUMA); framework::Attribute a(memArchList, false); pInstance->setAttribute(MEMORYARCHITECTURE_KEY, a, attributes); } // Replication = Mirrored locally or nothing if (containsAttribute(REPLICATION_KEY, attributes)) { framework::UINT16_LIST replicationList; if (pool.type == POOL_TYPE_PERSISTENT_MIRROR) { replicationList.push_back(PMCAP_REPLICATION_LOCAL); } framework::Attribute a(replicationList, false); pInstance->setAttribute(REPLICATION_KEY, a, attributes); } } catch (framework::Exception &) // clean up and re-throw { if (pInstance) { delete pInstance; pInstance = NULL; } throw; } return pInstance; }