VirtualBox

Changeset 31782 in vbox for trunk/src


Ignore:
Timestamp:
Aug 19, 2010 11:18:51 AM (14 years ago)
Author:
vboxsync
Message:

FT updates

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/FTM.cpp

    r31770 r31782  
    4848VMMR3DECL(int) FTMR3Init(PVM pVM)
    4949{
     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
    5056    /** @todo saved state for master nodes! */
    5157    pVM->ftm.s.pszAddress               = NULL;
     
    5662    pVM->ftm.s.master.hShutdownEvent    = NIL_RTSEMEVENT;
    5763    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
    5876    return VINF_SUCCESS;
    5977}
     
    8199        RTSemEventDestroy(pVM->ftm.s.master.hShutdownEvent);
    82100
     101    PDMR3CritSectDelete(&pVM->ftm.s.CritSect);
    83102    return VINF_SUCCESS;
    84103}
     
    252271                    rc = ftmR3TcpReadACK(pVM, "password", "Invalid password");
    253272                    if (RT_SUCCESS(rc))
     273                    {
     274                        /** todo: verify VM config. */
    254275                        break;
     276                    }
    255277                }
    256278            }
     
    268290     */
    269291
     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    }
    270298    return rc;
    271299}
     
    323351        return VINF_SUCCESS;
    324352
     353    /** todo: verify VM config. */
     354
    325355    /*
    326356     * Stop the server.
     
    386416    AssertReturn(pszAddress, VERR_INVALID_PARAMETER);
    387417
    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);
    391425    if (pszPassword)
    392         pVM->ftm.s.pszPassword = RTStrDup(pszPassword);
     426        pVM->ftm.s.pszPassword  = RTStrDup(pszPassword);
    393427    if (fMaster)
    394428    {
     
    436470    return RTTcpServerShutdown(pVM->ftm.s.standby.hServer);
    437471}
     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 */
     481VMMR3DECL(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  
    2222#include <VBox/types.h>
    2323#include <VBox/ftm.h>
     24#include <VBox/stam.h>
     25#include <VBox/pdmcritsect.h>
    2426#include <iprt/tcp.h>
    2527#include <iprt/semaphore.h>
     
    3941    /** Address of the standby VM. */
    4042    char               *pszAddress;
     43    /** Password to access the syncing server of the standby VM. */
     44    char               *pszPassword;
    4145    /** Port of the standby VM. */
    4246    unsigned            uPort;
    43     /** Password to access the syncing server of the standby VM. */
    44     char               *pszPassword;
    4547    /** Syncing interval in ms. */
    4648    unsigned            uInterval;
     
    4850    /** Set when this VM is the standby FT node. */
    4951    bool                fIsStandbyNode;
     52    bool                fAlignment[7];
    5053
    5154    /** Current active socket. */
     
    6265    } master;
    6366
     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;
    6476} FTM;
    6577
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