Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 31705)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 31706)
@@ -215,5 +215,6 @@
           mConfigConstructor(NULL),
           mStartPaused(false),
-          mTeleporterEnabled(FALSE)
+          mTeleporterEnabled(FALSE),
+          mFaultToleranceSyncEnabled(FALSE)
     {}
 
@@ -223,4 +224,5 @@
     bool mStartPaused;
     BOOL mTeleporterEnabled;
+    BOOL mFaultToleranceSyncEnabled;
 
     /* array of progress objects for hard disk reset operations */
@@ -1662,4 +1664,14 @@
             }
             return setError(VBOX_E_INVALID_VM_STATE, tr("Cannot power down at this point in a live snapshot"));
+
+        /* Try cancel the FT sync. */
+        case MachineState_FaultTolerantSyncing:
+            if (!mptrCancelableProgress.isNull())
+            {
+                HRESULT hrc = mptrCancelableProgress->Cancel();
+                if (SUCCEEDED(hrc))
+                    break;
+            }
+            return setError(VBOX_E_INVALID_VM_STATE, tr("Cannot power down at this point in a fault tolerant sync"));
 
         /* extra nice error message for a common case */
@@ -5200,4 +5212,10 @@
 #endif
 
+    /* test the FaultToleranceState property  */
+    FaultToleranceState_T enmFaultToleranceState;
+    rc = mMachine->COMGETTER(FaultToleranceState)(&enmFaultToleranceState);
+    if (FAILED(rc)) return rc;
+    BOOL fFaultToleranceSyncEnabled = (enmFaultToleranceState == FaultToleranceState_Target);
+
     /* create a progress object to track progress of this operation */
     ComObjPtr<Progress> powerupProgress;
@@ -5208,11 +5226,15 @@
     else if (fTeleporterEnabled)
         progressDesc = tr("Teleporting virtual machine");
+    else if (fFaultToleranceSyncEnabled)
+        progressDesc = tr("Fault Tolerance syncing of remote virtual machine");
     else
         progressDesc = tr("Starting virtual machine");
-    if (mMachineState == MachineState_Saved || !fTeleporterEnabled)
+    if (    mMachineState == MachineState_Saved 
+        ||  !fTeleporterEnabled)
         rc = powerupProgress->init(static_cast<IConsole *>(this),
                                    progressDesc,
                                    FALSE /* aCancelable */);
     else
+    if (fTeleporterEnabled)
         rc = powerupProgress->init(static_cast<IConsole *>(this),
                                    progressDesc,
@@ -5223,4 +5245,15 @@
                                    1    /* ulFirstOperationWeight */,
                                    NULL);
+    else
+    if (fFaultToleranceSyncEnabled)
+        rc = powerupProgress->init(static_cast<IConsole *>(this),
+                                   progressDesc,
+                                   TRUE /* aCancelable */,
+                                   3    /* cOperations */,
+                                   10   /* ulTotalOperationsWeight */,
+                                   Bstr(tr("Fault Tolerance syncing of remote virtual machine")),
+                                   1    /* ulFirstOperationWeight */,
+                                   NULL);
+
     if (FAILED(rc))
         return rc;
@@ -5260,4 +5293,5 @@
         task->mSavedStateFile = savedStateFile;
     task->mTeleporterEnabled = fTeleporterEnabled;
+    task->mFaultToleranceSyncEnabled = fFaultToleranceSyncEnabled;
 
     /* Reset differencing hard disks for which autoReset is true,
@@ -5364,4 +5398,6 @@
     else if (fTeleporterEnabled)
         setMachineState(MachineState_TeleportingIn);
+    else if (enmFaultToleranceState == FaultToleranceState_Target)
+        setMachineState(MachineState_FaultTolerantSyncing);
     else
         setMachineState(MachineState_Starting);
@@ -5431,4 +5467,5 @@
               || mMachineState == MachineState_Restoring
               || mMachineState == MachineState_TeleportingPausedVM
+              || mMachineState == MachineState_FaultTolerantSyncing
               || mMachineState == MachineState_TeleportingIn
               , ("Invalid machine state: %s\n", Global::stringifyMachineState(mMachineState)));
@@ -5445,4 +5482,5 @@
         && (   mMachineState == MachineState_Starting
             || mMachineState == MachineState_Restoring
+            || mMachineState == MachineState_FaultTolerantSyncing
             || mMachineState == MachineState_TeleportingIn)
        )
@@ -5463,4 +5501,5 @@
         && mMachineState != MachineState_TeleportingIn
         && mMachineState != MachineState_TeleportingPausedVM
+        && mMachineState != MachineState_FaultTolerantSyncing
        )
         setMachineState(MachineState_Stopping);
@@ -6086,4 +6125,5 @@
                 && that->mMachineState != MachineState_Restoring
                 && that->mMachineState != MachineState_TeleportingIn
+                && that->mMachineState != MachineState_FaultTolerantSyncing
                 && that->mMachineState != MachineState_TeleportingPausedVM
                 && !that->mVMIsAlreadyPoweringOff
@@ -6190,4 +6230,8 @@
                     that->setMachineState(MachineState_Teleported);
                     break;
+                case MachineState_FaultTolerantSyncing:
+                    /* Fault tolerant sync failed or was canceled.  Back to powered off. */
+                    that->setMachineState(MachineState_PoweredOff);
+                    break;
             }
             break;
@@ -6216,5 +6260,5 @@
                 case MachineState_Stopping:
                 case MachineState_TeleportingIn:
-                    /* The worker threads handles the transition. */
+                    /* The worker thread handles the transition. */
                     break;
 
@@ -6260,5 +6304,6 @@
         {
             if (   aOldState == VMSTATE_POWERING_ON
-                || aOldState == VMSTATE_RESUMING)
+                || aOldState == VMSTATE_RESUMING
+                || aOldState == VMSTATE_RUNNING_FT)
             {
                 AutoWriteLock alock(that COMMA_LOCKVAL_SRC_POS);
@@ -6275,5 +6320,7 @@
                                || that->mMachineState == MachineState_Saving
                               )
-                           && aOldState == VMSTATE_RESUMING));
+                           && aOldState == VMSTATE_RESUMING)
+                       || (   that->mMachineState == MachineState_FaultTolerantSyncing
+                           && aOldState == VMSTATE_RUNNING_FT));
 
                 that->setMachineState(MachineState_Running);
@@ -6286,4 +6333,9 @@
             AssertMsg(   that->mMachineState == MachineState_LiveSnapshotting
                       || that->mMachineState == MachineState_Teleporting,
+                      ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(aOldState),  VMR3GetStateName(aState) ));
+            break;
+
+        case VMSTATE_RUNNING_FT:
+            AssertMsg(that->mMachineState == MachineState_FaultTolerantSyncing,
                       ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(aOldState),  VMR3GetStateName(aState) ));
             break;
@@ -7220,5 +7272,6 @@
          *       SessionMachine::setMachineState() when the VM is powered down.
          */
-        if (!task->mTeleporterEnabled)
+        if (    !task->mTeleporterEnabled
+            &&  !task->mFaultToleranceSyncEnabled)
         {
             rc = console->mControl->LockMedia();
Index: /trunk/src/VBox/Main/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 31705)
+++ /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 31706)
@@ -2946,5 +2946,6 @@
                  *        make DrvVD undo TempReadOnly.  It gets interesting if we fail after
                  *        that. Grumble. */
-                else if (aMachineState == MachineState_TeleportingIn)
+                else if (   aMachineState == MachineState_TeleportingIn
+                         || aMachineState == MachineState_FaultTolerantSyncing)
                 {
                     InsertConfigInteger(pCfg, "TempReadOnly", 1);
Index: /trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MachineImpl.cpp	(revision 31705)
+++ /trunk/src/VBox/Main/MachineImpl.cpp	(revision 31706)
@@ -2592,4 +2592,6 @@
 
     /* @todo deal with running state change. */
+    HRESULT rc = checkStateDependency(MutableStateDep);
+    if (FAILED(rc)) return rc;
 
     setModified(IsModified_MachineData);
