VirtualBox

Changeset 31753 in vbox


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

FT updates

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/ftm.h

    • Property svn:eol-style set to native
    • Property svn:keywords set to Author Date Id Revision
    r31743 r31753  
    4444VMMR3DECL(int) FTMR3Init(PVM pVM);
    4545VMMR3DECL(int) FTMR3Term(PVM pVM);
     46VMMR3DECL(int) FTMR3StandbyCancel(PVM pVM);
    4647
    4748#endif /* IN_RING3 */
  • trunk/src/VBox/VMM/FTM.cpp

    • Property svn:eol-style set to native
    • Property svn:keywords set to Author Date Id Revision
    r31743 r31753  
    4444{
    4545    /** @todo saved state for master nodes! */
    46     pVM->ftm.s.pszAddress     = NULL;
    47     pVM->ftm.s.pszPassword    = NULL;
    48     pVM->fFaultTolerantMaster = false;
     46    pVM->ftm.s.pszAddress       = NULL;
     47    pVM->ftm.s.pszPassword      = NULL;
     48    pVM->fFaultTolerantMaster   = false;
     49    pVM->ftm.s.fIsStandbyNode   = false;
     50    pVM->ftm.s.standby.hServer  = NULL;
    4951    return VINF_SUCCESS;
    5052}
     
    6567    if (pVM->ftm.s.pszPassword)
    6668        RTMemFree(pVM->ftm.s.pszPassword);
     69    if (pVM->ftm.s.standby.hServer)
     70        RTTcpServerDestroy(pVM->ftm.s.standby.hServer);
    6771
    6872    return VINF_SUCCESS;
     
    111115 * @param   fMaster     FT master or standby
    112116 * @param   uInterval   FT sync interval
    113  * @param   pszAddress  Master VM address
    114  * @param   uPort       Master VM port
    115  * @param   pszPassword FT password
     117 * @param   pszAddress  Standby VM address
     118 * @param   uPort       Standby VM port
     119 * @param   pszPassword FT password (NULL for none)
    116120 *
    117121 * @thread      Any thread.
     
    121125VMMR3DECL(int) FTMR3PowerOn(PVM pVM, bool fMaster, unsigned uInterval, const char *pszAddress, unsigned uPort, const char *pszPassword)
    122126{
    123     int rc;
     127    int rc = VINF_SUCCESS;
    124128
    125129    VMSTATE enmVMState = VMR3GetState(pVM);
     
    147151    {
    148152        /* standby */
    149         PRTTCPSERVER hServer;
    150 
    151         rc = RTTcpServerCreateEx(pszAddress, uPort, &hServer);
     153        rc = RTTcpServerCreateEx(pszAddress, uPort, &pVM->ftm.s.standby.hServer);
    152154        if (RT_FAILURE(rc))
    153155            return rc;
     156        pVM->ftm.s.fIsStandbyNode = true;
    154157
    155         rc = RTTcpServerListen(hServer, ftmR3StandbyServeConnection, pVM);
     158        rc = RTTcpServerListen(pVM->ftm.s.standby.hServer, ftmR3StandbyServeConnection, pVM);
    156159        /** @todo deal with the exit code to check if we should activate this standby VM. */
    157160
    158         RTTcpServerDestroy(hServer);
     161        RTTcpServerDestroy(pVM->ftm.s.standby.hServer);
     162        pVM->ftm.s.standby.hServer = NULL;
    159163    }
    160     return VERR_NOT_IMPLEMENTED;
     164    return rc;
    161165}
    162166
     167/**
     168 * Powers off the fault tolerant virtual machine (standby).
     169 *
     170 * @returns VBox status code.
     171 *
     172 * @param   pVM         The VM to power on.
     173 */
     174VMMR3DECL(int) FTMR3StandbyCancel(PVM pVM)
     175{
     176    AssertReturn(!pVM->fFaultTolerantMaster, VERR_NOT_SUPPORTED);
     177    Assert(pVM->ftm.s.standby.hServer);
     178
     179    return RTTcpServerShutdown(pVM->ftm.s.standby.hServer);
     180}
  • trunk/src/VBox/VMM/FTMInternal.h

    • Property svn:eol-style set to native
    • Property svn:keywords set to Author Date Id Revision
    r31743 r31753  
    2222#include <VBox/types.h>
    2323#include <VBox/ftm.h>
     24#include <iprt/tcp.h>
    2425
    2526
     
    3637typedef struct FTM
    3738{
    38     char       *pszAddress;
    39     char       *pszPassword;
    40     unsigned    uPort;
    41     unsigned    uInterval;
     39    /** Address of the standby VM. */
     40    char               *pszAddress;
     41    /** Port of the standby VM. */
     42    unsigned            uPort;
     43    /** Password to access the syncing server of the standby VM. */
     44    char               *pszPassword;
     45    /** Syncing interval in ms. */
     46    unsigned            uInterval;
     47
     48    /** Set when this VM is the standby FT node. */
     49    bool                fIsStandbyNode;
     50
     51    struct
     52    {
     53        PRTTCPSERVER    hServer;
     54    } standby;
    4255
    4356} FTM;
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