VirtualBox

Changeset 41287 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
May 14, 2012 3:11:05 PM (13 years ago)
Author:
vboxsync
Message:

VBoxBalloonCtrl: Added "--apimon-trigger-timeout", build fix.

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

Legend:

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

    r41286 r41287  
    3737enum GETOPTDEF_APIMON
    3838{
    39     GETOPTDEF_APIMON_ISLN_RESPONSE = 3000,
     39    GETOPTDEF_APIMON_GROUPS = 3000,
     40    GETOPTDEF_APIMON_ISLN_RESPONSE,
    4041    GETOPTDEF_APIMON_ISLN_TIMEOUT,
    41     GETOPTDEF_APIMON_GROUPS
     42    GETOPTDEF_APIMON_TRIGGER_TIMEOUT
    4243};
    4344
     
    4647 */
    4748static const RTGETOPTDEF g_aAPIMonitorOpts[] = {
    48     { "--apimon-isln-response",  GETOPTDEF_APIMON_ISLN_RESPONSE,  RTGETOPT_REQ_STRING },
    49     { "--apimon-isln-timeout",   GETOPTDEF_APIMON_ISLN_TIMEOUT,   RTGETOPT_REQ_UINT32 },
    50     { "--apimon-groups",         GETOPTDEF_APIMON_GROUPS,         RTGETOPT_REQ_STRING }
     49    { "--apimon-groups",            GETOPTDEF_APIMON_GROUPS,         RTGETOPT_REQ_STRING },
     50    { "--apimon-isln-response",     GETOPTDEF_APIMON_ISLN_RESPONSE,  RTGETOPT_REQ_STRING },
     51    { "--apimon-isln-timeout",      GETOPTDEF_APIMON_ISLN_TIMEOUT,   RTGETOPT_REQ_UINT32 },
     52    { "--apimon-trigger-timeout",   GETOPTDEF_APIMON_ISLN_TIMEOUT,   RTGETOPT_REQ_UINT32 }
    5153};
    5254
     
    6971static unsigned long                g_ulAPIMonIslnTimeoutMS = 0;
    7072static Bstr                         g_strAPIMonIslnLastBeat;
     73static unsigned long                g_ulAPIMonTriggerTimeoutMS = 0;
    7174static uint64_t                     g_uAPIMonIslnLastBeatMS = 0;
    7275
     
    223226                        {
    224227                            /* Check if we are already paused. */
    225                             MachineState_T machineState;
    226228                            CHECK_ERROR_BREAK(console, COMGETTER(State)(&machineState));
    227229                            /* The error code was lost by the previous instruction. */
     
    341343            {
    342344                int rc2 = apimonMachineControl(it->first /* Uuid */,
    343                                                &it->second /* Machine */, enmResp, 30 * 1000 /* 30s timeout */);
     345                                               &it->second /* Machine */, enmResp, g_ulAPIMonTriggerTimeoutMS);
    344346                if (RT_FAILURE(rc2))
    345347                    serviceLog("apimon: Controlling machine \"%ls\" (action: %s) failed with rc=%Rrc",
     
    390392        switch (c)
    391393        {
    392             case GETOPTDEF_APIMON_ISLN_RESPONSE:
    393                 rc = apimonResponseToEnum(ValueUnion.psz, &g_enmAPIMonIslnResp);
    394                 if (RT_FAILURE(rc))
    395                     rc = -1; /* Option unknown. */
    396                 break;
    397 
    398             case GETOPTDEF_APIMON_ISLN_TIMEOUT:
    399                 g_ulAPIMonIslnTimeoutMS = ValueUnion.u32;
    400                 if (g_ulAPIMonIslnTimeoutMS < 1000) /* Don't allow timeouts < 1s. */
    401                     g_ulAPIMonIslnTimeoutMS = 1000;
    402                 break;
    403 
    404394            case GETOPTDEF_APIMON_GROUPS:
    405395            {
     
    410400            }
    411401
     402            case GETOPTDEF_APIMON_ISLN_RESPONSE:
     403                rc = apimonResponseToEnum(ValueUnion.psz, &g_enmAPIMonIslnResp);
     404                if (RT_FAILURE(rc))
     405                    rc = -1; /* Option unknown. */
     406                break;
     407
     408            case GETOPTDEF_APIMON_ISLN_TIMEOUT:
     409                g_ulAPIMonIslnTimeoutMS = ValueUnion.u32;
     410                if (g_ulAPIMonIslnTimeoutMS < 1000) /* Don't allow timeouts < 1s. */
     411                    g_ulAPIMonIslnTimeoutMS = 1000;
     412                break;
     413
     414            case GETOPTDEF_APIMON_TRIGGER_TIMEOUT:
     415                g_ulAPIMonTriggerTimeoutMS = ValueUnion.u32;
     416                if (g_ulAPIMonTriggerTimeoutMS < 5000) /* Don't allow timeouts < 5s. */
     417                    g_ulAPIMonTriggerTimeoutMS = 5000;
     418                break;
     419
    412420            default:
    413421                rc = -1; /* We don't handle this option, skip. */
     
    426434    {
    427435        Bstr strValue;
    428 
    429         /* Host isolation timeout (in ms). */
    430         if (!g_ulAPIMonIslnTimeoutMS) /* Not set by command line? */
    431         {
    432             CHECK_ERROR_BREAK(g_pVirtualBox, GetExtraData(Bstr("Watchdog/APIMonitor/IsolationTimeout").raw(),
    433                                                           strValue.asOutParam()));
    434             if (!strValue.isEmpty())
    435                 g_ulAPIMonIslnTimeoutMS = Utf8Str(strValue).toUInt32();
    436         }
    437         if (!g_ulAPIMonIslnTimeoutMS) /* Still not set? Use a default. */
    438         {
    439             serviceLogVerbose(("apimon: API monitor isolation timeout not given, defaulting to 30s\n"));
    440 
    441             /* Default is 30 seconds timeout. */
    442             g_ulAPIMonIslnTimeoutMS = 30 * 1000;
    443         }
    444436
    445437        /* VM groups to watch for. */
     
    454446                    serviceLog("apimon: Warning: API monitor groups string invalid (%ls)\n", strValue.raw());
    455447            }
     448        }
     449
     450        /* Host isolation timeout (in ms). */
     451        if (!g_ulAPIMonIslnTimeoutMS) /* Not set by command line? */
     452        {
     453            CHECK_ERROR_BREAK(g_pVirtualBox, GetExtraData(Bstr("Watchdog/APIMonitor/IsolationTimeout").raw(),
     454                                                          strValue.asOutParam()));
     455            if (!strValue.isEmpty())
     456                g_ulAPIMonIslnTimeoutMS = Utf8Str(strValue).toUInt32();
     457        }
     458        if (!g_ulAPIMonIslnTimeoutMS) /* Still not set? Use a default. */
     459        {
     460            serviceLogVerbose(("apimon: API monitor isolation timeout not given, defaulting to 30s\n"));
     461
     462            /* Default is 30 seconds timeout. */
     463            g_ulAPIMonIslnTimeoutMS = 30 * 1000;
    456464        }
    457465
     
    469477            }
    470478        }
     479
     480        /* Trigger timeout (in ms). */
     481        if (!g_ulAPIMonTriggerTimeoutMS) /* Not set by command line? */
     482        {
     483            CHECK_ERROR_BREAK(g_pVirtualBox, GetExtraData(Bstr("Watchdog/APIMonitor/TriggerTimeout").raw(),
     484                                                          strValue.asOutParam()));
     485            if (!strValue.isEmpty())
     486                g_ulAPIMonTriggerTimeoutMS = Utf8Str(strValue).toUInt32();
     487        }
     488        if (!g_ulAPIMonTriggerTimeoutMS) /* Still not set? Use a default. */
     489        {
     490            serviceLogVerbose(("apimon: API monitor trigger timeout not given, defaulting to 30s\n"));
     491
     492            /* Default is 30 seconds timeout. */
     493            g_ulAPIMonTriggerTimeoutMS = 30 * 1000;
     494        }
     495
    471496    } while (0);
    472497
     
    579604    0 /* Not used */,
    580605    /* pszUsage. */
     606    " [--apimon-groups=<string>]\n"
    581607    " [--apimon-isln-response=<cmd>] [--apimon-isln-timeout=<ms>]\n"
    582     " [--apimon-groups=<string>]\n",
     608    " [--apimon-trigger-timeout=<ms>]",
    583609    /* pszOptions. */
     610    "--apimon-groups        Sets the VM groups for monitoring (none).\n"
    584611    "--apimon-isln-response Sets the isolation response (shutdown VM).\n"
    585612    "--apimon-isln-timeout  Sets the isolation timeout in ms (30s).\n"
    586     "--apimon-groups        Sets the VM groups for monitoring (none).\n",
     613    "--apimon-trigger-timeout\n"
     614    "                       Sets the trigger timeout in ms (30s).\n",
    587615    /* methods. */
    588616    VBoxModAPIMonitorPreInit,
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxWatchdog.cpp

    r41286 r41287  
    399399            if (g_aModules[j].fEnabled)
    400400            {
    401                 int rc2 = g_aModules[j].pDesc->pfnOnMachineRegistered(strUuid);
     401                rc2 = g_aModules[j].pDesc->pfnOnMachineRegistered(strUuid);
    402402                if (RT_FAILURE(rc2))
    403403                    serviceLog("OnMachineRegistered: Module '%s' reported an error: %Rrc\n",
     
    10871087        if (RT_FAILURE(rc))
    10881088            return RTMsgErrorExit(RTEXITCODE_FAILURE, "failed to open release log (%s, %Rrc)", szError, rc);
    1089         AssertPtr(pLoggerReleaseFile);
    10901089    }
    10911090#endif
Note: See TracChangeset for help on using the changeset viewer.

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