VirtualBox

Changeset 31706 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Aug 16, 2010 3:27:24 PM (14 years ago)
Author:
vboxsync
Message:

More FT state change work

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r31698 r31706  
    215215          mConfigConstructor(NULL),
    216216          mStartPaused(false),
    217           mTeleporterEnabled(FALSE)
     217          mTeleporterEnabled(FALSE),
     218          mFaultToleranceSyncEnabled(FALSE)
    218219    {}
    219220
     
    223224    bool mStartPaused;
    224225    BOOL mTeleporterEnabled;
     226    BOOL mFaultToleranceSyncEnabled;
    225227
    226228    /* array of progress objects for hard disk reset operations */
     
    16621664            }
    16631665            return setError(VBOX_E_INVALID_VM_STATE, tr("Cannot power down at this point in a live snapshot"));
     1666
     1667        /* Try cancel the FT sync. */
     1668        case MachineState_FaultTolerantSyncing:
     1669            if (!mptrCancelableProgress.isNull())
     1670            {
     1671                HRESULT hrc = mptrCancelableProgress->Cancel();
     1672                if (SUCCEEDED(hrc))
     1673                    break;
     1674            }
     1675            return setError(VBOX_E_INVALID_VM_STATE, tr("Cannot power down at this point in a fault tolerant sync"));
    16641676
    16651677        /* extra nice error message for a common case */
     
    52005212#endif
    52015213
     5214    /* test the FaultToleranceState property  */
     5215    FaultToleranceState_T enmFaultToleranceState;
     5216    rc = mMachine->COMGETTER(FaultToleranceState)(&enmFaultToleranceState);
     5217    if (FAILED(rc)) return rc;
     5218    BOOL fFaultToleranceSyncEnabled = (enmFaultToleranceState == FaultToleranceState_Target);
     5219
    52025220    /* create a progress object to track progress of this operation */
    52035221    ComObjPtr<Progress> powerupProgress;
     
    52085226    else if (fTeleporterEnabled)
    52095227        progressDesc = tr("Teleporting virtual machine");
     5228    else if (fFaultToleranceSyncEnabled)
     5229        progressDesc = tr("Fault Tolerance syncing of remote virtual machine");
    52105230    else
    52115231        progressDesc = tr("Starting virtual machine");
    5212     if (mMachineState == MachineState_Saved || !fTeleporterEnabled)
     5232    if (    mMachineState == MachineState_Saved
     5233        ||  !fTeleporterEnabled)
    52135234        rc = powerupProgress->init(static_cast<IConsole *>(this),
    52145235                                   progressDesc,
    52155236                                   FALSE /* aCancelable */);
    52165237    else
     5238    if (fTeleporterEnabled)
    52175239        rc = powerupProgress->init(static_cast<IConsole *>(this),
    52185240                                   progressDesc,
     
    52235245                                   1    /* ulFirstOperationWeight */,
    52245246                                   NULL);
     5247    else
     5248    if (fFaultToleranceSyncEnabled)
     5249        rc = powerupProgress->init(static_cast<IConsole *>(this),
     5250                                   progressDesc,
     5251                                   TRUE /* aCancelable */,
     5252                                   3    /* cOperations */,
     5253                                   10   /* ulTotalOperationsWeight */,
     5254                                   Bstr(tr("Fault Tolerance syncing of remote virtual machine")),
     5255                                   1    /* ulFirstOperationWeight */,
     5256                                   NULL);
     5257
    52255258    if (FAILED(rc))
    52265259        return rc;
     
    52605293        task->mSavedStateFile = savedStateFile;
    52615294    task->mTeleporterEnabled = fTeleporterEnabled;
     5295    task->mFaultToleranceSyncEnabled = fFaultToleranceSyncEnabled;
    52625296
    52635297    /* Reset differencing hard disks for which autoReset is true,
     
    53645398    else if (fTeleporterEnabled)
    53655399        setMachineState(MachineState_TeleportingIn);
     5400    else if (enmFaultToleranceState == FaultToleranceState_Target)
     5401        setMachineState(MachineState_FaultTolerantSyncing);
    53665402    else
    53675403        setMachineState(MachineState_Starting);
     
    54315467              || mMachineState == MachineState_Restoring
    54325468              || mMachineState == MachineState_TeleportingPausedVM
     5469              || mMachineState == MachineState_FaultTolerantSyncing
    54335470              || mMachineState == MachineState_TeleportingIn
    54345471              , ("Invalid machine state: %s\n", Global::stringifyMachineState(mMachineState)));
     
    54455482        && (   mMachineState == MachineState_Starting
    54465483            || mMachineState == MachineState_Restoring
     5484            || mMachineState == MachineState_FaultTolerantSyncing
    54475485            || mMachineState == MachineState_TeleportingIn)
    54485486       )
     
    54635501        && mMachineState != MachineState_TeleportingIn
    54645502        && mMachineState != MachineState_TeleportingPausedVM
     5503        && mMachineState != MachineState_FaultTolerantSyncing
    54655504       )
    54665505        setMachineState(MachineState_Stopping);
     
    60866125                && that->mMachineState != MachineState_Restoring
    60876126                && that->mMachineState != MachineState_TeleportingIn
     6127                && that->mMachineState != MachineState_FaultTolerantSyncing
    60886128                && that->mMachineState != MachineState_TeleportingPausedVM
    60896129                && !that->mVMIsAlreadyPoweringOff
     
    61906230                    that->setMachineState(MachineState_Teleported);
    61916231                    break;
     6232                case MachineState_FaultTolerantSyncing:
     6233                    /* Fault tolerant sync failed or was canceled.  Back to powered off. */
     6234                    that->setMachineState(MachineState_PoweredOff);
     6235                    break;
    61926236            }
    61936237            break;
     
    62166260                case MachineState_Stopping:
    62176261                case MachineState_TeleportingIn:
    6218                     /* The worker threads handles the transition. */
     6262                    /* The worker thread handles the transition. */
    62196263                    break;
    62206264
     
    62606304        {
    62616305            if (   aOldState == VMSTATE_POWERING_ON
    6262                 || aOldState == VMSTATE_RESUMING)
     6306                || aOldState == VMSTATE_RESUMING
     6307                || aOldState == VMSTATE_RUNNING_FT)
    62636308            {
    62646309                AutoWriteLock alock(that COMMA_LOCKVAL_SRC_POS);
     
    62756320                               || that->mMachineState == MachineState_Saving
    62766321                              )
    6277                            && aOldState == VMSTATE_RESUMING));
     6322                           && aOldState == VMSTATE_RESUMING)
     6323                       || (   that->mMachineState == MachineState_FaultTolerantSyncing
     6324                           && aOldState == VMSTATE_RUNNING_FT));
    62786325
    62796326                that->setMachineState(MachineState_Running);
     
    62866333            AssertMsg(   that->mMachineState == MachineState_LiveSnapshotting
    62876334                      || that->mMachineState == MachineState_Teleporting,
     6335                      ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(aOldState),  VMR3GetStateName(aState) ));
     6336            break;
     6337
     6338        case VMSTATE_RUNNING_FT:
     6339            AssertMsg(that->mMachineState == MachineState_FaultTolerantSyncing,
    62886340                      ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(aOldState),  VMR3GetStateName(aState) ));
    62896341            break;
     
    72207272         *       SessionMachine::setMachineState() when the VM is powered down.
    72217273         */
    7222         if (!task->mTeleporterEnabled)
     7274        if (    !task->mTeleporterEnabled
     7275            &&  !task->mFaultToleranceSyncEnabled)
    72237276        {
    72247277            rc = console->mControl->LockMedia();
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r31701 r31706  
    29462946                 *        make DrvVD undo TempReadOnly.  It gets interesting if we fail after
    29472947                 *        that. Grumble. */
    2948                 else if (aMachineState == MachineState_TeleportingIn)
     2948                else if (   aMachineState == MachineState_TeleportingIn
     2949                         || aMachineState == MachineState_FaultTolerantSyncing)
    29492950                {
    29502951                    InsertConfigInteger(pCfg, "TempReadOnly", 1);
  • trunk/src/VBox/Main/MachineImpl.cpp

    r31698 r31706  
    25922592
    25932593    /* @todo deal with running state change. */
     2594    HRESULT rc = checkStateDependency(MutableStateDep);
     2595    if (FAILED(rc)) return rc;
    25942596
    25952597    setModified(IsModified_MachineData);
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