コード例 #1
0
wbem::framework::Instance* wbem::profile::RegisteredProfileFactory::getInstance(framework::ObjectPath& path,
		framework::attribute_names_t& attributes) throw (framework::Exception)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);

	checkAttributes(attributes);

	framework::Instance *pInstance = new framework::Instance(path);
	if (!pInstance)
	{
		throw framework::ExceptionNoMemory(__FILE__, __FUNCTION__,
				"instance for RegisteredProfile");
	}

	try
	{
		buildInstanceFromProfileInfoMap(*pInstance, attributes);
	}
	catch (framework::Exception &)
	{
		delete pInstance;
		throw;
	}

	return pInstance;
}
コード例 #2
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::software::NVDIMMSoftwareInstallationServiceFactory::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);
		checkPath(path);

		// ElementName - "Intel NVM FW Installation Service for" + host name
		if (containsAttribute(ELEMENTNAME_KEY, attributes))
		{
			std::string hostName = wbem::server::getHostName();
			framework::Attribute a(std::string("Intel NVM FW Installation Service for ") + hostName, false);
			pInstance->setAttribute(ELEMENTNAME_KEY, a, attributes);
		}
	}
	catch (framework::Exception &) // clean up and re-throw
	{
		delete pInstance;
		throw;
	}

	return pInstance;
}
コード例 #3
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::server::BaseServerFactory::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 *pResult = new framework::Instance(path);
	try
	{
		checkAttributes(attributes);
		validateObjectPath(path);

		core::system::SystemService &service = core::system::SystemService::getService();
		core::Result<core::system::SystemInfo> s = service.getHostInfo();

		toInstance(s.getValue(), *pResult, attributes);
	}
	catch (framework::Exception &)
	{
		delete pResult;
		throw;
	}

	return pResult;
}
コード例 #4
0
/*
 * Overload of standard CIM method to retrieve a list of instances in this factory.
 */
wbem::framework::instances_t* wbem::memory::MemoryControllerFactory::getInstances(
	framework::attribute_names_t &attributes)
	throw (framework::Exception)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);

	framework::instances_t *pInstList = new framework::instances_t();
	try
	{
		checkAttributes(attributes);

		// We could start by running getInstanceNames(..), however that would be incredibly
		// inefficient because the subsequent call(s) to getInstance(..) would be doing the same work
		// N times.  Instead, we pass attributes and pInstList to the helper function, and let it take
		// care of the rest.
		int rc = getInstancesHelperLoop(NULL, pInstList, &attributes);
		if (rc < NVM_SUCCESS)
		{
			throw exception::NvmExceptionLibError(rc);
		}
	}
	catch (framework::Exception) // clean up and re-throw
	{
		delete pInstList;
		throw;
	}

	return pInstList;
}
コード例 #5
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::erasure::ErasureServiceFactory::getInstance(
		framework::ObjectPath &path, framework::attribute_names_t &attributes)
throw (wbem::framework::Exception)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);

	checkPath(path);

	// create the instance, initialize with attributes from the path
	framework::Instance *pInstance = new framework::Instance(path);
	try
	{
		checkAttributes(attributes);

		// ElementName - "Erasure Service"
		if (containsAttribute(ELEMENTNAME_KEY, attributes))
		{
			framework::Attribute a(ERASURESERVICE_ELEMENTNAME, false);
			pInstance->setAttribute(ELEMENTNAME_KEY, a, attributes);
		}
	}
	catch (framework::Exception &) // clean up and re-throw
	{
		delete pInstance;
		throw;
	}

	return pInstance;
}
コード例 #6
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::performance::PerformanceMetricFactory::getInstance(
	framework::ObjectPath &path, framework::attribute_names_t &attributes)
throw (wbem::framework::Exception)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);

	// Verify attributes
	checkAttributes(attributes);

	framework::Instance *pInstance = NULL;
	try
	{
		pInstance = new framework::Instance(path);

		framework::Attribute instanceIdAttr = path.getKeyValue(INSTANCEID_KEY);

		std::string deviceUid;
		metric_type metric;
		if (!splitInstanceID(instanceIdAttr, deviceUid, metric))
		{
			throw framework::ExceptionBadParameter(instanceIdAttr.asStr().c_str());
		}

		NVM_UID nvmUid;
		uid_copy(deviceUid.c_str(), nvmUid);

		// serialNumberStr is used in more than 1 attribute so getting here.
		std::string serialNumberStr = getDeviceSerialNumber(nvmUid);

		std::string metricName = getMetricElementNameFromType(metric) + " " + serialNumberStr;
		framework::Attribute elementNameAttr(metricName, false);
		(*pInstance).setAttribute(wbem::ELEMENTNAME_KEY, elementNameAttr, attributes);

		const std::string metricDefId
			= PerformanceMetricDefinitionFactory::getMetricId(metric);
		framework::Attribute metricDefinitionAttr(metricDefId, false);
		(*pInstance).setAttribute(wbem::METRICDEFINITION_ID_KEY, metricDefinitionAttr, attributes);

		std::string metricDimm = METRIC_DIMM_STR + serialNumberStr;
		framework::Attribute measuredElementNameAttr(metricDimm, false);
		(*pInstance).setAttribute(wbem::MEASUREDELEMENTNAME_KEY, measuredElementNameAttr, attributes);

		NVM_UINT64 metricValue = getValueForDeviceMetric(nvmUid, metric);
		std::ostringstream stream;
		stream << metricValue;
		framework::Attribute metricValueAttr(stream.str(), false);
		(*pInstance).setAttribute(wbem::METRICVALUE_KEY, metricValueAttr, attributes);
	}
	catch (framework::Exception) // clean up and re-throw
	{
		if (pInstance != NULL)
		{
			delete pInstance;
			pInstance = NULL;
		}
		throw;
	}
	return pInstance;
}
コード例 #7
0
ファイル: DefinitionParser.cpp プロジェクト: hkunz/createswf
bool DefinitionParser::createMultiFrameSprite (QDomNode& frame, const Content::Class clazz)
{
	QDomNode parent = frame.parentNode();
	QDomNamedNodeMap attributes = parent.attributes();
	const QString childName = clazz == Content::MOVIECLIP ? ::NODE_FRAME : ::NODE_OBJECT;
	const QString className = attributes.namedItem(ATTR_CLASS).nodeValue();
	const QString basePath = attributes.namedItem(ATTR_PATH).nodeValue();
	const QString absBasePath = _targetDir.absoluteFilePath(basePath);
	struct SpriteAsset* sprite = NULL;

	if (!QFile::exists(absBasePath)) {
		info("base path \'" + absBasePath + "\' does not exist");
		return false;
	}

	while (!frame.isNull()) {
		QDomElement e = frame.toElement();
		QDomNamedNodeMap attr = frame.attributes();
		checkAttributes(frame);
		frame = frame.nextSibling();

		if (e.isNull()) {
			continue;
		}

		const QString tn = e.tagName();
		if (tn != childName) {
			warnInvalidTag(tn, frame.parentNode().nodeName());
			continue;
		}

		const QString relpath = attr.namedItem(ATTR_PATH).nodeValue();
		if (attr.isEmpty() || relpath.isEmpty()) {
			warnMissingAttr(ATTR_PATH, tn);
			continue;
		}

		const QString path = _targetDir.absoluteFilePath(basePath + relpath);
		if (!checkPathExists(path)) {
			continue;
		}
		struct AssetBit asset;
		asset.name = attr.namedItem(ATTR_NAME).nodeValue();
		asset.path = _tempDir.relativeFilePath(path);
		copyAttributes(&asset, attr);
		if (!sprite) {
			sprite = new SpriteAsset();
		}
		sprite->assets.push_back(asset);
	}
	if (sprite) {
		sprite->clazz = clazz;
		sprite->name = className;
		copyAttributes(sprite, attributes);
		_assets[className] = sprite;
	}
	return true;
}
コード例 #8
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::mem_config::MemoryConfigurationCapabilitiesFactory::getInstance(
		framework::ObjectPath &path,
		framework::attribute_names_t &attributes)
				throw (wbem::framework::Exception)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);

	// Verify ObjectPath ...
	std::string hostName = wbem::server::getHostName();

	// Verify InstanceID
	framework::Attribute attribute = path.getKeyValue(INSTANCEID_KEY);
	if (attribute.stringValue() != (hostName + MEMORYCONFIGURATIONCAPABILITIES_INSTANCEID))
	{
		throw framework::ExceptionBadParameter(INSTANCEID_KEY.c_str());
	}

	// create the instance, initialize with attributes from the path
	framework::Instance *pInstance = new framework::Instance(path);

	try
	{
		checkAttributes(attributes);

		// ElementName - hostname + " NVM Configuration Capabilities"
		if (containsAttribute(ELEMENTNAME_KEY, attributes))
		{
			framework::Attribute a((hostName + MEMORYCONFIGURATIONCAPABILITIES_ELEMENTNAME), false);
			pInstance->setAttribute(ELEMENTNAME_KEY, a, attributes);
		}

		// SynchronousMethodsSupported
		if (containsAttribute(SUPPORTEDSYNCHRONOUSOPERATIONS_KEY, attributes))
		{
			// empty list
			framework::UINT16_LIST synchmethods;
			framework::Attribute a(synchmethods, false);
			pInstance->setAttribute(SUPPORTEDSYNCHRONOUSOPERATIONS_KEY, a, attributes);
		}

		// AsynchronousMethodsSupported - none
		if (containsAttribute(SUPPORTEDASYNCHRONOUSOPERATIONS_KEY, attributes))
		{
			framework::UINT16_LIST asynchmethods;
			asynchmethods.push_back(METHOD_ALLOCATEFROMPOOL);
			framework::Attribute a(asynchmethods, false);
			pInstance->setAttribute(SUPPORTEDASYNCHRONOUSOPERATIONS_KEY, a, attributes);
		}
	}
	catch (framework::Exception &) // clean up and re-throw
	{
		delete pInstance;
		throw;
	}

	return pInstance;
}
コード例 #9
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::mem_config::MemoryConfigurationFactory::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);
		lib_interface::NvmApi *pApi = lib_interface::NvmApi::getApi();

		// parse InstanceID
		framework::Attribute idAttr = path.getKeyValue(INSTANCEID_KEY);
		std::string instanceId = idAttr.stringValue();

		if (!isValidInstanceId(instanceId))
		{
			throw framework::ExceptionBadParameter(INSTANCEID_KEY.c_str());
		}

		std::string uidStr = instanceId.substr(0, instanceId.length() - 1);
		struct device_discovery deviceDiscovery;
		pApi->getDeviceDiscoveryForDimm(uidStr, deviceDiscovery);

		// ElementName - host name + " NVM allocation setting"
		if (containsAttribute(ELEMENTNAME_KEY, attributes))
		{
			// Get the real host name
			std::string elementName = pApi->getHostName() +
					MEMORYCONFIGURATION_ELEMENTNAME;
			framework::Attribute a(elementName, false);
			pInstance->setAttribute(ELEMENTNAME_KEY, a, attributes);
		}

		populateInstanceDimmInfoFromDiscovery(attributes, pInstance, deviceDiscovery);

		if (isGoalConfig(instanceId))
		{
			populateGoalInstance(attributes, uidStr, pInstance, &deviceDiscovery);
		}
		else
		{
			populateCurrentConfigInstance(attributes, uidStr, pInstance, &deviceDiscovery);
		}
	}
	catch (framework::Exception &) // clean up and re-throw
	{
		delete pInstance;
		throw;
	}

	return pInstance;
}
コード例 #10
0
ファイル: DefinitionParser.cpp プロジェクト: hkunz/createswf
void DefinitionParser::parseAssetNodes (QDomNode& node, const Content::Class clazz)
{
	bool sprite = false;
	QString nodeName;
	switch (clazz) {
	case Content::MOVIECLIP:
		nodeName = NODE_MOVIECLIP;
		sprite = true;
		break;
	case Content::SPRITE:
		sprite = true;
		nodeName = NODE_SPRITE;
		break;
	case Content::BITMAPDATA:
		nodeName = NODE_BITMAP;
		break;
	case Content::SOUND:
		nodeName = NODE_SOUND;
		break;
	case Content::BYTEARRAY:
		nodeName = NODE_BINARY;
		break;
	default:
		error("invalid class type " + QString::number(clazz));
		return;
	}
	while (!node.isNull()) {
		QDomElement elem = node.toElement();
		QDomNode parseNode = node;
		QDomNamedNodeMap attributes = node.attributes();
		QDomNode frame = node.firstChild();
		checkAttributes(node);
		node = node.nextSibling();

		if (elem.isNull()) {
			continue;
		}

		const QString tag = elem.tagName();
		if (nodeName != tag) {
			warnInvalidTag(tag, parseNode.parentNode().nodeName());
			continue;
		}

		if (attributes.isEmpty() || attributes.namedItem(ATTR_CLASS).nodeValue().isEmpty()) {
			warnMissingAttr(ATTR_CLASS, tag);
			continue;
		}

		if (frame.isNull() || !sprite) {
			createSingleFrameAsset(parseNode, clazz, nodeName);
		} else {
			createMultiFrameSprite(frame, clazz);
		}
	}
}
コード例 #11
0
/*
 * Helper function to retrieve just goal instances
 */
wbem::framework::instances_t* wbem::mem_config::MemoryConfigurationFactory::getGoalInstances(
	wbem::framework::attribute_names_t &attributes,
	const bool onlyUnappliedGoals)
		throw (wbem::framework::Exception)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);

	framework::instance_names_t *pGoalPaths = NULL;
	framework::instances_t *pGoalList = NULL;
	try
	{
		checkAttributes(attributes);
		pGoalPaths = getGoalInstanceNames(onlyUnappliedGoals);
		if (pGoalPaths != NULL)
		{
			// create the return list
			pGoalList = new framework::instances_t();

			// loop through the names
			for (framework::instance_names_t::iterator iter = pGoalPaths->begin();
					iter != pGoalPaths->end(); iter++)
			{
				framework::Instance* pInst = NULL;
				pInst = getInstance(*iter, attributes);
				if (pInst != NULL)
				{
					pGoalList->push_back(*pInst);
					delete pInst;
				}
			}
		}
	}

	// on error, cleanup but don't handle
	catch (wbem::framework::Exception &)
	{
		if (pGoalPaths)
		{
			delete pGoalPaths;
		}
		if (pGoalList)
		{
			delete pGoalList;
		}
		throw;
	}

	// clean up
	if (pGoalPaths)
	{
		pGoalPaths->clear();
		delete pGoalPaths;
	}

	return pGoalList;
}
コード例 #12
0
void CTagCn::operator ()(const CNode& node, CTreeNode& tree_node)
{
	(*this)(node);
	checkAttributes(node, { "type" });
	string attr = node.attribute("type").as_string();
	CNode child = node.first_child();
	if (attr == "real" || attr == "")
	{
		hasNChilds(node, 1);
		nodeIsReal(child, tree_node.Step("cn"));
		return;
	}
}
コード例 #13
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::support::SupportDataServiceFactory::getInstance(
	framework::ObjectPath &path, framework::attribute_names_t &attributes)
	throw (wbem::framework::Exception)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);

	checkPath(path);
	checkAttributes(attributes);

	// create the instance, initialize with attributes from the path
	framework::Instance *pInstance = new framework::Instance(path);

	return pInstance;
}
コード例 #14
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::support::OpaqueSupportDataFactory::getInstance(
		framework::ObjectPath &path,
		framework::attribute_names_t &attributes)
				throw (wbem::framework::Exception)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);

	framework::Instance *pInstance = new framework::Instance(path);

	checkPath(path);
	checkAttributes(attributes);

	return pInstance;
}
コード例 #15
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::support::DiagnosticLogFactory::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);

		// get the host server name
		std::string hostName = wbem::server::getHostName();

		// make sure the instance ID passed in matches this host
		framework::Attribute instanceID = path.getKeyValue(INSTANCEID_KEY);
		if (instanceID.stringValue() == std::string(DIAGNOSTICLOG_NAME + hostName))
		{
			// ElementName - "NVDIMM Diagnostic Log"
			if (containsAttribute(ELEMENTNAME_KEY, attributes))
			{
				framework::Attribute elementNameAttr(DIAGNOSTICLOG_NAME, false);
				pInstance->setAttribute(ELEMENTNAME_KEY, elementNameAttr, attributes);
			}

			// CurrentNumberOfRecords - One per test type per dimm
			if (containsAttribute(CURRENTNUMBEROFRECORDS_KEY, attributes))
			{
				diagnosticResults_t results;
				int count = gatherDiagnosticResults(&results);
				framework::Attribute recordCntAttr((NVM_UINT64)count, false);
				pInstance->setAttribute(CURRENTNUMBEROFRECORDS_KEY, recordCntAttr, attributes);
			}
		}
		else
		{
			throw framework::ExceptionBadParameter(INSTANCEID_KEY.c_str());
		}
	}
	catch (framework::Exception &) // clean up and re-throw
	{
		delete pInstance;
		throw;
	}

	return pInstance;
}
コード例 #16
0
void CTagCn::operator ()(const CNode& node)const
{
	checkAttributes(node, { "type" });
	string attr = node.attribute("type").as_string();
	CNode child = node.first_child();
	if (attr == "real" || attr == "")
	{
		hasNChilds(node, 1);
		nodeIsReal(child);
		return;
	}
	if (attr == "integer")
	{
		hasNChilds(node, 1);
		nodeIsInteger(child);
		return;
	};
	// syntax "real <sep/> real"
	if ((attr == "complex-cartesian") || (attr == "complex-polar"))
	{
		hasNChilds(node, 3);
		nodeIsReal(child);
		nodeIsReal(child.next_sibling().next_sibling());
		if (string(child.next_sibling().name()) != string("sep"))
			throwException(node, node.offset_debug(), INCORRECT_VALUE);
		return;
	};

	// syntax "int <sep/> imt"
	if (attr == "rational")
	{
		hasNChilds(node, 3);
		nodeIsInteger(child);
		nodeIsInteger(child.next_sibling().next_sibling());
		if (string(child.next_sibling().name()) != string("sep"))
			throwException(node, node.offset_debug(), INCORRECT_VALUE);
		return;
	};

	if (attr == "constant")
	{
		return;
	};

	throwException(node, node.offset_debug(), UNKNOWN_ATTRIBUTE);
}
コード例 #17
0
wbem::framework::instances_t *wbem::mem_config::MemoryConfigurationFactory::getInstancesFromLayout(
		const core::memory_allocator::MemoryAllocationLayout &layout,
		framework::attribute_names_t &attributes)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);

	checkAttributes(attributes);

	wbem::framework::instances_t *pInstances = new wbem::framework::instances_t();
	if (!pInstances)
	{
		throw wbem::framework::ExceptionNoMemory(__FILE__, __FUNCTION__,
				"Couldn't allocate new instances_t");
	}

	try
	{
		wbem::lib_interface::NvmApi *pApi = wbem::lib_interface::NvmApi::getApi();
		for (std::map<std::string, struct config_goal>::const_iterator goalIter = layout.goals.begin();
				goalIter != layout.goals.end(); goalIter++)
		{
			wbem::framework::Instance instance;

			std::string goaldimmUid = goalIter->first;

			struct device_discovery discovery;
			pApi->getDeviceDiscoveryForDimm(goaldimmUid, discovery);

			populateInstanceDimmInfoFromDiscovery(attributes, &instance, discovery);
			configGoalToGoalInstance(attributes, &discovery, goalIter->second, &instance);
			pInstances->push_back(instance);
		}
	}
	catch (wbem::framework::Exception &)
	{
		delete pInstances;
		throw;
	}

	return pInstances;
}
コード例 #18
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::software::HostSoftwareFactory::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);

		// get the host server name
		std::string hostName = wbem::server::getHostName();

		// make sure the instance ID passed in matches this host
		framework::Attribute instanceID = path.getKeyValue(INSTANCEID_KEY);
		if (instanceID.stringValue() == std::string(HOSTSOFTWARE_INSTANCEID + hostName))
		{
			// ElementName - "Host software for " + host name
			if (containsAttribute(ELEMENTNAME_KEY, attributes))
			{
				framework::Attribute a(std::string("Host software for ") + hostName, false);
				pInstance->setAttribute(ELEMENTNAME_KEY, a, attributes);
			}
		}
		else
		{
			throw framework::ExceptionBadParameter(INSTANCEID_KEY.c_str());
		}
	}
	catch (framework::Exception) // clean up and re-throw
	{
		delete pInstance;
		throw;
	}

	return pInstance;
}
コード例 #19
0
ファイル: MeshInstance.cpp プロジェクト: Alfex4936/VoltAir
// Shader must already be bound.
void MeshInstance::bind() {
    assert(mMesh && mShader);
    if (!checkAttributes()) {
        return;
    }

    mMesh->bind();

    Shader* shader = mShader.get();
    AttributeSet* attributes = mMesh->getAttributes().get();
    int attributeCount = mAttributeIndexes.size();
    for (int i = 0; i < attributeCount; ++i) {
        int attributeIndex = mAttributeIndexes[i];
        if (attributeIndex >= 0) {
            const Attribute& attribute = attributes->attributes[attributeIndex];
            int offset = attributes->attributeOffsets[attributeIndex];
            int location = shader->getAttributeLocation(i);
            glEnableVertexAttribArray(location);
            glVertexAttribPointer(location, attribute.size, attribute.type, attribute.normalized,
                    attributes->vertexStride, (GLvoid*)(long) offset);
        }
    }
}
コード例 #20
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::software::ManagementSoftwareIdentityFactory::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
    {
        m_hostName = m_systemService.getHostName();
        checkAttributes(attributes);

        // make sure the instance ID passed in matches this host
        framework::Attribute instanceID = path.getKeyValue(INSTANCEID_KEY);
        if (instanceID.stringValue() == getInstanceId())
        {
            core::Result<core::system::SoftwareInfo> swInfo = m_systemService.getSoftwareInfo();

            // ElementName - mgmt sw name + host name
            if (containsAttribute(ELEMENTNAME_KEY, attributes))
            {
                framework::Attribute a(getElementName(), false);
                pInstance->setAttribute(ELEMENTNAME_KEY, a, attributes);
            }
            // MajorVersion - Mgmt sw major version number
            if (containsAttribute(MAJORVERSION_KEY, attributes))
            {
                framework::Attribute a(swInfo.getValue().getMgmtSoftwareMajorVersion(),
                                       false);
                pInstance->setAttribute(MAJORVERSION_KEY, a, attributes);
            }
            // MinorVersion - Mgmt sw minor version number
            if (containsAttribute(MINORVERSION_KEY, attributes))
            {
                framework::Attribute a(swInfo.getValue().getMgmtSoftwareMinorVersion(),
                                       false);
                pInstance->setAttribute(MINORVERSION_KEY, a, attributes);
            }
            // RevisionNumber - Mgmt sw hotfix number
            if (containsAttribute(REVISIONNUMBER_KEY, attributes))
            {
                framework::Attribute a(swInfo.getValue().getMgmtSoftwareHotfixVersion(),
                                       false);
                pInstance->setAttribute(REVISIONNUMBER_KEY, a, attributes);
            }
            // BuildNumber - Mgmt sw build number
            if (containsAttribute(BUILDNUMBER_KEY, attributes))
            {
                framework::Attribute a(swInfo.getValue().getMgmtSoftwareBuildVersion(),
                                       false);
                pInstance->setAttribute(BUILDNUMBER_KEY, a, attributes);
            }
            // VersionString - Mgmt sw version as a string
            if (containsAttribute(VERSIONSTRING_KEY, attributes))
            {
                framework::Attribute a(swInfo.getValue().getMgmtSoftwareVersion(), false);
                pInstance->setAttribute(VERSIONSTRING_KEY, a, attributes);
            }
            // Manufacturer - Intel
            if (containsAttribute(MANUFACTURER_KEY, attributes))
            {
                framework::Attribute a("Intel", false);
                pInstance->setAttribute(MANUFACTURER_KEY, a, attributes);
            }
            // Classifications - 3, "Configuration Software"
            if (containsAttribute(CLASSIFICATIONS_KEY, attributes))
            {
                framework::UINT16_LIST classifications;
                classifications.push_back(MANAGEMENTSWIDENTITY_CLASSIFICATIONS_CONFIGSW);
                framework::Attribute a(classifications, false);
                pInstance->setAttribute(CLASSIFICATIONS_KEY, a, attributes);
            }
            // IsEntity = true
            if (containsAttribute(ISENTITY_KEY, attributes))
            {
                framework::Attribute a(true, false);
                pInstance->setAttribute(ISENTITY_KEY, a, attributes);
            }
        }
        else
        {
            throw framework::ExceptionBadParameter(INSTANCEID_KEY.c_str());
        }
    }
    catch (framework::Exception &) // clean up and re-throw
    {
        delete pInstance;
        throw;
    }
    catch (core::LibraryException &e)
    {
        delete pInstance;
        throw exception::NvmExceptionLibError(e.getErrorCode());
    }

    return pInstance;
}
コード例 #21
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance *wbem::pmem_config::NamespaceSettingsFactory::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);

		std::string nsUidStr = path.getKeyValue(INSTANCEID_KEY).stringValue();
		if (!core::Helper::isValidNamespaceUid(nsUidStr))
		{
			COMMON_LOG_ERROR_F("NamespaceSettings InstanceID is not a valid namespace uid %s",
					nsUidStr.c_str());
			throw framework::ExceptionBadParameter(INSTANCEID_KEY.c_str());
		}

		struct namespace_details ns = NamespaceViewFactory::getNamespaceDetails(nsUidStr);

		// ElementName = Friendly Name
		if (containsAttribute(ELEMENTNAME_KEY, attributes))
		{
			framework::Attribute a(
					std::string(NSSETTINGS_ELEMENTNAME_PREFIX + ns.discovery.friendly_name), false);
			pInstance->setAttribute(ELEMENTNAME_KEY, a, attributes);
		}

		// AllocationUnits = block size as a string
		if (containsAttribute(ALLOCATIONUNITS_KEY, attributes))
		{
			std::stringstream allocationUnits;
			allocationUnits << NSSETTINGS_ALLOCATIONUNITS_BYTES;
			allocationUnits << "*";
			allocationUnits << ns.block_size;
			framework::Attribute a(allocationUnits.str(), false);
			pInstance->setAttribute(ALLOCATIONUNITS_KEY, a, attributes);
		}

		// Reservation = block count
		if (containsAttribute(RESERVATION_KEY, attributes))
		{
			NVM_UINT64 nsBytes = ns.block_count * ns.block_size;
			framework::Attribute a(nsBytes, false);
			pInstance->setAttribute(RESERVATION_KEY, a, attributes);
		}

		// PoolID = Pool UID
		if (containsAttribute(POOLID_KEY, attributes))
		{
			NVM_UID poolUidStr;
			uid_copy(ns.pool_uid, poolUidStr);
			framework::Attribute a(poolUidStr, false);
			pInstance->setAttribute(POOLID_KEY, a, attributes);
		}

		// ResourceType = type
		if (containsAttribute(RESOURCETYPE_KEY, attributes))
		{
			framework::Attribute a(
					namespaceResourceTypeToValue(ns.type),
					namespaceResourceTypeToStr(ns.type), false);
			pInstance->setAttribute(RESOURCETYPE_KEY, a, attributes);
		}

		// Optimize = Btt
		if (containsAttribute(OPTIMIZE_KEY, attributes))
		{
			framework::Attribute a(
					NamespaceViewFactory::namespaceOptimizeToValue(ns.btt),
					NamespaceViewFactory::namespaceOptimizeToStr(ns.btt), false);
			pInstance->setAttribute(OPTIMIZE_KEY, a, attributes);
		}

		// ChangeableType = 0 - "Fixed � Not Changeable"
		if (containsAttribute(CHANGEABLETYPE_KEY, attributes))
		{
			framework::Attribute a(NSSETTINGS_CHANGEABLETYPE_NOTCHANGEABLETRANSIENT, false);
			pInstance->setAttribute(CHANGEABLETYPE_KEY, a, attributes);
		}
	
		// SecurityFeatures
                if (containsAttribute(ENCRYPTIONENABLED_KEY, attributes))
                {
                        pInstance->setAttribute(ENCRYPTIONENABLED_KEY,
                                framework::Attribute((NVM_UINT16)ns.security_features.encryption, false));
                }

                if (containsAttribute(ERASECAPABLE_KEY, attributes))
                {
                        pInstance->setAttribute(ERASECAPABLE_KEY,
                                framework::Attribute((NVM_UINT16)ns.security_features.erase_capable, false));
                }

		// ChannelInterleaveSize
		if (containsAttribute(CHANNELINTERLEAVESIZE_KEY, attributes))
		{
			NVM_UINT16 channelSize =
					(NVM_UINT16)mem_config::InterleaveSet::getExponentFromInterleaveSize(
								ns.interleave_format.channel);

			framework::Attribute a(channelSize, false);
			pInstance->setAttribute(CHANNELINTERLEAVESIZE_KEY, a, attributes);
		}

		// ControllerInterleaveSize
		if (containsAttribute(CONTROLLERINTERLEAVESIZE_KEY, attributes))
		{
			NVM_UINT16 channelSize =
					(NVM_UINT16)mem_config::InterleaveSet::getExponentFromInterleaveSize(
								ns.interleave_format.imc);

			framework::Attribute a(channelSize, false);
			pInstance->setAttribute(CONTROLLERINTERLEAVESIZE_KEY, a, attributes);
		}

		if (containsAttribute(MEMORYPAGEALLOCATION_KEY, attributes))
		{
			framework::Attribute a((NVM_UINT16)ns.memory_page_allocation,
				NamespaceViewFactory::namespaceMemoryPageAllocationToStr(ns.memory_page_allocation), false);
			pInstance->setAttribute(MEMORYPAGEALLOCATION_KEY, a, attributes);
		}

		// NOTE: No need to populate Parent, or InitialState - only for create
	}
	catch (framework::Exception &)
	{
		if (pInstance)
		{
			delete pInstance;
			pInstance = NULL;
		}
		throw;
	}

	return pInstance;
}
コード例 #22
0
/*
 * 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);
	struct pool *pPool = NULL;
	try
	{
		checkAttributes(attributes);

		pPool = getPool(path);
		struct nvm_capabilities capabilities = getNvmCapabilities();

		// ElementName = "Pool Capabilities for: " + pool UUID
		if (containsAttribute(ELEMENTNAME_KEY, attributes))
		{
			NVM_UID poolUidStr;
			uid_copy(pPool->pool_uid, poolUidStr);
			std::string elementNameStr = PMCAP_ELEMENTNAME + poolUidStr;
			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(pPool, capabilities.sw_capabilities.min_namespace_size);
			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(pPool);
			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 (pPool->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 (pPool->type == POOL_TYPE_PERSISTENT_MIRROR)
			{
				replicationList.push_back(PMCAP_REPLICATION_LOCAL);
			}
			framework::Attribute a(replicationList, false);
			pInstance->setAttribute(REPLICATION_KEY, a, attributes);
		}

		if (containsAttribute(MEMORYPAGEALLOCATIONCAPABLE_KEY, attributes))
		{
			framework::BOOLEAN capable = capabilities.sw_capabilities.namespace_memory_page_allocation_capable;
			framework::Attribute a(capable, false);
			pInstance->setAttribute(MEMORYPAGEALLOCATIONCAPABLE_KEY, a, attributes);
		}
		delete pPool;
	}
	catch (framework::Exception &) // clean up and re-throw
	{
		if (pInstance)
		{
			delete pInstance;
			pInstance = NULL;
		}
		if (pPool)
		{
			delete pPool;
			pPool = NULL;
		}
		throw;
	}

	return pInstance;
}
コード例 #23
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::memory::MemoryControllerFactory::getInstance(
	framework::ObjectPath &path, framework::attribute_names_t &attributes)
	throw (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);

		path.checkKey(CREATIONCLASSNAME_KEY, MEMORYCONTROLLER_CREATIONCLASSNAME);
		path.checkKey(SYSTEMCREATIONCLASSNAME_KEY, server::BASESERVER_CREATIONCLASSNAME);
		path.checkKey(SYSTEMNAME_KEY, server::getHostName());

		// extract the memory controller id from the object path
		framework::Attribute devIdAttr = path.getKeyValue(DEVICEID_KEY);
		COMMON_LOG_DEBUG_F("DeviceID: %s", devIdAttr.asStr().c_str());

		int rc = nvm_get_device_count();
		if (rc < NVM_SUCCESS)
		{
			throw exception::NvmExceptionLibError(rc);
		}
		else if (rc == 0)
		{
			throw framework::Exception(
					"Could not find any NVDIMMs connected to Memory Controller");
		}

		// get the device_discovery information for all of the dimms
		struct device_discovery dimms[rc];
		if ((rc = nvm_get_devices(dimms, rc)) < NVM_SUCCESS)
		{
			throw exception::NvmExceptionLibError(rc);
		}
		else if (rc == 0)
		{
			throw framework::Exception(
					"Could not find any NVDIMMs connected to Memory Controller");
		}

		// initialize indicator
		int instance_found = 0;
		// find the set of unique memory controller ids used across all DIMMs
		for (int i = 0; i < rc; i++)
		{
			// compare the current DIMM's mem controller to the one that we are searching for
			instance_found = (devIdAttr.stringValue().compare(
					generateUniqueMemoryControllerID(&(dimms[i]))) == 0);
			if (instance_found)
			{
				// if found, update pInstance
				MemoryControllerFactory::addNonKeyAttributesToInstance(
						pInstance, &attributes, &(dimms[i]));

				// break the loop since we found what we were looking for
				break;
			}
		}

		// handle failures
		if (!instance_found)
		{
			COMMON_LOG_ERROR_F("Device ID Not Found: %s", devIdAttr.stringValue().c_str());
			throw framework::ExceptionBadParameter(DEVICEID_KEY.c_str());
		}
	}
	catch (framework::Exception) // clean up and re-throw
	{
		delete pInstance;
		throw;
	}

	return pInstance;
}
コード例 #24
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::support::NVDIMMSensorViewFactory::getInstance(
		framework::ObjectPath &path, framework::attribute_names_t &attributes)
		throw (wbem::framework::Exception)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);

	framework::Instance *pInstance = new framework::Instance(path);

	try
	{
		// Get the sensorViewAttributes
		checkAttributes(attributes);

		framework::Attribute attribute = path.getKeyValue(DEVICEID_KEY);

		std::string guidStr;
		enum sensor_type type;
		if(!NVDIMMSensorFactory::splitDeviceIdAttribute(attribute, guidStr, (int &)type))
		{
			throw framework::ExceptionBadParameter(DEVICEID_KEY.c_str());
		}

		NVM_GUID guid;
		str_to_guid(guidStr.c_str(), guid);

		struct sensor sensor;
		int rc = NVM_SUCCESS;
		if ((rc = nvm_get_sensor(guid, type, &sensor)) != NVM_SUCCESS)
		{
			throw exception::NvmExceptionLibError(rc);
		}

		// DimmID = handle or guid depending on user selection
		if (containsAttribute(DIMMID_KEY, attributes))
		{
				framework::Attribute attrDimmId = physical_asset::NVDIMMFactory::guidToDimmIdAttribute(guidStr);
				pInstance->setAttribute(DIMMID_KEY, attrDimmId, attributes);
		}
		// DimmGUID
		if (containsAttribute(DIMMGUID_KEY, attributes))
		{
			framework::Attribute attrDimmHandle(guidStr, false);
			pInstance->setAttribute(DIMMGUID_KEY, attrDimmHandle, attributes);
		}
		// DimmHandle = NFIT Handle
		if (containsAttribute(DIMMHANDLE_KEY, attributes))
		{
			NVM_UINT32 handle;
			physical_asset::NVDIMMFactory::guidToHandle(guidStr, handle);
			framework::Attribute attrDimmHandle(handle, false);
			pInstance->setAttribute(DIMMHANDLE_KEY, attrDimmHandle, attributes);
		}
		if (containsAttribute(TYPE_KEY, attributes))
		{
			framework::Attribute a(getSensorNameStr(type), false);
			pInstance->setAttribute(TYPE_KEY, a, attributes);
		}
		if (containsAttribute(CURRENTVALUE_KEY, attributes))
		{
			std::stringstream currentValue;
			if (sensor.units == UNIT_SECONDS)
			{
				// convert to HH:MM:SS, note HH can grow beyond 2 digits which is fine.
				NVM_UINT64 hours, minutes, seconds, remainder = 0;
				// 60 seconds in a minute, 60 minutes in an hour
				hours = sensor.reading / (60*60);
				remainder = sensor.reading % (60*60);
				minutes = remainder / 60;
				seconds = remainder % 60;
				currentValue << std::setfill('0') << std::setw(2) << hours << ":";
				currentValue << std::setfill('0') << std::setw(2) << minutes << ":";
				currentValue << std::setfill('0') << std::setw(2) << seconds;
			}
			else if (sensor.type == SENSOR_MEDIA_TEMPERATURE || sensor.type == SENSOR_CONTROLLER_TEMPERATURE)
			{
				float celsius = nvm_decode_temperature(sensor.reading);
				currentValue << celsius << baseUnitToString(sensor.units);
			}
			else
			{
				NVM_INT32 scaled = 0;
				NVM_INT32 scaler = 0;
				NVDIMMSensorFactory::scaleNumberBaseTen(sensor.reading, &scaled, &scaler);
				currentValue << scaled << baseUnitToString(sensor.units);
				if (scaler > 0)
				{
					currentValue << "* 10 ^" << scaler;
				}
			}

			framework::Attribute a(currentValue.str(), false);
			pInstance->setAttribute(CURRENTVALUE_KEY, a, attributes);
		}
		if (containsAttribute(ENABLEDSTATE_KEY, attributes))
		{
			std::string enabledState;
			if ((sensor.type == SENSOR_MEDIA_TEMPERATURE) || (sensor.type == SENSOR_SPARECAPACITY)
				|| (sensor.type == SENSOR_CONTROLLER_TEMPERATURE))
			{
				enabledState = getEnabledStateStr(
						sensor.settings.enabled ? SENSOR_ENABLEDSTATE_ENABLED : SENSOR_ENABLEDSTATE_DISABLED);
			}
			else
			{
				enabledState = getEnabledStateStr(SENSOR_ENABLEDSTATE_NA);
			}
			framework::Attribute a(enabledState, false);
			pInstance->setAttribute(ENABLEDSTATE_KEY, a, attributes);
		}
		if (containsAttribute(LOWERTHRESHOLDCRITICAL_KEY, attributes))
		{
			framework::Attribute a(sensor.settings.lower_critical_threshold, false);
			pInstance->setAttribute(LOWERTHRESHOLDCRITICAL_KEY, a, attributes);
		}
		if (containsAttribute(UPPERTHRESHOLDCRITICAL_KEY, attributes))
		{
			if (sensor.type == SENSOR_MEDIA_TEMPERATURE || sensor.type == SENSOR_CONTROLLER_TEMPERATURE)
			{
				float celsius = nvm_decode_temperature(sensor.settings.upper_critical_threshold);
				pInstance->setAttribute(UPPERTHRESHOLDCRITICAL_KEY,
						framework::Attribute (celsius, false),
						attributes);
			}
			else
			{
				pInstance->setAttribute(UPPERTHRESHOLDCRITICAL_KEY,
						framework::Attribute (sensor.settings.upper_critical_threshold, false),
						attributes);
			}

		}
		if (containsAttribute(CURRENTSTATE_KEY, attributes))
		{
			framework::Attribute a(NVDIMMSensorFactory::getSensorStateStr(sensor.current_state), false);
			pInstance->setAttribute(CURRENTSTATE_KEY, a, attributes);
		}
		if (containsAttribute(SUPPORTEDTHRESHOLDS_KEY, attributes))
		{
			framework::STR_LIST supportedThresholds;
			if (sensor.lower_critical_support)
			{
				supportedThresholds.push_back(getThresholdTypeStr(SENSOR_LOWER_CRITICAL_THRESHOLD));
			}
			if (sensor.upper_critical_support)
			{
				supportedThresholds.push_back(getThresholdTypeStr(SENSOR_UPPER_CRITICAL_THRESHOLD));
			}
			framework::Attribute a(supportedThresholds, false);
			pInstance->setAttribute(SUPPORTEDTHRESHOLDS_KEY, a, attributes);
		}
		if (containsAttribute(SETTABLETHRESHOLDS_KEY, attributes))
		{
			framework::STR_LIST settableThresholds;
			if (sensor.lower_critical_settable)
			{
				settableThresholds.push_back(getThresholdTypeStr(SENSOR_LOWER_CRITICAL_THRESHOLD));
			}
			if (sensor.upper_critical_settable)
			{
				settableThresholds.push_back(getThresholdTypeStr(SENSOR_UPPER_CRITICAL_THRESHOLD));
			}
			framework::Attribute a(settableThresholds, false);
			pInstance->setAttribute(SETTABLETHRESHOLDS_KEY, a, attributes);
		}
	}
	catch (framework::Exception &) // clean up and re-throw
	{
		if (pInstance != NULL)
		{
			delete pInstance;
		}
		throw;
	}

	return pInstance;
}
コード例 #25
0
/*
 * Retrieve a specific instance given an object path
 */
wbem::framework::Instance* wbem::support::DiagnosticCompletionRecordFactory::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);

		// gather results
		bool diagFound = false;
		wbem::support::diagnosticResults_t results;
		DiagnosticLogFactory::gatherDiagnosticResults(&results);

		// match the instance ID
		framework::Attribute instanceID = path.getKeyValue(INSTANCEID_KEY);
		for (diagnosticResults_t::iterator iter = results.begin(); iter != results.end(); iter++)
		{
			struct diagnosticResult diag = *iter;
			std::stringstream instanceIdStr;
			instanceIdStr << DIAGNOSTICCOMPLETION_INSTANCEID << diag.id;
			if (instanceID.stringValue() == instanceIdStr.str())
			{
				diagFound = true;

				// ServiceName = Diagnostic Test Name
				if (containsAttribute(SERVICENAME_KEY, attributes))
				{
					std::string testName;
					switch (diag.type)
					{
						case EVENT_TYPE_DIAG_QUICK:
							testName = NVDIMMDIAGNOSTIC_TEST_QUICK;
							break;
						case EVENT_TYPE_DIAG_PLATFORM_CONFIG:
							testName = NVDIMMDIAGNOSTIC_TEST_PLATFORM;
							break;
						case EVENT_TYPE_DIAG_PM_META:
							testName = NVDIMMDIAGNOSTIC_TEST_STORAGE;
							break;
						case EVENT_TYPE_DIAG_SECURITY:
							testName = NVDIMMDIAGNOSTIC_TEST_SECURITY;
							break;
						case EVENT_TYPE_DIAG_FW_CONSISTENCY:
							testName = NVDIMMDIAGNOSTIC_TEST_SETTING;
							break;
						default:
							testName = "Unknown";
							break;
					}
					framework::Attribute serviceNameAttr(testName, false);
					pInstance->setAttribute(SERVICENAME_KEY, serviceNameAttr, attributes);
				}

				// ManagedElementName - Intel NVDIMM + UUID
				if (containsAttribute(MANAGEDELEMENTNAME_KEY, attributes))
				{
					std::string elementName = "";
					if (diag.device_uid)
					{
						NVM_UID uid_str;
						uid_copy(diag.device_uid, uid_str);
						elementName = wbem::physical_asset::NVDIMM_ELEMENTNAME_prefix + uid_str;
					}

					framework::Attribute dimmAttr(elementName, false);
					pInstance->setAttribute(MANAGEDELEMENTNAME_KEY, dimmAttr, attributes);
				}

				// CreationTimeStamp - record time stamp
				if (containsAttribute(CREATIONTIMESTAMP_KEY, attributes))
				{
					framework::Attribute timeAttr(diag.time,
									wbem::framework::DATETIME_SUBTYPE_DATETIME, false);
					pInstance->setAttribute(CREATIONTIMESTAMP_KEY, timeAttr, attributes);
				}

				// ErrorCode - Array of diagnostic result messages
				if (containsAttribute(ERRORCODE_KEY, attributes))
				{
					framework::Attribute msgsAttr(diag.messages, false);
					pInstance->setAttribute(ERRORCODE_KEY, msgsAttr, attributes);
				}

				// CompletionState - Combined result of diagnostic
				if (containsAttribute(COMPLETIONSTATE_KEY, attributes))
				{
					std::string stateStr;
					switch (diag.result)
					{
						case DIAGNOSTIC_RESULT_OK:
							stateStr = "OK";
							break;
						case DIAGNOSTIC_RESULT_WARNING:
							stateStr = "Warning";
							break;
						case DIAGNOSTIC_RESULT_FAILED:
							stateStr = "Failed";
							break;
						case DIAGNOSTIC_RESULT_ABORTED:
							stateStr = "Aborted";
							break;
						case DIAGNOSTIC_RESULT_UNKNOWN:
						default:
							stateStr = "Unknown";
							break;
					}
					framework::Attribute stateAttr((NVM_UINT16)diag.result, stateStr, false);
					pInstance->setAttribute(COMPLETIONSTATE_KEY, stateAttr, attributes);
				}

				break;
			} // end record found
		} // for

		if (!diagFound)
		{
			throw framework::ExceptionBadParameter(INSTANCEID_KEY.c_str());
		}
	}
	catch (framework::Exception) // clean up and re-throw
	{
		delete pInstance;
		throw;
	}

	return pInstance;
}