VirtualBox

Changeset 31737 in vbox for trunk/src/VBox/VMM/FTM.cpp


Ignore:
Timestamp:
Aug 17, 2010 2:51:12 PM (14 years ago)
Author:
vboxsync
Message:

FT updates

File:
1 edited

Legend:

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

    r31734 r31737  
    2121*******************************************************************************/
    2222#define LOG_GROUP LOG_GROUP_FTM
     23#include "FTMInternal.h"
     24#include <VBox/vm.h>
    2325#include <VBox/vmm.h>
    24 #include <VBox/vm.h>
    2526#include <VBox/err.h>
    2627#include <VBox/param.h>
    27 #include "FTMInternal.h"
     28#include <VBox/ssm.h>
    2829
    2930#include <iprt/assert.h>
     31#include <iprt/thread.h>
     32#include <iprt/string.h>
     33#include <iprt/mem.h>
    3034#include <VBox/log.h>
    3135
     36/**
     37 * Initializes the FTM.
     38 *
     39 * @returns VBox status code.
     40 * @param   pVM         The VM to operate on.
     41 */
     42VMMR3DECL(int) FTMR3Init(PVM pVM)
     43{
     44    /** @todo saved state for master nodes! */
     45    pVM->ftm.s.pszAddress     = NULL;
     46    pVM->fFaultTolerantMaster = false;
     47    return VINF_SUCCESS;
     48}
     49
     50/**
     51 * Terminates the FTM.
     52 *
     53 * Termination means cleaning up and freeing all resources,
     54 * the VM it self is at this point powered off or suspended.
     55 *
     56 * @returns VBox status code.
     57 * @param   pVM         The VM to operate on.
     58 */
     59VMMR3DECL(int) FTMR3Term(PVM pVM)
     60{
     61    if (pVM->ftm.s.pszAddress)
     62        RTMemFree(pVM->ftm.s.pszAddress);
     63
     64    return VINF_SUCCESS;
     65}
     66
     67/**
     68 * Thread function which starts syncing process for this master VM
     69 *
     70 * @param   Thread      The thread id.
     71 * @param   pvUser      Not used
     72 * @return  VINF_SUCCESS (ignored).
     73 *
     74 * @note Locks the Console object for writing.
     75 */
     76static DECLCALLBACK(int) ftmR3MasterThread(RTTHREAD Thread, void *pvUser)
     77{
     78    return VINF_SUCCESS;
     79}
    3280
    3381/**
     
    4896VMMR3DECL(int) FTMR3PowerOn(PVM pVM, bool fMaster, unsigned uInterval, const char *pszAddress, unsigned uPort)
    4997{
     98    int rc;
     99
    50100    VMSTATE enmVMState = VMR3GetState(pVM);
    51101    AssertMsgReturn(enmVMState == VMSTATE_POWERING_ON,
     
    53103                    VERR_INTERNAL_ERROR_4);
    54104
     105    pVM->ftm.s.uInterval  = uInterval;
     106    pVM->ftm.s.uPort      = uPort;
     107    pVM->ftm.s.pszAddress = RTStrDup(pszAddress);
    55108    if (fMaster)
    56109    {
     110        rc = RTThreadCreate(NULL, ftmR3MasterThread, NULL,
     111                            0, RTTHREADTYPE_IO /* higher than normal priority */, 0, "ftmR3MasterThread");
     112        if (RT_FAILURE(rc))
     113            return rc;
     114
     115        pVM->fFaultTolerantMaster = true;
    57116        return VMR3PowerOn(pVM);
    58117    }
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