Changeset 41287 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 14, 2012 3:11:05 PM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxBalloonCtrl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModAPIMonitor.cpp
r41286 r41287 37 37 enum GETOPTDEF_APIMON 38 38 { 39 GETOPTDEF_APIMON_ISLN_RESPONSE = 3000, 39 GETOPTDEF_APIMON_GROUPS = 3000, 40 GETOPTDEF_APIMON_ISLN_RESPONSE, 40 41 GETOPTDEF_APIMON_ISLN_TIMEOUT, 41 GETOPTDEF_APIMON_ GROUPS42 GETOPTDEF_APIMON_TRIGGER_TIMEOUT 42 43 }; 43 44 … … 46 47 */ 47 48 static 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 } 51 53 }; 52 54 … … 69 71 static unsigned long g_ulAPIMonIslnTimeoutMS = 0; 70 72 static Bstr g_strAPIMonIslnLastBeat; 73 static unsigned long g_ulAPIMonTriggerTimeoutMS = 0; 71 74 static uint64_t g_uAPIMonIslnLastBeatMS = 0; 72 75 … … 223 226 { 224 227 /* Check if we are already paused. */ 225 MachineState_T machineState;226 228 CHECK_ERROR_BREAK(console, COMGETTER(State)(&machineState)); 227 229 /* The error code was lost by the previous instruction. */ … … 341 343 { 342 344 int rc2 = apimonMachineControl(it->first /* Uuid */, 343 &it->second /* Machine */, enmResp, 30 * 1000 /* 30s timeout */);345 &it->second /* Machine */, enmResp, g_ulAPIMonTriggerTimeoutMS); 344 346 if (RT_FAILURE(rc2)) 345 347 serviceLog("apimon: Controlling machine \"%ls\" (action: %s) failed with rc=%Rrc", … … 390 392 switch (c) 391 393 { 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 404 394 case GETOPTDEF_APIMON_GROUPS: 405 395 { … … 410 400 } 411 401 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 412 420 default: 413 421 rc = -1; /* We don't handle this option, skip. */ … … 426 434 { 427 435 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 }444 436 445 437 /* VM groups to watch for. */ … … 454 446 serviceLog("apimon: Warning: API monitor groups string invalid (%ls)\n", strValue.raw()); 455 447 } 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; 456 464 } 457 465 … … 469 477 } 470 478 } 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 471 496 } while (0); 472 497 … … 579 604 0 /* Not used */, 580 605 /* pszUsage. */ 606 " [--apimon-groups=<string>]\n" 581 607 " [--apimon-isln-response=<cmd>] [--apimon-isln-timeout=<ms>]\n" 582 " [--apimon- groups=<string>]\n",608 " [--apimon-trigger-timeout=<ms>]", 583 609 /* pszOptions. */ 610 "--apimon-groups Sets the VM groups for monitoring (none).\n" 584 611 "--apimon-isln-response Sets the isolation response (shutdown VM).\n" 585 612 "--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", 587 615 /* methods. */ 588 616 VBoxModAPIMonitorPreInit, -
trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxWatchdog.cpp
r41286 r41287 399 399 if (g_aModules[j].fEnabled) 400 400 { 401 intrc2 = g_aModules[j].pDesc->pfnOnMachineRegistered(strUuid);401 rc2 = g_aModules[j].pDesc->pfnOnMachineRegistered(strUuid); 402 402 if (RT_FAILURE(rc2)) 403 403 serviceLog("OnMachineRegistered: Module '%s' reported an error: %Rrc\n", … … 1087 1087 if (RT_FAILURE(rc)) 1088 1088 return RTMsgErrorExit(RTEXITCODE_FAILURE, "failed to open release log (%s, %Rrc)", szError, rc); 1089 AssertPtr(pLoggerReleaseFile);1090 1089 } 1091 1090 #endif
Note:
See TracChangeset
for help on using the changeset viewer.