******************************************************************************
*/
+/*
+ ******************************************************************************
+ * BEGIN ComponentMgr goodies.
+ */
+
+/**
+ * Defines the current poll interval (in seconds).
+ * This value is controlled by the componentMgr.poll-interval config file
+ * option.
+ */
+#define COMPONENTMGR_CONF_POLLINTERVAL "poll-interval"
+
+/**
+ * Name of section of configuration to be read from tools.conf.
+ */
+#define COMPONENTMGR_CONF_GROUPNAME "componentmgr"
+
+/**
+ * Defines the components managed by the componentMgr plugin.
+ * This value is controlled by the componentMgr.included config file option.
+ */
+#define COMPONENTMGR_CONF_INCLUDEDCOMPONENTS "included"
+
+/*
+ * END ComponentMgr goodies.
+ ******************************************************************************
+ */
+
/*
******************************************************************************
* BEGIN GuestStore upgrader goodies.
#include "componentMgrPlugin.h"
#include "str.h"
+#include "conf.h"
#include "vm_version.h"
#include "embed_version.h"
#include "vmtoolsd_version.h"
*
* @return
* Main ToolsAppCtx of the plugin.
+ *
*****************************************************************************
*/
*
* Side effects:
* Deletes the existing timeout source and recreates a new one.
+ *
*****************************************************************************
*/
}
if (pollInterval != 0) {
- if (pollInterval < COMPONENTMGR_POLL_INTERVAL) {
+ if (pollInterval < COMPONENTMGR_POLL_INTERVAL ||
+ pollInterval > (G_MAXINT / 1000)) {
g_warning("%s: Invalid poll interval. Using default %us.\n",
__FUNCTION__, COMPONENTMGR_POLL_INTERVAL);
pollInterval = COMPONENTMGR_POLL_INTERVAL;
COMPONENTMGR_CONF_POLLINTERVAL,
pollInterval);
- gComponentMgrTimeoutSource = g_timeout_source_new_seconds(pollInterval);
+ gComponentMgrTimeoutSource = g_timeout_source_new(pollInterval * 1000);
VMTOOLSAPP_ATTACH_SOURCE(ctx, gComponentMgrTimeoutSource,
ComponentMgrCb, ctx, NULL);
g_source_unref(gComponentMgrTimeoutSource);
*
* Side effects:
* None.
+ *
*****************************************************************************
*/
static gboolean
-ComponentMgrCb(gpointer data) //IN
+ComponentMgrCb(gpointer data) // IN
{
ToolsAppCtx *ctx = data;
*
* Side effects:
* None.
+ *
*****************************************************************************
*/
static void
-ComponentMgrPollLoop(ToolsAppCtx *ctx) //IN
+ComponentMgrPollLoop(ToolsAppCtx *ctx) // IN
{
gint pollInterval;
- gchar *listString = NULL;
+ gchar *listString;
pollInterval = VMTools_ConfigGetInteger(ctx->config,
- COMPONENTMGR_CONFGROUPNAME,
+ COMPONENTMGR_CONF_GROUPNAME,
COMPONENTMGR_CONF_POLLINTERVAL,
COMPONENTMGR_POLL_INTERVAL);
listString = VMTools_ConfigGetString(ctx->config,
- COMPONENTMGR_CONFGROUPNAME,
+ COMPONENTMGR_CONF_GROUPNAME,
COMPONENTMGR_CONF_INCLUDEDCOMPONENTS,
COMPONENTMGR_ALLCOMPONENTS);
*
* Side effects:
* None.
+ *
******************************************************************************
*/
static void
-ComponentMgrServerConfReload(gpointer src, // IN
- ToolsAppCtx *ctx, // IN
- gpointer data) // IN
+ComponentMgrServerConfReload(gpointer src, // IN
+ ToolsAppCtx *ctx, // IN
+ gpointer data) // IN
{
ComponentMgrPollLoop(ctx);
}
*
* Side effects:
* Reinitializes the plugin timeout source.
+ *
******************************************************************************
*/
*/
TOOLS_MODULE_EXPORT ToolsPluginData *
-ToolsOnLoad(ToolsAppCtx *ctx) // IN
+ToolsOnLoad(ToolsAppCtx *ctx) // IN
{
static ToolsPluginData regData = {
"componentMgr",
#include "util.h"
#include "guestApp.h"
#include "codeset.h"
+#include "conf.h"
/*
* current action to be run on the component.
*/
-static struct componentInfo components[] = {
+static struct ComponentInfo components[] = {
{SALT_MINION, TRUE, NOTINSTALLED, NULL, NULL, COMPONENTMGR_CHECK_STATUS_COUNT_DOWN, INVALIDACTION}
};
*/
const char*
-ComponentMgr_GetComponentName(int componentIndex) //IN
+ComponentMgr_GetComponentName(int componentIndex) // IN
{
return components[componentIndex].name;
}
*/
gboolean
-ComponentMgr_CheckAnyAsyncProcessRunning() //IN
+ComponentMgr_CheckAnyAsyncProcessRunning() // IN
{
int i;
for (i = 0; i < ARRAYSIZE(components); i++) {
- if (components[i].procInfo != NULL) {
- g_debug("%s: Component %s has an async process still running.\n",
- __FUNCTION__, components[i].name);
+ if (ComponentMgr_IsAsyncProcessRunning(i)) {
return TRUE;
}
}
return FALSE;
}
+
/*
*****************************************************************************
* ComponentMgr_IsAsyncProcessRunning --
*/
gboolean
-ComponentMgr_IsAsyncProcessRunning(int componentIndex) //IN
+ComponentMgr_IsAsyncProcessRunning(int componentIndex) // IN
{
if (components[componentIndex].procInfo != NULL) {
g_info("%s: Component %s has an async process still running.\n",
*
* Side effects:
* None.
+ *
*****************************************************************************
*/
void
-ComponentMgr_SetComponentAsyncProcInfo(asyncProcessInfo *asyncProcInfo,
- int componentIndex)
+ComponentMgr_SetComponentAsyncProcInfo(AsyncProcessInfo *asyncProcInfo, // IN
+ int componentIndex) // IN
{
ASSERT(components[componentIndex].procInfo == NULL);
components[componentIndex].procInfo = asyncProcInfo;
*/
void
-ComponentMgr_ResetComponentAsyncProcInfo(int componentIndex)
+ComponentMgr_ResetComponentAsyncProcInfo(int componentIndex) // IN
{
components[componentIndex].procInfo = NULL;
}
*/
void
-ComponentMgr_SetComponentGSourceTimer(GSource *componentTimer,
- int componentIndex)
+ComponentMgr_SetComponentGSourceTimer(GSource *componentTimer, // IN
+ int componentIndex) // IN
{
ASSERT(components[componentIndex].sourceTimer == NULL);
components[componentIndex].sourceTimer = componentTimer;
*/
void
-ComponentMgr_ResetComponentGSourceTimer(int componentIndex)
+ComponentMgr_ResetComponentGSourceTimer(int componentIndex) // IN
{
components[componentIndex].sourceTimer = NULL;
}
*/
static gchar*
-ComponentMgrGetScriptFullPath(const char *scriptName, //IN
- const char *componentDir) //IN
+ComponentMgrGetScriptFullPath(const char *scriptName, // IN
+ const char *componentDir) // IN
{
gchar *scriptInstallDir;
gchar *toolsInstallDir;
#else
toolsInstallDir = GuestApp_GetInstallPath();
scriptInstallDir = g_strdup_printf("%s%s%s%s%s%s%s", toolsInstallDir, DIRSEPS,
- COMPONENTMGR_CONFGROUPNAME, DIRSEPS,
+ COMPONENTMGR_DIRECTORY, DIRSEPS,
componentDir, DIRSEPS, scriptName);
#endif
*/
static char *
-ComponentMgrConstructCommandline(gchar *scriptPath, //IN
- const char *defaultArguments, //IN
- const char *mandatoryParams, //IN
- char* (*customizeAction)()) //IN
+ComponentMgrConstructCommandline(gchar *scriptPath, // IN
+ const char *defaultArguments, // IN
+ const char *mandatoryParams, // IN
+ char* (*customizeAction)()) // IN
{
char *commandline = NULL;
const char *mandatoryParamsExists = NULL;
// Customize the arguments for the specific action via the callback function
if (customizeAction != NULL) {
- g_info("%s: Customizing argumnets with function.\n", __FUNCTION__);
+ g_info("%s: Customizing arguments with function.\n", __FUNCTION__);
customArguments = customizeAction();
}
if (customArguments != NULL) {
mandatoryParamsExists = strstr(customArguments, mandatoryParams);
- if(mandatoryParamsExists == NULL) {
+ if (mandatoryParamsExists == NULL) {
commandline = Str_SafeAsprintf(NULL, "\"%s%s\" %s \"%s\" %s %s %s",
sysDir, powershellExecutable,
componentMgrExecutionPolicy,
#else
if (customArguments != NULL) {
mandatoryParamsExists = strstr(customArguments, mandatoryParams);
- if(mandatoryParamsExists == NULL) {
+ if (mandatoryParamsExists == NULL) {
commandline = Str_SafeAsprintf(NULL, "%s %s %s %s", scriptPath,
defaultArguments, customArguments,
mandatoryParams);
*/
char *
-ComponentMgr_CheckStatusCommandLine(int componentIndex)
+ComponentMgr_CheckStatusCommandLine(int componentIndex) // IN
{
- char *commandline = NULL;
+ char *commandline;
gchar *scriptFullPath;
/*
*/
static void
-ComponentMgrSetEnabledComponentInfo(const char *componentName, //IN
- gboolean enabled) //IN
+ComponentMgrSetEnabledComponentInfo(const char *componentName, // IN
+ gboolean enabled) // IN
{
int i;
+ gboolean componentFound = FALSE;
+
for (i = 0; i < ARRAYSIZE(components); i++) {
if (Str_Strcmp(components[i].name, componentName) == 0) {
- components[i].isEnabled = enabled;
+ components[i].isEnabled = enabled;
+ componentFound = TRUE;
break;
}
}
+
+ if (!componentFound) {
+ g_info("%s: Invalid component name %s.\n",
+ __FUNCTION__, componentName);
+ }
}
*/
void
-ComponentMgr_SetStatusComponentInfo(ToolsAppCtx *ctx, //IN
- int exitCode, //IN
- int componentIndex) //IN
+ComponentMgr_SetStatusComponentInfo(ToolsAppCtx *ctx, // IN
+ int exitCode, // IN
+ int componentIndex) // IN
{
gchar *msg;
gboolean status;
status = ComponentMgr_SendRpc(ctx, msg, NULL, NULL);
g_free(msg);
- if (!status) {
- g_info("%s: Error sending RPC message for setting laststatus.\n",
- __FUNCTION__);
- }
-
components[componentIndex].status = exitCode;
}
*/
static void
-ComponentMgrSetEnabledAllComponents(gboolean enabled)
+ComponentMgrSetEnabledAllComponents(gboolean enabled) // IN
{
int i;
for (i = 0; i < ARRAYSIZE(components); i++) {
- if (enabled) {
- components[i].isEnabled = TRUE;
- } else {
- components[i].isEnabled = FALSE;
- }
+ components[i].isEnabled = enabled;
}
}
*
* Side effects:
* None.
+ *
*****************************************************************************
*/
void
-ComponentMgr_ExecuteComponentAction(int componentIndex)
+ComponentMgr_ExecuteComponentAction(int componentIndex) // IN
{
gchar *scriptFullPath;
const char *action = NULL;
g_free(scriptFullPath);
if (commandline == NULL) {
+ g_info("%s: Construction of command line failed for component %s.\n",
+ __FUNCTION__, components[componentIndex].name);
return;
}
g_info("%s: Commandline %s to perform %s action on component %s.\n",
__FUNCTION__, commandline, action, components[componentIndex].name);
- ComponentMgr_AsynchrnousComponentActionStart(ComponentMgr_GetToolsAppCtx(),
- commandline, componentIndex);
+ ComponentMgr_AsynchronousComponentActionStart(ComponentMgr_GetToolsAppCtx(),
+ commandline, componentIndex);
free(commandline);
}
*/
static void
-ComponentMgrPublishKnownComponents(ToolsAppCtx *ctx)
+ComponentMgrPublishKnownComponents(ToolsAppCtx *ctx) // IN
{
int i;
DynBuf enabledComponents;
executionScripts[i].componentDirectory);
if (!File_Exists(scriptFullPath)) {
- g_info("%s: Script file for component %s does not exists "
+ g_info("%s: Script file for component %s does not exist "
"under path %s.\n", __FUNCTION__, components[i].name,
scriptFullPath);
g_free(scriptFullPath);
*/
static IncludedComponents
-ComponentMgrIncludedComponents(const char* componentString) //IN
+ComponentMgrIncludedComponents(const char* componentString) // IN
{
int i;
gchar **componentList = NULL;
*/
void
-ComponentMgr_UpdateComponentEnableStatus(ToolsAppCtx *ctx) //IN
+ComponentMgr_UpdateComponentEnableStatus(ToolsAppCtx *ctx) // IN
{
gchar *listString;
- char *context = NULL;
+ IncludedComponents included;
char *token;
+ char *context = NULL;
listString = VMTools_ConfigGetString(ctx->config,
- COMPONENTMGR_CONFGROUPNAME,
+ COMPONENTMGR_CONF_GROUPNAME,
COMPONENTMGR_CONF_INCLUDEDCOMPONENTS,
COMPONENTMGR_ALLCOMPONENTS);
- IncludedComponents included = ComponentMgrIncludedComponents(listString);
+ included = ComponentMgrIncludedComponents(listString);
switch (included) {
case ALLCOMPONENTS:
ComponentMgrSetEnabledAllComponents(TRUE);
* current action for the component and waits for status update counter
* to reach zero to run a check status operation if the component status
* and component action are not compliant.
- * If the component action and component status are compliant, it spins of
+ * If the component action and component status are compliant, it spins off
* an async check status operation.
*
* @param[in] ctx Tools application context.
*/
static void
-ComponentMgrCheckExecuteComponentAction(ToolsAppCtx *ctx, //IN
- int componentIndex, //IN
- const char *action) //IN
+ComponentMgrCheckExecuteComponentAction(ToolsAppCtx *ctx, // IN
+ int componentIndex, // IN
+ const char *action) // IN
{
- Action installaction;
- char* commandline = NULL;
+ char* commandline;
void (*callbackFunction)(int) = &ComponentMgr_ExecuteComponentAction;
+ Action installaction = INVALIDACTION;
/*
* It is possible at this stage, an async process for checkstatus or
- * present/absent action may be running for the component. In such a sceanrio
+ * present/absent action may be running for the component. In such a scenario
* the plugin shall not trigger any other async process.
*/
ASSERT(components[componentIndex].isEnabled);
- if (ComponentMgr_IsAsyncProcessRunning(componentIndex)) {
- return;
- }
+ ASSERT(!ComponentMgr_IsAsyncProcessRunning(componentIndex));
commandline = ComponentMgr_CheckStatusCommandLine(componentIndex);
if (commandline == NULL) {
* Before invoking any action for a component, we need to check the current
* status for that component. We run the pre configured script with pre
* configured check status arguments to the script.
- * An async process in spin off to perform check status of a component with
- * an option of sequenced operation after check status call.
+ * An async process will be spun off to perform check status of a component
+ * with an option of sequenced operation after check status call.
*/
g_debug("%s: Checking current status of component %s with commandline %s.\n",
__FUNCTION__, components[componentIndex].name, commandline);
/*
*****************************************************************************
- * ComponentMgr_DestroyAsyncProcess -
+ * ComponentMgr_DestroyAsyncProcess --
*
* Destroy and free any or all async process running for a component.
*
/*
*****************************************************************************
- * ComponentMgr_Destroytimers -
+ * ComponentMgr_Destroytimers --
*
* This function destroys the GSource timers for all components.
*
*/
void
-ComponentMgr_UpdateComponentStatus(ToolsAppCtx *ctx)
+ComponentMgr_UpdateComponentStatus(ToolsAppCtx *ctx) // IN
{
int i;
*/
void
-ComponentMgr_FreeAsyncProc(asyncProcessInfo *procInfo) //IN
+ComponentMgr_FreeAsyncProc(AsyncProcessInfo *procInfo) // IN
{
int componentIndex = procInfo->componentIndex;
#if defined(__linux__)
*/
static gboolean
-ComponentMgrCheckStatusMonitor(void *data)
+ComponentMgrCheckStatusMonitor(void *data) // IN
{
- int exitCode = -1;
+ ProcMgr_Pid procPid;
int componentIndex;
- const char *componentName = NULL;
+ const char *componentName;
void (*callbackFunction)(int compIndex) = NULL;
- asyncProcessInfo *procInfo = (asyncProcessInfo*)data;
+ AsyncProcessInfo *procInfo = (AsyncProcessInfo*)data;
ASSERT(procInfo->asyncProc != NULL);
/*
* the remaining execution time for the component.
*/
procInfo->backoffTimer -= COMPONENTMGR_ASYNC_CHECK_STATUS_POLL_INTERVAL;
- ProcMgr_Pid procPid = ProcMgr_GetPid(procInfo->asyncProc);
+ procPid = ProcMgr_GetPid(procInfo->asyncProc);
componentIndex = procInfo->componentIndex;
componentName = ComponentMgr_GetComponentName(componentIndex);
componentName, procInfo->backoffTimer);
if (!ProcMgr_IsAsyncProcRunning(procInfo->asyncProc)) {
+ int exitCode = -1;
#if defined(__linux__)
if (ProcMgr_GetExitCode(procInfo->asyncProc, &exitCode) || exitCode == -1) {
exitCode = SCRIPTFAILED;
}
#else
- if (ProcMgr_GetExitCode(procInfo->asyncProc, &exitCode)) {
+ if (ProcMgr_GetExitCode(procInfo->asyncProc, &exitCode)) {
exitCode = SCRIPTFAILED;
- }
+ }
#endif
g_debug("%s: Checking status of a component has terminated gracefully"
" with exit code %d.\n", __FUNCTION__, exitCode);
*/
static gboolean
-ComponentMgrProcessMonitor(void *data)
+ComponentMgrProcessMonitor(void *data) // IN
{
- char *commandline = NULL;
+ ProcMgr_Pid procPid;
int componentIndex;
- const char *componentName = NULL;
+ char *commandline;
+ const char *componentName;
- asyncProcessInfo *procInfo = (asyncProcessInfo*)data;
+ AsyncProcessInfo *procInfo = (AsyncProcessInfo*)data;
ASSERT(procInfo->asyncProc != NULL);
procInfo->backoffTimer -= COMPONENTMGR_ASYNCPROCESS_POLL_INTERVAL;
- ProcMgr_Pid procPid = ProcMgr_GetPid(procInfo->asyncProc);
+ procPid = ProcMgr_GetPid(procInfo->asyncProc);
componentIndex = procInfo->componentIndex;
componentName = ComponentMgr_GetComponentName(componentIndex);
*****************************************************************************
*/
-static asyncProcessInfo*
-ComponentMgrCreateAsyncProcessInfo(ProcMgr_AsyncProc *asyncProc,
- ToolsAppCtx *ctx,
- int backoffTimer,
- int componentIndex,
- void (*callbackFunction)(int componentIndex))
+static AsyncProcessInfo*
+ComponentMgrCreateAsyncProcessInfo(ProcMgr_AsyncProc *asyncProc, // IN
+ ToolsAppCtx *ctx, // IN
+ int backoffTimer, // IN
+ int componentIndex, // IN
+ void (*callbackFunction)(int componentIndex)) // IN
{
- asyncProcessInfo *procInfo;
+ AsyncProcessInfo *procInfo;
procInfo = g_malloc(sizeof *procInfo);
procInfo->asyncProc = asyncProc;
procInfo->ctx = ctx;
*/
void
-ComponentMgr_AsynchronousComponentCheckStatus(ToolsAppCtx *ctx,
- char *commandline,
- int componentIndex,
- void (*callback)(int compIndex))
+ComponentMgr_AsynchronousComponentCheckStatus(ToolsAppCtx *ctx, // IN
+ const char *commandline, // IN
+ int componentIndex, // IN
+ void (*callback)(int compIndex)) // IN
{
ProcMgr_ProcArgs userArgs;
GSource *sourceTimer;
- asyncProcessInfo *procInfo;
+ AsyncProcessInfo *procInfo;
+ ProcMgr_AsyncProc *asyncProc;
/*
* If an async process is already running for the component.
ASSERT(!ComponentMgr_IsAsyncProcessRunning(componentIndex));
memset(&userArgs, 0, sizeof userArgs);
- ProcMgr_AsyncProc *asyncProc = ProcMgr_ExecAsync(commandline, &userArgs);
+ asyncProc = ProcMgr_ExecAsync(commandline, &userArgs);
if (asyncProc == NULL) {
g_warning("%s: Failed to create process", __FUNCTION__);
return;
/*
*****************************************************************************
- * ComponentMgr_AsynchrnousComponentActionStart --
+ * ComponentMgr_AsynchronousComponentActionStart --
*
* This function invokes the component script as an async process to perform
* present/absent action and a GSource timer to poll the progress.
*/
void
-ComponentMgr_AsynchrnousComponentActionStart(ToolsAppCtx *ctx,
- char *commandline,
- int componentIndex)
+ComponentMgr_AsynchronousComponentActionStart(ToolsAppCtx *ctx, // IN
+ const char *commandline, // IN
+ int componentIndex) // IN
{
ProcMgr_ProcArgs userArgs;
GSource *sourceTimer;
- asyncProcessInfo *procInfo;
+ AsyncProcessInfo *procInfo;
+ ProcMgr_AsyncProc *asyncProc;
/*
* If an async process is already running for the component.
ASSERT(!ComponentMgr_IsAsyncProcessRunning(componentIndex));
memset(&userArgs, 0, sizeof userArgs);
- ProcMgr_AsyncProc *asyncProc = ProcMgr_ExecAsync(commandline, &userArgs);
+ asyncProc = ProcMgr_ExecAsync(commandline, &userArgs);
if (asyncProc == NULL) {
g_warning("%s: Failed to create process", __FUNCTION__);
return;
*
* This file contains macros used by the componentMgr plugin having references
* for timer related information, guestVar information, component information
- * and configuration realted information.
+ * and configuration related information.
* Defines functions shared across the componentMgr plugin.
* Defines states structures to be used to cache and store information related
* to a component and async process.
#endif
-//********************** Configuration Params Definitions *************
-
-/*
- * Defines the current poll interval (in seconds).
- * This value is controlled by the ComponentMgr.poll-interval config file option.
- */
-#define COMPONENTMGR_CONF_POLLINTERVAL "poll-interval"
-
-/**
- * Name of section of configuration to be read from tools.conf.
- */
-#define COMPONENTMGR_CONFGROUPNAME "componentMgr"
-
-/**
- * Defines the components managed by the componentMgr plugin.
- * This value is controlled by the componentMgr.included config file option.
- */
-#define COMPONENTMGR_CONF_INCLUDEDCOMPONENTS "included"
-
//********************** Timer Definitions ****************************
/**
//********************** Component Action Definitions *********************
+/**
+ * Defines check status action on the component.
+ */
+#define COMPONENTMGR_COMPONENTCHECKSTATUS "checkstatus"
+
+/**
+ * Defines an invalid action on the component.
+ */
+#define COMPONENTMGR_COMPONENINVALIDACTION "invalidaction"
+
/**
* Defines present action for a component to be installed on a system.
*/
//********************** Component Definitions *********************
+/**
+ * Defines the directory for the plugin to host the scripts.
+ */
+#define COMPONENTMGR_DIRECTORY "componentMgr"
+
/**
* Defines none to indicate no component is managed by the plugin.
*/
{
PRESENT, /* The action adds/installs the components on the guest. */
ABSENT, /* The action removes/uninstalls the components on the guest.*/
- CHECKSTATUS, /* The actions calls the preconfigured script to check the
+ CHECKSTATUS, /* The action calls the preconfigured script to check the
current status of the component. */
INVALIDACTION /* Action not recongnised by the plugin. */
} Action;
* for a particular component.
*/
-typedef struct asyncProcessInfo {
+typedef struct AsyncProcessInfo {
ProcMgr_AsyncProc *asyncProc; /* ProcMgr_AsyncProc structure consisting of
the process data running an action on the
component. */
void (*callbackFunction)(int componentIndex); /* A callback function to
sequence a new operation
*/
-} asyncProcessInfo;
+} AsyncProcessInfo;
/*
* managed by the plugin. The component states is maintained in this structure.
*/
-typedef struct componentInfo
+typedef struct ComponentInfo
{
const char *name; /* The name of the component. */
gboolean isEnabled; /* Component enabled/disabled by the plugin. */
InstallStatus status; /* Contains current status of the component. */
GSource *sourceTimer; /* A GSource timer for async process monitoring running
an operation for a component. */
- asyncProcessInfo *procInfo; /* A structure to store information about the
+ AsyncProcessInfo *procInfo; /* A structure to store information about the
* current running async process for a component.
*/
int statuscount; /* A counter value to store max number of times to
*/
Action action; /* Contains information about the action to be
performed on a component. */
-} componentInfo;
+} ComponentInfo;
void
void
-ComponentMgr_AsynchrnousComponentActionStart(ToolsAppCtx *ctx,
- char *commandline,
- int componetIndex);
+ComponentMgr_AsynchronousComponentActionStart(ToolsAppCtx *ctx,
+ const char *commandline,
+ int componetIndex);
void
void
ComponentMgr_AsynchronousComponentCheckStatus(ToolsAppCtx *ctx,
- char *commandline,
+ const char *commandline,
int componentIndex,
void (*callback)(int compIndex));
void
-ComponentMgr_SetComponentAsyncProcInfo(asyncProcessInfo *asyncProcInfo,
+ComponentMgr_SetComponentAsyncProcInfo(AsyncProcessInfo *asyncProcInfo,
int componentIndex);
void
-ComponentMgr_FreeAsyncProc(asyncProcessInfo *procInfo);
+ComponentMgr_FreeAsyncProc(AsyncProcessInfo *procInfo);
void
*
* Side effects:
* None.
+ *
******************************************************************************
*/
gboolean
-ComponentMgr_SendRpc(ToolsAppCtx *ctx, //IN
- const char *guestInfoCmd,//IN
- char **outBuffer, //OUT
- size_t *outBufferLen) //OUT
+ComponentMgr_SendRpc(ToolsAppCtx *ctx, // IN
+ const char *guestInfoCmd, // IN
+ char **outBuffer, // OUT
+ size_t *outBufferLen) // OUT
{
gboolean status;
size_t replyLen;
/*
**************************************************************************
- * ComponentMgr_GetComponentInstallStatus
+ * ComponentMgr_GetComponentInstallStatus --
*
* This function returns an enum equivalent of the current status of the
* component.
*/
const char*
-ComponentMgr_GetComponentInstallStatus(InstallStatus installStatus) //IN
+ComponentMgr_GetComponentInstallStatus(InstallStatus installStatus) // IN
{
switch (installStatus) {
case NOTINSTALLED: return "NOTINSTALLED";
/*
**************************************************************************
- * ComponentMgr_GetComponentAction
+ * ComponentMgr_GetComponentAction --
*
* This function returns an enum equivalent of component action to be executed.
*
*/
const char*
-ComponentMgr_GetComponentAction(Action action) //IN
+ComponentMgr_GetComponentAction(Action action) // IN
{
switch (action) {
- case PRESENT: return "present";
- case ABSENT: return "absent";
- case CHECKSTATUS: return "checkstatus";
- case INVALIDACTION: return "invalidaction";
+ case PRESENT: return COMPONENTMGR_COMPONENTPRESENT;
+ case ABSENT: return COMPONENTMGR_COMPONENTABSENT;
+ case CHECKSTATUS: return COMPONENTMGR_COMPONENTCHECKSTATUS;
+ case INVALIDACTION: return COMPONENTMGR_COMPONENINVALIDACTION;
}
- return NULL;
+ return COMPONENTMGR_COMPONENINVALIDACTION;
}
const char*
-ComponentMgr_GetIncludedComponents(IncludedComponents specialValue)
+ComponentMgr_GetIncludedComponents(IncludedComponents specialValue) // IN
{
- switch(specialValue)
- {
+ switch (specialValue) {
case ALLCOMPONENTS: return "ALLCOMPONENTS";
case NONECOMPONENTS: return "NONECOMPONENTS";
- default: return "NOSPECIALVALUES";
+ case NOSPECIALVALUES: return "NOSPECIALVALUES";
}
return "NOSPECIALVALUES";
}
*
* Side effects:
* None.
+ *
*****************************************************************************
*/
void
-ComponentMgr_PublishAvailableComponents(ToolsAppCtx *ctx,
- const char *components)
+ComponentMgr_PublishAvailableComponents(ToolsAppCtx *ctx, // IN
+ const char *components) // IN
{
gboolean status;
gchar *msg = g_strdup_printf("%s.%s %s", COMPONENTMGR_PUBLISH_COMPONENTS,
status = ComponentMgr_SendRpc(ctx, msg, NULL, NULL);
g_free(msg);
-
- if (!status) {
- g_info("%s: Error sending RPC message for known components.\n",
- __FUNCTION__);
- }
}
# whether to include reserved space in diskInfo space metrics on Linux
#diskinfo-include-reserved=false
-[componentMgr]
+[componentmgr]
# This plugin manages the known and enabled components add/remove status.
# The plugin polls at regular interval and triggers action add/remove for
# Default and minimum polling interval in seconds (0 => polling disabled)
#poll-interval=180
-# Comma separated list of components managed by the plugin. If not specified, default value is all, which means all components and enabled by default. A special value of none means no component, which is equivalent to disabling the plugin completely. Value is parsed left to right and parsing stops at first occurrence of all or none or end of line.
+# Comma separated list of components managed by the plugin. If not specified,
+# default value is all, which means all components are enabled by default.
+# A special value of none means no component, which is equivalent to disabling
+# the plugin completely. Value is parsed left to right and parsing stops at
+# first occurrence of all or none or end of line.
#included=all
[appinfo]