- Timestamp:
- Aug 19, 2010 11:18:51 AM (14 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/FTM.cpp
r31770 r31782 48 48 VMMR3DECL(int) FTMR3Init(PVM pVM) 49 49 { 50 /* 51 * Assert alignment and sizes. 52 */ 53 AssertCompile(sizeof(pVM->ftm.s) <= sizeof(pVM->ftm.padding)); 54 AssertCompileMemberAlignment(FTM, CritSect, sizeof(uintptr_t)); 55 50 56 /** @todo saved state for master nodes! */ 51 57 pVM->ftm.s.pszAddress = NULL; … … 56 62 pVM->ftm.s.master.hShutdownEvent = NIL_RTSEMEVENT; 57 63 pVM->ftm.s.hSocket = NIL_RTSOCKET; 64 65 /* 66 * Initialize the PGM critical section. 67 */ 68 int rc = PDMR3CritSectInit(pVM, &pVM->ftm.s.CritSect, RT_SRC_POS, "FTM"); 69 AssertRCReturn(rc, rc); 70 71 STAM_REL_REG(pVM, &pVM->ftm.s.StatReceivedMem, STAMTYPE_COUNTER, "/FT/Received/Mem", STAMUNIT_BYTES, "The amount of memory pages that was received."); 72 STAM_REL_REG(pVM, &pVM->ftm.s.StatReceivedState, STAMTYPE_COUNTER, "/FT/Received/State", STAMUNIT_BYTES, "The amount of state information that was received."); 73 STAM_REL_REG(pVM, &pVM->ftm.s.StatSentMem, STAMTYPE_COUNTER, "/FT/Sent/Mem", STAMUNIT_BYTES, "The amount of memory pages that was sent."); 74 STAM_REL_REG(pVM, &pVM->ftm.s.StatSentState, STAMTYPE_COUNTER, "/FT/Sent/State", STAMUNIT_BYTES, "The amount of state information that was sent."); 75 58 76 return VINF_SUCCESS; 59 77 } … … 81 99 RTSemEventDestroy(pVM->ftm.s.master.hShutdownEvent); 82 100 101 PDMR3CritSectDelete(&pVM->ftm.s.CritSect); 83 102 return VINF_SUCCESS; 84 103 } … … 252 271 rc = ftmR3TcpReadACK(pVM, "password", "Invalid password"); 253 272 if (RT_SUCCESS(rc)) 273 { 274 /** todo: verify VM config. */ 254 275 break; 276 } 255 277 } 256 278 } … … 268 290 */ 269 291 292 for (;;) 293 { 294 rc = RTSemEventWait(pVM->ftm.s.master.hShutdownEvent, pVM->ftm.s.uInterval); 295 if (rc != VERR_TIMEOUT) 296 break; /* told to quit */ 297 } 270 298 return rc; 271 299 } … … 323 351 return VINF_SUCCESS; 324 352 353 /** todo: verify VM config. */ 354 325 355 /* 326 356 * Stop the server. … … 386 416 AssertReturn(pszAddress, VERR_INVALID_PARAMETER); 387 417 388 pVM->ftm.s.uInterval = uInterval; 389 pVM->ftm.s.uPort = uPort; 390 pVM->ftm.s.pszAddress = RTStrDup(pszAddress); 418 if (pVM->ftm.s.uInterval) 419 pVM->ftm.s.uInterval = uInterval; 420 else 421 pVM->ftm.s.uInterval = 50; /* standard sync interval of 50ms */ 422 423 pVM->ftm.s.uPort = uPort; 424 pVM->ftm.s.pszAddress = RTStrDup(pszAddress); 391 425 if (pszPassword) 392 pVM->ftm.s.pszPassword = RTStrDup(pszPassword);426 pVM->ftm.s.pszPassword = RTStrDup(pszPassword); 393 427 if (fMaster) 394 428 { … … 436 470 return RTTcpServerShutdown(pVM->ftm.s.standby.hServer); 437 471 } 472 473 474 /** 475 * Initiates a checkpoint update on the master node 476 * 477 * @returns VBox status code. 478 * 479 * @param pVM The VM to power on. 480 */ 481 VMMR3DECL(int) FTMR3Checkpoint(PVM pVM) 482 { 483 if (!pVM->fFaultTolerantMaster) 484 return VINF_SUCCESS; 485 486 return VERR_NOT_IMPLEMENTED; 487 } -
trunk/src/VBox/VMM/FTMInternal.h
r31770 r31782 22 22 #include <VBox/types.h> 23 23 #include <VBox/ftm.h> 24 #include <VBox/stam.h> 25 #include <VBox/pdmcritsect.h> 24 26 #include <iprt/tcp.h> 25 27 #include <iprt/semaphore.h> … … 39 41 /** Address of the standby VM. */ 40 42 char *pszAddress; 43 /** Password to access the syncing server of the standby VM. */ 44 char *pszPassword; 41 45 /** Port of the standby VM. */ 42 46 unsigned uPort; 43 /** Password to access the syncing server of the standby VM. */44 char *pszPassword;45 47 /** Syncing interval in ms. */ 46 48 unsigned uInterval; … … 48 50 /** Set when this VM is the standby FT node. */ 49 51 bool fIsStandbyNode; 52 bool fAlignment[7]; 50 53 51 54 /** Current active socket. */ … … 62 65 } master; 63 66 67 /** FTm critical section. 68 * This makes sure only the checkpoint or sync is active 69 */ 70 PDMCRITSECT CritSect; 71 72 STAMCOUNTER StatReceivedMem; 73 STAMCOUNTER StatReceivedState; 74 STAMCOUNTER StatSentMem; 75 STAMCOUNTER StatSentState; 64 76 } FTM; 65 77
Note:
See TracChangeset
for help on using the changeset viewer.