VirtualBox

Changeset 39988 in vbox


Ignore:
Timestamp:
Feb 3, 2012 4:23:24 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76098
Message:

VBoxBalloonCtrl: Update.

Location:
trunk/src/VBox/Frontends/VBoxBalloonCtrl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModAPIMonitor.cpp

    r39986 r39988  
    6060using namespace com;
    6161
    62 #define VBOX_MOD_APIMONITOR_NAME "apimonitor"
     62#define VBOX_MOD_APIMON_NAME "apimon"
    6363
    6464/**
    6565 * The module's RTGetOpt-IDs for the command line.
    6666 */
    67 enum GETOPTDEF_APIMONITOR
    68 {
    69     GETOPTDEF_APIMONITOR_GROUPS = 1000,
     67enum GETOPTDEF_APIMON
     68{
     69    GETOPTDEF_APIMON_ISLN_RESPONSE = 1000,
     70    GETOPTDEF_APIMON_ISLN_TIMEOUT,
     71    GETOPTDEF_APIMON_GROUPS
    7072};
    7173
     
    7476 */
    7577static const RTGETOPTDEF g_aAPIMonitorOpts[] = {
    76     { "--apimonitor-groups",         GETOPTDEF_APIMONITOR_GROUPS,         RTGETOPT_REQ_STRING }
     78    { "--apimon-isln-response",  GETOPTDEF_APIMON_ISLN_RESPONSE,  RTGETOPT_REQ_STRING },
     79    { "--apimon-isln-timeout",   GETOPTDEF_APIMON_ISLN_TIMEOUT,   RTGETOPT_REQ_UINT32 },
     80    { "--apimon-groups",         GETOPTDEF_APIMON_GROUPS,         RTGETOPT_REQ_STRING }
    7781};
     82
     83static unsigned long g_ulAPIMonIslnTimeoutMS = 0;
     84static Bstr g_strAPIMonGroups;
     85static Bstr g_strAPIMonIslnCmdResp;
    7886
    7987/* Callbacks. */
     
    105113        switch (c)
    106114        {
    107             case GETOPTDEF_APIMONITOR_GROUPS:
     115            case GETOPTDEF_APIMON_ISLN_RESPONSE:
     116                break;
     117
     118            case GETOPTDEF_APIMON_ISLN_TIMEOUT:
     119                g_ulAPIMonIslnTimeoutMS = ValueUnion.u32;
     120                if (g_ulAPIMonIslnTimeoutMS < 1000)
     121                    g_ulAPIMonIslnTimeoutMS = 1000;
     122                break;
     123
     124            case GETOPTDEF_APIMON_GROUPS:
    108125                break;
    109126
     
    119136static DECLCALLBACK(int) VBoxModAPIMonitorInit(void)
    120137{
    121     return VINF_SUCCESS; /* Nothing to do here right now. */
     138    HRESULT rc = S_OK;
     139
     140    do
     141    {
     142        Bstr bstrValue;
     143
     144        /* Host isolation timeout (in ms). */
     145        if (!g_ulAPIMonIslnTimeoutMS) /* Not set by command line? */
     146        {
     147            CHECK_ERROR_BREAK(g_pVirtualBox, GetExtraData(Bstr("VBoxInternal2/Watchdog/APIMonitor/IsolationTimeout").raw(),
     148                                                          bstrValue.asOutParam()));
     149            g_ulAPIMonIslnTimeoutMS = Utf8Str(bstrValue).toUInt32();
     150        }
     151        if (!g_ulAPIMonIslnTimeoutMS)
     152        {
     153             /* Default is 30 seconds timeout. */
     154            g_ulAPIMonIslnTimeoutMS = 30 * 1000;
     155        }
     156
     157        /* VM groups to watch for. */
     158        if (g_strAPIMonGroups.isEmpty()) /* Not set by command line? */
     159        {
     160            CHECK_ERROR_BREAK(g_pVirtualBox, GetExtraData(Bstr("VBoxInternal2/Watchdog/APIMonitor/Groups").raw(),
     161                                                          g_strAPIMonGroups.asOutParam()));
     162        }
     163
     164        /* Host isolation command response. */
     165        if (g_strAPIMonIslnCmdResp.isEmpty()) /* Not set by command line? */
     166        {
     167            CHECK_ERROR_BREAK(g_pVirtualBox, GetExtraData(Bstr("VBoxInternal2/Watchdog/APIMonitor/IsolationResponse").raw(),
     168                                                          g_strAPIMonIslnCmdResp.asOutParam()));
     169        }
     170    } while (0);
     171
     172    return SUCCEEDED(rc) ? VINF_SUCCESS : VERR_COM_IPRT_ERROR; /* @todo Find a better rc! */
    122173}
    123174
     
    163214{
    164215    /* pszName. */
    165     VBOX_MOD_APIMONITOR_NAME,
     216    VBOX_MOD_APIMON_NAME,
    166217    /* pszDescription. */
    167218    "API monitor for host isolation detection",
     
    171222    0 /* Not used */,
    172223    /* pszUsage. */
    173     " [--apimonitor-groups <string>]\n"
    174     ,
     224    " [--apimon-isln-response=<cmd>] [--apimon-isln-timeout=<ms>]\n"
     225    " [--apimon-groups=<string>]\n",
    175226    /* pszOptions. */
    176     "--apimonitor-groups    Sets the VM groups for monitoring (none).\n",
     227    "--apimon-isln-response   Sets the isolation response (shutdown VM).\n"
     228    "--apimon-isln-timeout    Sets the isolation timeout in ms (none).\n"
     229    "--apimon-groups          Sets the VM groups for monitoring (none).\n",
    177230    /* methods. */
    178231    VBoxModAPIMonitorPreInit,
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModBallooning.cpp

    r39986 r39988  
    542542    0 /* Not used */,
    543543    /* pszUsage. */
    544     " [--balloon-dec <MB>] [--balloon-groups <string>] [--balloon-inc <MB>]\n"
    545     " [--balloon-interval <ms>] [--balloon-lower-limit <MB>]\n"
    546     " [--balloon-max <MB>]\n",
     544    " [--balloon-dec=<MB>] [--balloon-groups=<string>] [--balloon-inc=<MB>]\n"
     545    " [--balloon-interval=<ms>] [--balloon-lower-limit=<MB>]\n"
     546    " [--balloon-max=<MB>]\n",
    547547    /* pszOptions. */
    548548    "--balloon-dec          Sets the ballooning decrement in MB (128 MB).\n"
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxWatchdog.cpp

    r39986 r39988  
    827827    for (unsigned j = 0; j < RT_ELEMENTS(g_aModules); j++)
    828828        if (g_aModules[j].pDesc->pszUsage)
    829             RTStrmPrintf(g_pStdErr, "%s\n", g_aModules[j].pDesc->pszUsage);
     829            RTStrmPrintf(g_pStdErr, "%s", g_aModules[j].pDesc->pszUsage);
    830830
    831831    RTStrmPrintf(g_pStdErr, "\n"
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette