Пример #1
0
bool PlannerThread::plan_init()
{
    checkPause();
    if (!resetPlanVars())
    {
        return false;
    }
    checkPause();
    if (!updateState())
    {
        return false;
    }
    checkPause();
    if (!loadState())
    {
        return false;
    }
    checkPause();
    if (!groundRules())
    {
        return false;
    }
    checkPause();
    if (!completePlannerState())
    {
        return false;
    }
    checkPause();
    if (!preserveState())
    {
        return false;
    }
    checkPause();
    if (!compileGoal())
    {
        return false;
    }
    checkPause(); 
    if (!loadRules())
    {
        return false;
    }
    checkPause();
    if (!preserveRules())
    {
        return false;
    }
    checkPause();
    if (!goalUpdate())
    {
        return false;
    }
    checkPause();
    if (!loadGoal())
    {
        return false;
    }
    checkPause();
    return true;
}
Пример #2
0
string PlannerThread::showCurrentGoal()
{
    if (!loadGoal())
    {
        return "failed";
    }
    string temp_str = "";
    for (int i = 0; i < goal.size(); ++i)
    {
        temp_str = temp_str + goal[i] + " ";
    }
    return temp_str; 
}
Пример #3
0
/*
 * Get all the BaseServer Instances from the wbem base server factory.
 */
cli::framework::ResultBase * cli::nvmcli::NamespaceFeature::run(
		const int &commandSpecId, const framework::ParsedCommand& parsedCommand)
{
	LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);
	framework::ResultBase *pResult = NULL;
	switch (commandSpecId)
	{
		case SHOW_CONFIG_GOAL:
			pResult = showConfigGoal(parsedCommand);
			break;
		case DELETE_CONFIG_GOAL:
			pResult = deleteConfigGoal(parsedCommand);
			break;
		case CREATE_GOAL:
			pResult = createGoal(parsedCommand);
			break;
		case SHOW_POOLS:
			pResult = showPools(parsedCommand);
			break;
		case DUMP_CONFIG:
			pResult = dumpConfig(parsedCommand);
			break;
		case LOAD_CONFIG_GOAL:
			pResult = loadGoal(parsedCommand);
			break;
		case SHOW_NAMESPACE:
			pResult = showNamespaces(parsedCommand);
			break;
		case DELETE_NAMESPACE:
			pResult = deleteNamespaces(parsedCommand);
			break;
		case CREATE_NAMESPACE:
			pResult = createNamespace(parsedCommand);
			break;
		case MODIFY_NAMESPACE:
			pResult = modifyNamespace(parsedCommand);
			break;
		default:
			pResult = new framework::NotImplementedErrorResult(commandSpecId, Name);
			break;
	}
	return pResult;

}
Пример #4
0
bool PlannerThread::planning_cycle()
{
    checkPause();
    if (!updateState())
    {
        return false;
    }
    checkPause();
    if (!completePlannerState())
    {
        return false;
    }
    checkPause();
    if (!loadState())
    {
        return false;
    }
    checkPause();
    if (compareState())
    {
        checkPause();
        if (!adaptRules())
        {
            return false;
        }
        checkPause();
    }
    checkPause();
    if (!goalUpdate())
    {
        return false;
    }
    checkPause();
    if (!loadGoal())
    {
        return false;
    }
    checkPause();
    if (!planCompletion())
    {
        return true;
    }
    checkPause();
    if (!checkHoldingSymbols())
    {
        checkPause();
        jumpBack();
        checkPause();
        if (!resetConfig())
        {
            return false;
        }
        checkPause();
    }
    else 
    {
        checkPause();
        if (checkGoalCompletion())
        {
            checkPause();
            if (!resetRules())
            {
                return false;
            }
            checkPause();
            if (!resetConfig())
            {
                return false;
            }
            checkPause();
            if (!loadRules())
            {
                return false;
            }
            checkPause();
            if (!jumpForward())
            {
                return false;
            }
            checkPause();
            return true;
        }
        checkPause();
        int flag_prada = PRADA();
        checkPause();
        if (flag_prada == 0)
        {
            return false;
        }
        else if (flag_prada == 2)
        {
            if (!increaseHorizon())
            {
                return false;
            }
            checkPause();
            return true;
        }
        if (!loadUsedObjs())
        {
            return false;
        }
        checkPause();
        if (!codeAction())
        {
            return false;
        }
        checkPause();
        if (!execAction())
        {
            return false;
        }
        checkPause();
        if (!preserveState())
        {
            return false;
        }
        checkPause();
        if (!checkFailure())
        {
            return false;
        }
        checkPause();
    }
    checkPause();
    return true;
}    
Пример #5
0
/*
 * Command Specs the Example Feature supports
 */
void cli::nvmcli::NamespaceFeature::getPaths(cli::framework::CommandSpecList &list)
{
	cli::framework::CommandSpec deleteConfigGoal(DELETE_CONFIG_GOAL,
			TR("Delete Memory Allocation Goal"), framework::VERB_DELETE,
			TR("Delete the memory allocation goal from one or more " NVM_DIMM_NAME "s."));
	deleteConfigGoal.addTarget(TARGET_DIMM.name, false, DIMMIDS_STR, true,
			TR("Delete the memory allocation goal from specific " NVM_DIMM_NAME "s by supplying one or more "
					"comma separated " NVM_DIMM_NAME " identifiers. The default is to delete the "
					"memory allocation goals from all manageable " NVM_DIMM_NAME "s."));
	deleteConfigGoal.addTarget(TARGET_GOAL_R);
	deleteConfigGoal.addTarget(TARGET_SOCKET.name, false, SOCKETIDS_STR, true,
			TR("Delete the memory allocation goal from the " NVM_DIMM_NAME "s on specific sockets "
			"by supplying the socket target and one or more comma-separated socket identifiers. "
			"The default is to delete the memory allocation goals from all manageable " NVM_DIMM_NAME "s on all sockets."));

	cli::framework::CommandSpec showConfigGoal(SHOW_CONFIG_GOAL,
			TR("Show Memory Allocation Goal"), framework::VERB_SHOW,
			TR("Show the memory allocation goal on one or more " NVM_DIMM_NAME "s. Once the goal is successfully applied "
					"by the BIOS, it is no longer displayed."));
	showConfigGoal.addOption(framework::OPTION_ALL);
	showConfigGoal.addOption(framework::OPTION_DISPLAY);
	showConfigGoal.addTarget(TARGET_DIMM.name, false, DIMMIDS_STR, true,
			TR("Restrict output to specific " NVM_DIMM_NAME "s by supplying one or more comma-separated " NVM_DIMM_NAME " "
			"identifiers. The default is to display all manageable " NVM_DIMM_NAME "s with memory allocation goals."));
	showConfigGoal.addTarget(TARGET_GOAL_R).isValueAccepted(false);
	showConfigGoal.addTarget(TARGET_SOCKET.name, false, SOCKETIDS_STR, true,
			TR("Restrict output to the " NVM_DIMM_NAME "s on specific sockets by supplying the socket target and "
				"one or more comma-separated socket identifiers. The default is to display all "
				"manageable " NVM_DIMM_NAME "s on all sockets with memory allocation goals."));

	framework::CommandSpec createGoal(CREATE_GOAL, TR("Create Memory Allocation Goal"),
			framework::VERB_CREATE, TR("Create a memory allocation goal on one or more " NVM_DIMM_NAME "s. "
				"This operation stores the specified goal on the " NVM_DIMM_NAME "(s) for the BIOS to "
				"read on the next reboot in order to map the " NVM_DIMM_NAME " capacity into the system "
				"address space."));
	createGoal.addOption(framework::OPTION_FORCE).helpText(TR("Reconfiguring " NVM_DIMM_NAME "s is a destructive operation "
			"which requires confirmation from the user. This option suppresses the confirmation."));;
	createGoal.addTarget(TARGET_DIMM)
			.isValueRequired(true)
			.helpText(TR("Create a memory allocation goal on specific " NVM_DIMM_NAME "s by "
				"supplying one or more comma-separated " NVM_DIMM_NAME " identifiers. "
				"This list must include all unconfigured " NVM_DIMM_NAME "s on the affected socket(s). "
				"The default is to configure all manageable " NVM_DIMM_NAME "s on all sockets."));
	createGoal.addTarget(TARGET_SOCKET)
			.isValueRequired(true)
			.helpText(TR("Create a memory allocation goal on the " NVM_DIMM_NAME "s on specific sockets by supplying the "
					"socket target and one or more comma-separated socket identifiers. The default is "
					"to configure all manageable " NVM_DIMM_NAME "s on all sockets."));
	createGoal.addTarget(TARGET_GOAL_R);
	createGoal.addProperty(MEMORYSIZE_PROPERTYNAME).isValueRequired(true)
		.valueText("GiB")
		.helpText(TR("Gibibytes of the requested " NVM_DIMM_NAME "s' capacity to use in Memory Mode or \"Remaining\" "
				"if all remaining unconfigured space is desired. Must be a multiple of the memory alignment "
				"size defined in Show System Capabilities."));
	createGoal.addProperty(APPDIRECTSIZE_PROPERTYNAME).isValueRequired(true)
		.valueText("GiB")
		.helpText(TR(APPDIRECT1SIZE_PROPERTYDESC.c_str()));
	createGoal.addProperty(APPDIRECTSETTINGS_PROPERTYNAME).isValueRequired(true)
		.valueText("value")
		.helpText(TR(APPDIRECT1SETTING_PROPERTYDESC.c_str()));
	createGoal.addProperty(APPDIRECT1SIZE_PROPERTYNAME).isValueRequired(true)
		.valueText("GiB")
		.helpText(TR(APPDIRECT1SIZE_PROPERTYDESC.c_str()));
	createGoal.addProperty(APPDIRECT1SETTINGS_PROPERTYNAME).isValueRequired(true)
		.valueText("value")
		.helpText(TR(APPDIRECT1SETTING_PROPERTYDESC.c_str()));
	createGoal.addProperty(APPDIRECT2SIZE_PROPERTYNAME).isValueRequired(true)
		.valueText("GiB")
		.helpText(TR(APPDIRECT2SIZE_PROPERTYDESC.c_str()));
	createGoal.addProperty(APPDIRECT2SETTINGS_PROPERTYNAME).isValueRequired(true)
		.valueText("value")
		.helpText(TR(APPDIRECT2SETTING_PROPERTYDESC.c_str()));
	createGoal.addProperty(RESERVEDIMM_PROPERTYNAME)
		.isValueRequired(true)
		.valueText("0|1")
		.helpText(TRS(RESERVEDIMM_PROPERTYDESC));
	createGoal.addProperty(STORAGECAPACITY_PROPERTYNAME)
		.isValueRequired(true)
		.valueText("Remaining")
		.helpText(TRS(STORAGECAPACITY_PROPERTYDESC));

	cli::framework::CommandSpec showNamespace(SHOW_NAMESPACE, TR("Show Namespace"), framework::VERB_SHOW,
			TR("Show information about one or more namespaces."));
	showNamespace.addOption(framework::OPTION_ALL);
	showNamespace.addOption(framework::OPTION_DISPLAY);
	showNamespace.addOption(framework::OPTION_UNITS).helpText(TR(NS_UNITS_OPTION_DESC.c_str()));
	showNamespace.addTarget(TARGET_NAMESPACE_R)
			.helpText(TR("Restrict output to specific namespaces by providing a comma separated list "
					"of one or more namespace identifiers. The default is to display all namespaces."));
	showNamespace.addTarget(TARGET_POOL)
			.isValueRequired(true)
			.helpText(TR("Restrict output to the namespaces on specific pools by supplying the pool "
					"target and one or more comma-separated pool identifiers. The default is to "
					"display namespaces on all pools."));
	showNamespace.addProperty(wbem::TYPE_KEY, false,
			wbem::pmem_config::NS_TYPE_STR_UNKNOWN + "|" + wbem::pmem_config::NS_TYPE_STR_APPDIRECT + "|" +
				wbem::pmem_config::NS_TYPE_STR_STORAGE, true,
			TR("Restrict output to namespaces of a specific type by supplying the Type property "
				"with the desired namespace type. The default is to display every type of namespace."));
	showNamespace.addProperty(wbem::HEALTHSTATE_KEY, false,
			wbem::pmem_config::NS_HEALTH_STR_UNKNOWN + "|" + wbem::pmem_config::NS_HEALTH_STR_NORMAL + "|" +
			wbem::pmem_config::NS_HEALTH_STR_WARN + "|" + wbem::pmem_config::NS_HEALTH_STR_ERR + "|" +
			wbem::pmem_config::NS_HEALTH_STR_BROKENMIRROR, true,
			TR("Restrict output to namespaces with a specific health state by supplying the "
				"HealthState property with the desired health state. The default is to display "
				"namespaces in every state."));

	cli::framework::CommandSpec createNamespace(CREATE_NAMESPACE, TR("Create Namespace"), framework::VERB_CREATE,
			TR("Create a new namespace from a persistent memory pool of " NVM_DIMM_NAME " capacity."));
	createNamespace.addOption(framework::OPTION_FORCE);
	createNamespace.addOption(framework::OPTION_UNITS).helpText(TR(NS_UNITS_OPTION_DESC.c_str()));
	createNamespace.addTarget(TARGET_NAMESPACE_R)
			.valueText("")
			.isValueAccepted(false)
			.helpText(TR("Create a new namespace. No filtering is supported on this target."));
	createNamespace.addTarget(TARGET_POOL).isValueRequired(false)
			.helpText(TR("The pool identifier on which to create the namespace."));
	createNamespace.addProperty(CREATE_NS_PROP_TYPE, true, "AppDirect|Storage", true,
			TR("The type of namespace to be created."));
	createNamespace.addProperty(CREATE_NS_PROP_BLOCKSIZE, false, "size", true,
			TR("The logical size in bytes for read/write operations. Must be one of the supported "
					"block sizes retrieved using the Show System Capabilities command."));
	createNamespace.addProperty(CREATE_NS_PROP_BLOCKCOUNT, false, "count", true,
			TR("The total number of blocks of memory that make up the namespace (BlockCount x BlockSize = Capacity)."));
	createNamespace.addProperty(CREATE_NS_PROP_FRIENDLYNAME, false, "string", true,
			TR("Optional user specified namespace name to more easily identify the namespace. Up to a maximum of 64 "
			"characters."));
	createNamespace.addProperty(CREATE_NS_PROP_OPTIMIZE, false, "CopyOnWrite|None", true,
			TR("If the namespace has CopyOnWrite optimization turned on after creation."));
	createNamespace.addProperty(CREATE_NS_PROP_ENABLED, false, "0|1|False|True", true,
			TR("Enable or disable the namespace after creation. "
					"A disabled namespace is hidden from the OS by the driver."));
	createNamespace.addProperty(CREATE_NS_PROP_ENCRYPTION, false, "0|1|False|True", true,
			TR("If the namespace has Encryption turned on after creation."));
	createNamespace.addProperty(CREATE_NS_PROP_ERASECAPABLE, false, "0|1|False|True", true,
			TR("If the namespace supports erase capability after creation."));
	createNamespace.addProperty(APPDIRECTSETTINGS_PROPERTYNAME, false, "value", true,
			TR("Create the namespace on persistent memory matching the "
					"specified quality of service attributes. Only applicable if the "
					"type is App Direct."));
	createNamespace.addProperty(CREATE_NS_PROP_CAPACITY, false, "capacity", true,
			TR("The size of the namespace in GB. Capacity and BlockCount are exclusive "
					"and therefore cannot be used together. Note: Capacity can only be provided "
					"as decimal gigabytes and not gibibytes (e.g. 16.7 GB vs 16 GiB)."));

	cli::framework::CommandSpec modifyNamespace(MODIFY_NAMESPACE, TR("Modify Namespace"), framework::VERB_SET,
			TR("Modify one or more existing namespaces."));
	modifyNamespace.addOption(framework::OPTION_FORCE);
	modifyNamespace.addTarget(TARGET_NAMESPACE_R).helpText(TR("Modify the settings on specific namespaces by "
			"providing comma separated list of one or more namespace identifiers. The default is to modify all namespaces."));
	modifyNamespace.addProperty(CREATE_NS_PROP_FRIENDLYNAME, false, "string", true,
			TR("Change the user specified namespace name up to a maximum of 64 characters."));
	modifyNamespace.addProperty("BlockCount", false, "count", true,
			TR("Change the total number of blocks of memory that make up in the namespace "
			"(BlockCount x BlockSize = Capacity)."));
	modifyNamespace.addProperty(CREATE_NS_PROP_ENABLED, false, "0|1", true,
			TR("Enable or disable the namespace.  A disabled namespace is hidden from the OS by the "
			"driver."));
	modifyNamespace.addProperty(CREATE_NS_PROP_CAPACITY, false, "capacity", true,
			TR("Change the size of the namespace."));

	cli::framework::CommandSpec deleteNamespace(DELETE_NAMESPACE, TR("Delete Namespace"), framework::VERB_DELETE,
			TR("Delete one or more existing namespaces. All data on the deleted namespace(s) becomes "
					"inaccessible."));
	deleteNamespace.addOption(framework::OPTION_FORCE);
	deleteNamespace.addTarget(TARGET_NAMESPACE_R).helpText(TR("Delete specific namespaces by providing "
			"a comma separated list of one or more namespace identifiers. The default is to "
			"delete all namespaces."));


	framework::CommandSpec showPools(SHOW_POOLS, TR("Show Persistent Memory"), framework::VERB_SHOW,
			TR("Retrieve a list of persistent memory pools of " NVM_DIMM_NAME " capacity."));
	showPools.addOption(framework::OPTION_DISPLAY);
	showPools.addOption(framework::OPTION_ALL);
	showPools.addOption(framework::OPTION_UNITS).helpText(TR("Change the units the pool capacities are displayed in."));
	showPools.addTarget(TARGET_POOL_R).helpText(TR("Restrict output to specific persistent "
			"memory pools by providing one or more comma-separated pool identifiers. "
			"The default is to display the persistent memory pools across all "
			"manageable " NVM_DIMM_NAME "s."));
	showPools.addTarget(TARGET_SOCKET).helpText(TR("Restrict output to the persistent memory "
			"pools on specific sockets by supplying the socket target and one or more "
			"comma-separated socket identifiers. The default is to display all sockets."));


	framework::CommandSpec dumpConfig(DUMP_CONFIG, TR("Dump Memory Allocation Settings"), framework::VERB_DUMP,
			TR("Store the currently configured memory allocation settings for all " NVM_DIMM_NAME "s in the "
					"system to a file in order to replicate the configuration elsewhere. Apply the stored "
					"memory allocation settings using the Load Memory Allocation Goal command."));
	dumpConfig.addOption(framework::OPTION_DESTINATION_R).helpText(TR("The file path in which to store "
			"the memory allocation settings. The resulting file will contain the memory allocation settings "
			"for all configured " NVM_DIMM_NAME "s in the system."));
	dumpConfig.addTarget(TARGET_SYSTEM_R).helpText(TR("The host system."))
			.isValueAccepted(false);
	dumpConfig.addTarget(TARGET_CONFIG_R).helpText(TR("The current " NVM_DIMM_NAME " memory allocation settings."))
			.isValueAccepted(false);


	framework::CommandSpec loadGoal(LOAD_CONFIG_GOAL, TR("Load Memory Allocation Goal"), framework::VERB_LOAD,
			TR("Load a memory allocation goal from a file onto one or more " NVM_DIMM_NAME "s."));
	loadGoal.addOption(framework::OPTION_FORCE).helpText(TR("Reconfiguring " NVM_DIMM_NAME "s is a destructive operation "
			"which requires confirmation from the user. This option suppresses the confirmation."));
	loadGoal.addOption(framework::OPTION_SOURCE_R).helpText(TR("File path of the stored configuration "
			"settings to load as a memory allocation goal."));
	loadGoal.addTarget(TARGET_GOAL_R).isValueAccepted(false);
	loadGoal.addTarget(TARGET_DIMM)
			.helpText(TR("Load the memory allocation goal to specific " NVM_DIMM_NAME "s "
			"by supplying one or more comma-separated " NVM_DIMM_NAME " identifiers. The default is to load the "
			"memory allocation goal onto all manageable " NVM_DIMM_NAME "s."))
			.isValueRequired(true);
	loadGoal.addTarget(TARGET_SOCKET).helpText(TR("Load the memory allocation goal onto all manageable " NVM_DIMM_NAME "s on "
			"specific sockets by supplying the socket target and one or more comma-separated socket identifiers. "
			"The default is to load the memory allocation goal onto all manageable " NVM_DIMM_NAME "s on all sockets."));

	list.push_back(showNamespace);
	list.push_back(createNamespace);
	list.push_back(modifyNamespace);
	list.push_back(deleteNamespace);
	list.push_back(showConfigGoal);
	list.push_back(deleteConfigGoal);
	list.push_back(createGoal);
	list.push_back(showPools);
	list.push_back(dumpConfig);
	list.push_back(loadGoal);
 }